DocumentationRecipesReferenceChangelog
Log In
Documentation

COCO format

The COCO format exports bounding boxes, polygons and semantic segmentation from image and video projects, in a single labels.json file that follows the COCO object detection format.

Points, lines, pose estimation and classification aren't exported to COCO.

Archive structure

export.zip
├── README.kili.txt
├── labels.json
└── data/
    ├── image_1.jpg
    └── image_2.jpg

With One label per asset for each job, each job gets its own folder holding its labels.json.

For video assets, each frame that holds an annotation is saved as an image in data/.

labels.json

labels.json holds three lists:

  • images: one entry per exported image or video frame, with its file name (its path in data/), width and height.
  • categories: one entry per class of the exported jobs. When the file groups several jobs, class names are prefixed with their job (JOB/CATEGORY).
  • annotations: one entry per annotation, with:
    • bbox: [x, y, width, height], in pixels, from the top-left corner of the image.
    • segmentation: the polygon points, in pixels. A bounding box is written as its four corners. A semantic segmentation made of several parts lists one polygon per part.
    • area: the annotation's area in pixels, holes excluded.
    • iscrowd: always 0.

Cloud storage

You can export to COCO from a project connected to a cloud storage. The archive then contains labels.json only, sized from the image resolutions stored in Kili.

Exporting from the SDK

COCO is also available from the SDK (fmt="coco"), with the same output. Install the coco extra first: pip install "kili[coco]". From the SDK, you can customize each COCO annotation with the annotation_modifier argument. For details, refer to the Kili SDK documentation.


Did this page help you?