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

You can also import your COCO labels/annotations as predictions on your Active Projects.

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.
The COCO file MUST include the info field. If it is missing, add it as: "info": {},.
  1. If necessary, modify the matching logic that maps COCO image IDs to Encord frame indices. This is particularly important in cases where filenames in the COCO file do not directly match those in the Encord project or when multiple files have the same name.

The following import.py script is configured to import labels into single images with unique names and assumes that the category names in the COCO file match the names of your Ontology objects.

In practice, you must implement your own matching logic. An example where filenames in the COCO file do not directly match those in the Encord project is provided below.