此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • 函数
  • clone
  • delete
  • export
  • health
  • info
  • inspect
  • ls
  • merge
  • parse
  • pull
  • push
  • sanitize
  • 属性
  • app
  • AUG_CONFIG_VALIDATOR
  • BucketStorageT
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Python API: luxonis_ml.data.__main__

函数

clone

Python
1def clone(name: str, new_name: str, *, push: Annotated[bool, Parameter(alias='-p', negative=())] = True, bucket_storage: BucketStorageT = BucketStorage.LOCAL, split: Annotated[list[str] | None, Parameter(alias='-s')] = None, team_id: Annotated[str | None, Parameter(alias='-t')] = None):
使用新名称克隆现有数据集。如果它是远程数据集,则可以选择将其推送到云存储。参数
  • name (str): 要克隆的源数据集的名称。
  • new_name (str): 新克隆数据集的名称。
  • push (Annotated[bool, Parameter(alias='-p', negative=())]): 如果为 True,则将新克隆的数据集上传到云存储。
  • bucket_storage (BucketStorageT): 源数据集的存储类型。
  • split (Annotated[list[str] | None, Parameter(alias='-s')]): 要克隆的拆分名称列表。如果未提供,将克隆所有拆分。示例:--split train --split val 仅克隆“train”和“val”拆分。
  • team_id (Annotated[str | None, Parameter(alias='-t')]): 用于新数据集的团队 ID。

delete

Python
1def delete(*names: str, bucket_storage: BucketStorageT = BucketStorage.LOCAL, local: Annotated[bool, Parameter(alias='-l', negative=())] = False, remote: Annotated[bool, Parameter(alias='-r', negative=())] = False, yes: Annotated[bool, Parameter(alias='-y', negative=())] = False):
从本地存储、远程存储或两者中删除数据集。参数
  • *names (str): 要删除的数据集的名称。
  • bucket_storage (BucketStorageT): 数据集的存储类型。
  • local (Annotated[bool, Parameter(alias='-l', negative=())]): 如果为 True,则从本地存储中删除数据集。
  • remote (Annotated[bool, Parameter(alias='-r', negative=())]): 如果为 True,则从远程存储中删除数据集。
  • yes (Annotated[bool, Parameter(alias='-y', negative=())]): 如果为 True,则跳过确认提示并立即删除。

export

Python
1def export(name: str, *, save_dir: Annotated[str | None, Parameter(alias='-s')] = None, dataset_type: Annotated[DatasetType, Parameter(name='--type', alias='-t')] = DatasetType.NATIVE, delete_existing: Annotated[bool, Parameter(name='--delete', alias='-d', negative=())] = False, max_partition_size_gb: Annotated[float | None, Parameter(alias='-m')] = None, zip: bool = True, ldf_version: str | None = None, bucket_storage: BucketStorageT = BucketStorage.LOCAL):
将 Luxonis 数据集导出到磁盘。参数
  • name (str): 要导出的数据集的名称。
  • save_dir (Annotated[str | None, Parameter(alias='-s')]): 导出数据集将保存到的目录。如果未提供,将在当前工作目录中创建一个与数据集同名的目录。
  • dataset_type (Annotated[DatasetType, Parameter(name='--type', alias='-t')]): 导出数据集的格式。
  • delete_existing (Annotated[bool, Parameter(name='--delete', alias='-d', negative=())]): 如果为 True,则在导出前删除保存位置的任何现有目录。
  • max_partition_size_gb (Annotated[float | None, Parameter(alias='-m')]): 每个分区的最大大小(GB)。如果未提供,则不进行分区。
  • zip (bool): 如果为 True,则导出的数据集将被压缩成一个存档。如果为 False,则数据集将以指定结构导出为目录。
  • ldf_version (str | None): 要写入的 LDF 版本,例如 2.0,以便旧版 luxonis-ml 可以读取导出。仅在 --type native 时有效。降级是有损的,并会警告其丢弃的内容。
  • bucket_storage (BucketStorageT): 数据集的存储类型。

health

Python
1def health(name: str, *, view: Annotated[str | None, Parameter(alias='-v')] = None, sample_size: Annotated[int | None, Parameter(alias='-n')] = None, save_dir: Annotated[str | None, Parameter(alias='-s')] = None, bucket_storage: BucketStorageT = BucketStorage.LOCAL):
绘制数据集中每个任务类型和相应任务名称的类分布和热图。还会检查缺少注释的文件、共享相同 UUID 的文件以及具有重复注释的文件。参数
  • name (str): 要检查的数据集的名称。
  • view (Annotated[str | None, Parameter(alias='-v')]): 要检查的数据集的哪个拆分。如果未提供,将检查所有拆分。
  • sample_size (Annotated[int | None, Parameter(alias='-n')]): 从数据集中采样用于计算统计数据和绘图的注释行数。如果未提供,将使用所有注释。
  • save_dir (Annotated[str | None, Parameter(alias='-s')]): 生成的绘图将保存到的目录。如果未提供,绘图将以交互方式显示,而不是保存。
  • bucket_storage (BucketStorageT): 数据集的存储类型。

