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
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.
Folder structure and an example
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.yaml0 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.400000names: [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)Import and export YOLO in Supervisely
Import YOLO into Supervisely
- Import data (Auto Import)
Reads detection, segmentation and pose labels. Without
data_config.yamlthe default COCO class names are used. - Convert YOLO v5 to Supervisely format
Converts a folder or
.tararchive from Team Files, createstrainandvaldatasets and tags the images with their split.
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.
Converting YOLO to and from Supervisely JSON
| YOLO | Supervisely JSON | Notes |
|---|---|---|
names, colors in the YAML | classes and their colors in meta.json | The class index of a line is the position in names. |
class x_center y_center width height | rectangle | Normalized centre and size become pixel corners: left = (x_center − width / 2) × image width, and so on. |
class x1 y1 … xn yn | polygon | Normalized vertices become pixel coordinates. |
box and keypoints (kpt_shape) | graph (keypoint structure) | Pose labels become keypoints. |
images/train, images/val | train and val datasets and image tags | As Convert YOLO v5 to Supervisely format creates them. |
| segmentation line | polygon, bitmap, alpha_mask | Export to YOLOv8 format writes masks as polygons. |
train / val split | image tags train, val | On export, an image without a split tag goes to train. |