tlc.core.export.exporters.yoloΒΆ

Exporter for the YOLO format.

Module ContentsΒΆ

ClassesΒΆ

Class

Description

YOLOExporter

Exporter for the YOLO format.

APIΒΆ

class YOLOExporterΒΆ

Bases: tlc.core.export.exporter.Exporter

Exporter for the YOLO format.

YOLO format writes:

  • One label file per image (only if there are labels)

  • A dataset YAML configuration file

  • Optionally copies/moves/symlinks images to the output directory

The exporter supports:

  • Detection (bounding boxes)

  • Segmentation (polygons)

  • Pose (keypoints)

  • Oriented bounding boxes (OBB)

Additive exports are supported: you can export multiple tables to the same output directory by calling export_yolo() multiple times with different split names. Each split must have matching category mappings. Example:

train_table.export(output_url="./dataset", format="yolo", split="train")
val_table.export(output_url="./dataset", format="yolo", split="val")

Output directory structure:

<output_url>/
β”œβ”€β”€ <dataset.yaml
β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ train/
β”‚   β”‚   β”œβ”€β”€ image1.jpg
β”‚   β”‚   └── ...
β”‚   └── val/
β”‚       └── ...
└── labels/
    β”œβ”€β”€ train/
    β”‚   β”œβ”€β”€ image1.txt
    β”‚   └── ...
    └── val/
        └── ...
classmethod can_export(
table: Table,
output_url: Url,
) boolΒΆ

Check if the table can be exported to the YOLO format.

YOLO export requires:

  • A bounding box, segmentation, keypoints, or OBB column

  • An output URL that is a directory (no extension or empty extension)

classmethod export_yolo(
table: Table,
output_url: Url,
weight_threshold: float = 0.0,
split: str = 'train',
image_strategy: Literal[ignore, copy, move, symlink] = 'ignore',
image_column_name: str | None = None,
annotation_column_name: str | None = None,
dataset_name: str = 'dataset',
**kwargs: Any,
) NoneΒΆ

Export a table to YOLO format.

Parameters:
  • table – The table to export.

  • output_url – The directory URL to export to.

  • weight_threshold – The weight threshold for filtering rows.

  • split – The name of the split (e.g., β€œtrain”, β€œval”, β€œtest”). Defaults to β€œtrain”.

  • image_strategy – How to handle images. Options are: - β€œignore”: Do not copy or symlink images (default). - β€œcopy”: Copy images to the output directory. - β€œmove”: Move images to the output directory. - β€œsymlink”: Create symlinks to images. Only works for local file URLs. Not supported on Windows.

  • image_column_name – The column containing image URLs. Defaults to β€œimage”.

  • annotation_column_name – The column containing annotations. Auto-detected if not provided.

  • dataset_name – The name for the dataset YAML file. Defaults to β€œdataset”.

  • **kwargs – Additional arguments (ignored).

priority = 2ΒΆ
supported_format = yoloΒΆ