info

Python
1def info(name: str, *, bucket_storage: BucketStorageT = BucketStorage.LOCAL):
打印有关数据集的信息。参数
  • name (str): 数据集的名称。
  • bucket_storage (BucketStorageT): 数据集的存储类型。

inspect

Python
1def inspect(name: str, *, view: Annotated[list[str] | None, Parameter(alias='-v')] = None, aug_config: Annotated[Path | None, Parameter(alias='-a', validator=AUG_CONFIG_VALIDATOR)] = None, size_multiplier: Annotated[float, Parameter(alias='-s')] = 1.0, ignore_aspect_ratio: Annotated[bool, Parameter(alias='-i', negative=())] = False, deterministic: Annotated[bool, Parameter(alias='-d', negative=())] = False, force_update: Annotated[bool, Parameter(alias='-f', negative=())] = False, blend_all: Annotated[bool, Parameter(alias='-bl', negative=())] = False, per_instance: Annotated[bool, Parameter(alias='-pi', negative=())] = False, list_augmentations: Annotated[bool, Parameter(negative=())] = False, print_sample_metadata: Annotated[bool, Parameter(negative=())] = True, skeletons: Annotated[bool, Parameter(negative=())] = False, keypoint_labels: Annotated[Literal['none', 'numbers', 'names', 'full'], Parameter()] = 'numbers', bucket_storage: BucketStorageT = BucketStorage.LOCAL):
检查数据集中的图像和注释。参数
  • name (str): 要检查的数据集的名称。
  • view (Annotated[list[str] | None, Parameter(alias='-v')]): 要检查的数据集的哪些拆分。如果未提供,默认将检查“train”拆分。
  • aug_config (Annotated[Path | None, Parameter(alias='-a', validator=AUG_CONFIG_VALIDATOR)]): 定义检查数据集时要应用的增强的 JSON 或 YAML 配置的路径。如果未提供,则不应用增强。
  • size_multiplier (Annotated[float, Parameter(alias='-s')]): 显示图像大小的乘数。
  • ignore_aspect_ratio (Annotated[bool, Parameter(alias='-i', negative=())]): 调整图像大小时不保持纵横比。
  • deterministic (Annotated[bool, Parameter(alias='-d', negative=())]): 使用确定性增强模式。
  • force_update (Annotated[bool, Parameter(alias='-f', negative=())]): 首先强制与远程存储同步。
  • blend_all (Annotated[bool, Parameter(alias='-bl', negative=())]): 在同一图像上绘制属于不同任务的标签。
  • per_instance (Annotated[bool, Parameter(alias='-pi', negative=())]): 在单独的窗口中显示每个标签实例。
  • list_augmentations (Annotated[bool, Parameter(negative=())]): 显示应用于每个显示图像的增强。需要设置 --aug-config。
  • print_sample_metadata (Annotated[bool, Parameter(negative=())]): 打印每个显示样本的样本元数据。
  • skeletons (Annotated[bool, Parameter(negative=())]): 绘制关键点骨架边缘。
  • keypoint_labels (Annotated[Literal['none', 'numbers', 'names', 'full'], Parameter()]): 指定如何绘制关键点标签。
  • bucket_storage (BucketStorageT): 数据集的存储类型。

ls

Python
1def ls(*, full: Annotated[bool, Parameter(alias='-f')] = False, bucket_storage: BucketStorageT = BucketStorage.LOCAL):
列出数据集。参数
  • full (Annotated[bool, Parameter(alias='-f')]): 如果为 True,则显示每个数据集的完整信息,包括类和任务。
  • bucket_storage (BucketStorageT): 数据集的存储类型。

merge

