Labeled data is only useful if your training code can read it. Most computer vision projects end up using one of three formats: COCO JSON, YOLO TXT or Pascal VOC XML. Here is how they differ and when to use each.
COCO (JSON)
One JSON file per dataset split, with images , annotations and categories arrays.
{ "images" : [ { "id" : 1 , "file_name" : "shelf_001.jpg" , "width" : 1920 , "height" : 1080 } ] , "annotations" : [ { "id" : 10 , "image_id" : 1 , "category_id" : 3 , "bbox" : [ 412 , 220 , 180 , 96 ] , "area" : 17280 , "segmentation" : [ [ 412 , 220 , 592 , 220 , 592 , 316 , 412 , 316 ] ] , "iscrowd" : 0 } ] , "categories" : [ { "id" : 3 , "name" : "bottle" } ] }
Enter fullscreen mode
Exit fullscreen mode
Boxes are [x, y, width, height] in pixels, from the top-left corner.
Supports polygons, RLE masks and keypoints.
Best for: instance segmentation, keypoints, and any project that uses Detectron2 or MMDetection.
YOLO (TXT)
One .txt file per image, one line per object:
3 0.2615 0.2481 0.0938…