YOLO annotation format

A text file per image, one object per line: the class index and coordinates normalized to the image size, plus a YAML file with the class names.

Data
Images
Labels
BoxesPolygonsKeypoints
Files
.txt, .yaml
Import / export
Yes / Yes
The format

What is the YOLO format?

YOLO is the dataset format of the Ultralytics YOLO models. Every image has a .txt label file with the same name, with one object per line, and a YAML file names the classes and points to the train and validation images.

A line starts with the class index, followed by coordinates normalized to 0–1 by the image width and height: x_center y_center width height for detection, a list of x y vertices for segmentation, and a box followed by keypoints, as px py or px py visibility, for pose estimation.

Files

Folder structure and an example

Folder structure for import
project
├── images
│   ├── train
│   │   ├── IMG_0748.jpeg
│   │   └── IMG_1836.jpeg
│   └── val
│       └── IMG_4451.jpeg
├── labels
│   ├── train
│   │   ├── IMG_0748.txt
│   │   └── IMG_1836.txt
│   └── val
│       └── IMG_4451.txt
└── data_config.yaml
labels/train/IMG_0748.txt (detection)
0 0.481719 0.634028 0.690625 0.713278
0 0.741094 0.524306 0.314750 0.933389
27 0.364844 0.795833 0.078125 0.400000
data_config.yaml
names: [kiwi, lemon]               # class names
colors: [[255, 1, 1], [1, 255, 1]] # class colors
nc: 2                              # number of classes
train: ../lemons/images/train      # path to train images
val: ../lemons/images/val          # path to val images
kpt_shape: [17, 3]                 # pose only: keypoints, dims (2 for x,y or 3 for x,y,visible)
In and out

Import and export YOLO in Supervisely

Import YOLO into Supervisely

Export from Supervisely to YOLO

  • Export to YOLOv8 format

    For segmentation and pose estimation: polygons, bitmaps and alpha masks become segmentation lines, keypoint graphs become pose lines. Other shapes are skipped.

  • Convert Supervisely to YOLO v5 format

    For detection: exports rectangle classes as YOLO boxes with a data_config.yaml.

  • Python SDK

    sly.convert.project_to_yolo() converts a downloaded project, with a choice of task type.

All apps are in the Ecosystem, under Import and Export. Every project is stored in Supervisely JSON in between.

Conversion

Converting YOLO to and from Supervisely JSON

YOLOSupervisely JSONNotes
names, colors in the YAMLclasses and their colors in meta.jsonThe class index of a line is the position in names.
class x_center y_center width heightrectangleNormalized centre and size become pixel corners: left = (x_center − width / 2) × image width, and so on.
class x1 y1 … xn ynpolygonNormalized vertices become pixel coordinates.
box and keypoints (kpt_shape)graph (keypoint structure)Pose labels become keypoints.
images/train, images/valtrain and val datasets and image tagsAs Convert YOLO v5 to Supervisely format creates them.
segmentation linepolygon, bitmap, alpha_maskExport to YOLOv8 format writes masks as polygons.
train / val splitimage tags train, valOn export, an image without a split tag goes to train.