Python
1def merge(source_name: str, target_name: str, new_name: Annotated[str | None, Parameter(alias='-n')] = None, splits_to_merge: Annotated[str | None, Parameter(name='--split', alias='-s')] = None, bucket_storage: BucketStorageT = BucketStorage.LOCAL, team_id: Annotated[str | None, Parameter(alias='-t')] = None):
合并存储在相同类型存储桶中的两个数据集。参数
  • source_name (str): 要合并的源数据集的名称。
  • target_name (str): 要合并到的目标数据集的名称。
  • new_name (Annotated[str | None, Parameter(alias='-n')]): 如果提供,则为新合并数据集的名称。如果未提供,则源数据集将就地合并到目标数据集。
  • splits_to_merge (Annotated[str | None, Parameter(name='--split', alias='-s')]): 要合并的拆分名称的逗号分隔列表。如果未提供,将合并所有拆分。
  • bucket_storage (BucketStorageT): 两个数据集的存储类型。
  • team_id (Annotated[str | None, Parameter(alias='-t')]): 用于新数据集的团队 ID。如果未提供,将使用目标数据集的团队 ID。

parse

Python
1def parse(dataset: Annotated[str, Parameter(alias='--dataset-dir')], *, name: Annotated[str | None, Parameter(alias='-n')] = None, dataset_type: Annotated[DatasetType | None, Parameter(name='--type', alias='-t')] = None, bucket_storage: BucketStorageT = BucketStorage.LOCAL, delete_local: Annotated[bool, Parameter(name='--delete', alias='-d', negative=())] = False, save_dir: Annotated[Path | None, Parameter(alias='-s')] = None, task_name: Annotated[str | None, Parameter(alias='-tn')] = None, log_all_warnings: bool = False, split_ratio: Annotated[str | None, Parameter(alias='-sr')] = None, train: float | None = None, val: float | None = None, test: float | None = None):
解析包含数据的目录并创建 Luxonis 数据集。参数
  • dataset (Annotated[str, Parameter(alias='--dataset-dir')]): 数据集的路径或 URL。
  • name (Annotated[str | None, Parameter(alias='-n')]): 数据集的名称。如果未提供,将使用目录名称。
  • dataset_type (Annotated[DatasetType | None, Parameter(name='--type', alias='-t')]): 数据集的类型。如果未提供,解析器将尝试检测它。
  • bucket_storage (BucketStorageT): 数据集的存储类型。
  • delete_local (Annotated[bool, Parameter(name='--delete', alias='-d', negative=())]): 如果为 True,则在解析前删除任何具有相同名称的现有本地数据集。
  • save_dir (Annotated[Path | None, Parameter(alias='-s')]): 如果 dataset_dir 是远程 URL,这是数据集在解析前将下载到的本地目录。如果未提供,数据集将下载到当前工作目录。
  • task_name (Annotated[str | None, Parameter(alias='-tn')]): 用于从此数据集解析的所有记录的任务名称。
  • log_all_warnings (bool): 记录所有跳过的注释警告,而不是将输出限制为 50 条。
  • split_ratio (Annotated[str | None, Parameter(alias='-sr')]): 指定训练集、验证集和测试集拆分比例的 Python 列表的字符串表示。已弃用,推荐使用 --train、--val 和 --test。
  • train (float | None): 分配给训练集的记录比例或数量。可与 --val 和 --test 一起使用。如果仅提供其中一些选项,则剩余的拆分将获得剩余记录的相等份额(仅支持比例,不支持数量)。
  • val (float | None): 分配给验证集的记录比例或数量。
  • test (float | None): 分配给测试集的记录比例或数量。

pull

Python
1def pull(name: str, *, force: Annotated[bool, Parameter(alias='-f', negative=())] = False, bucket_storage: BucketStorageT = BucketStorage.LOCAL):
将远程数据集拉取到本地存储。参数
  • name (str): 要拉取的数据集的名称。
  • force (Annotated[bool, Parameter(alias='-f', negative=())]): 如果为 True,即使本地已存在所有媒体文件,也强制拉取。
  • bucket_storage (BucketStorageT): 要从中拉取的云存储类型。不能是 LOCAL。

push

Python
1def push(name: str, *, bucket_storage: BucketStorage, force: Annotated[bool, Parameter(alias='-f', negative=())] = False):
将本地数据集推送到云存储。参数
  • name (str): 要推送的数据集的名称。
  • bucket_storage (BucketStorage): 要推送到的云存储类型。不能是 LOCAL。
  • force (Annotated[bool, Parameter(alias='-f', negative=())]): 如果为 True,即使目标云存储中已存在所有媒体文件,也强制推送。

sanitize

Python
1def sanitize(name: str, bucket_storage: BucketStorageT = BucketStorage.LOCAL):
从数据集中删除重复的注释和重复的文件。参数
  • name (str): 要清理的数据集的名称。
  • bucket_storage (BucketStorageT): 数据集的存储类型。

属性

app

AUG_CONFIG_VALIDATOR

BucketStorageT