Once you have imported your local data or cloud data into Encord, you can import your labels/annotations for the data.

You MUST call the initialise_labels function (once per data unit) before trying to import your labels/annotations.

The process to import labels into Encord consists of the following:

  1. Import the dependencies.
  2. Authenticate your Encord client.
  3. Specify the Annotate Project with the data you want to label.
  4. Specify the label row you want to import your label to. This specifies the data unit (image, image group, image sequence, video, or DICOM series) you want to add your labels to.
  5. Use the initialise_labels function ONCE to prepare the row for your labels.
  6. Apply your labels to the label row.
  7. Save the label row.
One label row is equivalent to one data unit. You only need to use the initialise_labels function and save the label row ONCE per data unit, regardless of how many labels are added to the data unit. However, any future changes to a data unit need to be initialized and saved.

READ THIS FIRST

All the examples demonstrating the use of each label and classification type utilize the following Project and Ontology:

EntityName
ProjectBlueberries and Cherries PROJECT_HASH: 7d4ead9c-4087-4832-a301-eb2545e7d43b
OntologyBlueberries and Cherries Ontology
Bounding boxCherry
Rotatable bounding boxOther type of fruit
PolygonPersimmon
PolylineBranch
KeypointPedicel
BitmaskBlueberry
Object Primitive (Triangle)Strawberry
Radio classificationBlueberry or cherry?
Checklist classificationMany types of fruit?

Labels

Bounding box

Example 1

Imports a single bounding box (Cherry) to a single image (cherry_001.png).

Example 2:

Imports three instances (tracking an object across three sequential frames: 103, 104, and 105) of a bounding box (Cherry) to a video (Cherries_video.mp4).

Example 3

Imports three bounding boxes (Cherry) to a single image (cherry_001.png).

Example 4:

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 103, 104, 105, object 2 - frames 206, 207, 208, and object 3 - frames 313, 315, 317) of three bounding boxes (Cherry) to a video (Cherries_video.mp4).

Rotatable Bounding Box

Example 1

Imports a single rotatable bounding box (Other type of fruit) to a single image (apple_001.png).

Example 2

Imports three instances (tracking an object across three sequential frames: 120, 121, and 122) of a bounding box (Other type of fruit) to a video (Cherries_video.mp4).

Example 3

Imports three rotatable bounding boxes (Other type of fruit) to a single image (apple_001.png).

Example 4:

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 120, 121, 122, object 2 - frames 222, 224, 226, and object 3 - frames 321, 323, 325) of three rotatable bounding boxes (Other type of fruit) to a video (Cherries_video.mp4).

Polygons

Example 1

Imports a single polygon (Persimmon) to a single image (persimmon_001.jpg).

Example 2

Imports three instances (tracking an object across three sequential frames: 143, 144, and 145) of a polygon (Persimmon) to a video (Cherries_video.mp4).

Example 3

Imports three polygons (Persimmon) to a single image (persimmon_001.jpg).

Example 4:

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 153, 154, 155, object 2 - frames 242, 244, 246, and object 3 - frames 343, 345, 347) of three polygons (Persimmon) to a video (Cherries_video.mp4).

Polyline

Example 1

Imports a single polyline (Branch) to a single image (persimmon_001.jpg).

Example 2

Imports three instances (tracking an object across three sequential frames: 146, 147, and 148) of a polygon (Branch) to a video (Cherries_video.mp4).

Example 3

Imports three polylines (Branch) to a single image (persimmon_001.jpg).

Example 4:

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 246, 247, 248, object 2 - frames 346, 347, 348, and object 3 - frames 446, 447, 448) of three polylines (Branch) to a video (Cherries_video.mp4).

Keypoint

Example 1

Imports a single keypoint (Pedicel) to a single image (blueberry_003.png).

Example 2

Imports three instances (tracking an object across three sequential frames: 143, 144, and 145) of a keypoint (Pedicel) to a video (Blueberries_video.mp4).

Example 3

Imports three keypoints (Pedicel) to a single image (blueberry_003.png).

Example 4:

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 143, 144, 145, object 2 - frames 242, 244, 246, and object 3 - frames 343, 345, 347) of three keypoints (Pedicel) to a video (Blueberries_video.mp4).

Bitmask

Example 1:

Imports a single bitmask (Blueberry) to a single image (blueberry_003.jpg). For simplicity, the bitmask covers the entire image (image dimensions: 1254x836).

Example 2:

Imports three instances (tracking an object across three sequential frames: 156, 157, and 159) of a bitmask (Blueberry) to a video (Blueberries_video.mp4). For simplicity, the bitmask covers the entire frame (video dimensions: 1920x1080).

Example 3:

Imports three bitmasks (Blueberry) to a single image (blueberry_003.jpg). For simplicity, the bitmasks cover the entire image (image dimensions: 1254x836).

Example 4:

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 156, 157, 158, object 2 - frames 256, 258, 259, and object 3 - frames 355, 357, 359) of three bitmasks (Blueberry) to a video (Blueberries_video.mp4). For simplicity, the bitmasks cover the entire frame (video dimensions: 1920x1080).

Object Primitives

Before you can import Object Primitive labels into Encord, the Object Primitive Template MUST exist in Encord. Use the UI to create the Object Primitive Template so you can visually inspect the Object Primitive.

Import Object Primitive labels

Example 1

Imports a single object primitive (Ontology object = Strawberry Object Primitive name = Triangle) to a single image (strawberries_10.jpg).

Example 2

Imports three instances (tracking an object across three sequential frames: 163, 164, and 165) of a object primitive (Ontology object = Strawberry Object Primitive name = Triangle) to a video (Cherries_video.mp4).

Example 3

Imports three object primitives (Ontology object = Strawberry Object Primitive name = Triangle) to a single image (strawberries_10.jpg).

Example 4

Imports three instances (tracking 3 different objects across three frames: object 1 - frames 173, 174, 175, object 2 - frames 183, 184, 185, and object 3 - frames 193, 194, 195) of three object primitives (Ontology object = Strawberry Object Primitive name = Triangle) to a video (Cherries_video.mp4).

Classifications

Radio Button

Example 1:

Imports a radio button classification (Blueberry or Cherry?) to a single image (blueberry_003.jpg).

Example 2:

Imports a radio button classification (Blueberry or Cherry?) across a range of sequential frames: 193 to 197) to a video (Blueberries_video.mp4).

Checklist

Example 1:

Imports a checklist classification (Many types of fruit?) to a single image (apple_003.jpg). The selected items from the list are apple and kiwi.

Example 2:

Imports a checklist classification (Many types of fruit?) across a range of sequential frames: 193 to 197) to a video (Blueberries_video.mp4). The selected items from the list are apple and kiwi.

Import labels in bulk

When importing a large number of labels, here are some tips to improve your label import performance:

  • A data unit is one image, one image group, one image sequence, one video, or one DICOM series. One data unit is equivalent to one label row. You only need to call the initialise_labels function and save the label row ONCE per data unit. It does not matter how many labels are added to the data unit between the initialise_labels function and saving the label row.

  • Use the bundle function to significantly improve the import performance when you do any of the following:

    • Import labels on a large number of individual images (NOT image groups, image sequences, videos, or DICOM sets).
    • Import labels on a large number of data units at once.
We strongly recommend NOT bundling more than 1000 operations at once, because bundling more than 1000 operations can reduce performance instead of improving performance.