View source Download .ipynb

Create Table from YOLO Instance Segmentation¶

Create a 3LC Table from YOLO-format dataset with polygon-based instance segmentation annotations for modern object detection pipelines.

img

YOLO format is widely used in modern computer vision pipelines due to its simplicity and efficiency. The polygon-based segmentation format provides precise boundaries while maintaining fast inference speeds.

This notebook loads a YOLO-format segmentation dataset and converts it to a 3LC Table. We process both image files and corresponding text annotation files containing normalized polygon coordinates for each instance.

Project setup¶

[ ]:
PROJECT_NAME = "3LC Tutorials - YOLO Segmentation"
DATASET_NAME = "YOLO-Seg-Dataset"
TABLE_NAME = "initial-segmentation"
DATA_PATH = "../../../data"

Install dependencies¶

[ ]:
%pip install -q 3lc

Imports¶

[ ]:
from pathlib import Path

import tlc

Create Segmentation Table¶

[ ]:
images_path = (Path(DATA_PATH) / "yolo" / "datasets" / "simple" / "images").absolute()

assert images_path.exists()

train_table = tlc.Table.from_yolo_url(
    images_url=images_path,
    categories={1.0: "A", 2.0: "B", 3.0: "C"},
    project_name=PROJECT_NAME,
    dataset_name=DATASET_NAME,
    table_name=TABLE_NAME,
    task="segment",
)