{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Create Table from YOLO Instance Segmentation\n", "\n", "Create a 3LC Table from YOLO-format dataset with polygon-based instance segmentation annotations for modern object detection pipelines.\n", "\n", "![img](../../images/create-yolo-table.png)\n", "\n", "\n", "\n", "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.\n", "\n", "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.\n" ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "## Project setup\n" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "PROJECT_NAME = \"3LC Tutorials - YOLO Segmentation\"\n", "DATASET_NAME = \"YOLO-Seg-Dataset\"\n", "TABLE_NAME = \"initial-segmentation\"\n", "DATA_PATH = \"../../../data\"" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "## Install dependencies\n" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "%pip install 3lc" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "## Imports\n" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "import tlc" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "## Create Segmentation Table\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "dataset_yaml_file = (Path(DATA_PATH) / \"yolo\" / \"simple.yaml\").absolute()\n", "\n", "assert dataset_yaml_file.exists()\n", "\n", "train_table = tlc.Table.from_yolo(\n", " dataset_yaml_file=str(dataset_yaml_file),\n", " split=\"train\",\n", " project_name=PROJECT_NAME,\n", " dataset_name=DATASET_NAME,\n", " table_name=TABLE_NAME,\n", " task=\"segment\",\n", ")" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }