Encord’s SDK supports importing labels/annotations for your data in the COCO format.

This guide assumes your files were already imported into Encord and a Project containing the data has been created.
  1. Save import.py, replacing the following variables:
    • <private_key_path> with the full path to your private key.
    • <project_hash> with the hash of the project containing the data units you want to import labels for.
    • COCOimportfile.json with the full path of the COCO file containing the labels you want to import.
    • cutekitty.jpg with the name of the file you want to import labels for.
The COCO file MUST start with "info": {},.
  1. If necessary, implement the matching logic to map COCO image IDs to Encord frame indices. This is particularly important in cases where filenames in your COCO file do not directly match those in your Encord Project or when you have multiple files with the same name. Examples for these cases are provided below.

The provided import.py script is configured to import labels exclusively for cutekitty.jpg, serving as an example. In practice, you must likely implement your own unique matching logic. Examples of such cases are provided below.

The following script assumes that the category names in the COCO file match the names of your Ontology objects.