Ango Import Format

Overview of the Ango Hub Label Import Format

Ango Hub allows administrators and project managers to import existing annotations. More on label import here.

In order to be imported to the platform, existing labels need to be converted to the Ango Hub Import Format. The following article will provide the format’s specifications, as well as examples of import files.

Quick Start

From the Label Set section of the Settings tab, create your project ontology (more information on how do do so here)

From the Assets tab, click on Import.

From the dialog that pops up, click on the Sample JSON toggle.

You will see a sample JSON pre-populated with a basic schema of the import file you need, including schema IDs and structure. You may use this sample as structure for your import JSON.

Read below for more information on how to complete the import file.

Common Properties

External ID

The external ID identifies assets in projects.

When importing assets through the browser, the external ID is assigned automatically, and is equal to the asset's filename. When importing using the Cloud Import function, administrators and project managers must assign this ID manually to each asset. More on importing assets to Ango Hub here.

The assets must be imported to Ango Hub before the annotations.

It is not currently possible to bulk upload both assets and annotations with a single import file.

The external ID of each asset can be viewed from the Assets tab of your project, under the External ID column.

External IDs do not have to be unique. You can have more than one asset with the same external ID.

It is possible to import annotations referencing assets with only their external IDs, as in many exampled below. In this situation, all assets sharing the same external ID will be pre-labeled.

Schema IDs

The Schema ID is a unique identifier for each labeling tool.

If you don't yet know the schema ID of the labeling tool you will use, instead of:

"schemaId": "my_schema_id"

you may use the tool's name (title) like so:

"title": "Name of My Tool"

This, however, is not recommended since Ango Hub will have to guess which tool you meant. If you have more than one tool with the same name, Ango Hub will pick one randomly.

To obtain each tool's schema ID, navigate to the Label Set section of the Settings. You will find it when expanding the details of each tool.

Create and save your project's label set before attempting to import labels.

Ensure the schema IDs in your import file match the ones in the Label Set section of your project's settings.

Nested classifications have their own, separate Schema IDs. They do not inherit the Schema ID of their parent class.

Object ID

By default, all objects (annotations) created on Ango Hub, either directly from the platform or by importing them, get assigned a random Object ID used to identify them uniquely.

You may, however, choose to assign a custom object ID to annotations you are importing. This is useful (and necessary) in a number of cases:

  • In video annotations, the object ID allows you to move and track the same annotation between frames.

  • In single and group relations, the Object ID is necessary to relate annotations to one another.

Assigning an object ID manually means that Ango Hub will not create one for the object in question.

Ango Hub will not check nor warn you if you import multiple, different annotations with the same object ID in the same asset or, in the case of videos, in the same frame.

Using the same object ID on more than one object in the same frame can cause unexpected behavior, and may break functionality such as relations.

Unless this is by design, such as tracking an annotation between video frames, always ensure your object IDs are unique to prevent unexpected behaviors.

To add an object ID to any object you are importing, simply add the following line to your object:

"objectId": "<YOUR_OBJECT_ID>"

For example, a PDF area object with a custom object ID would look like this:

{
  "title": "box2",
  "bounding-box": {
    "height": 1200,
    "width": 800,
    "x1": 98.2109375,
    "y1": 253.6640625,
    "x2": 342.2109375,
    "y2": 567.6640625,
    "pageNumber": 2,
    "text": "Second Text",
    "objectId": "1234567890"
  }
}

You can add custom Object IDs to all annotation types.

Lock

You can lock certain annotations so that annotators cannot edit them. To do so, simply add "lock":true as a property to an object. For example:

[
    {
        "externalId": "test.jpg",
        "objects": [
            {
                "schemaId": "1627287783027",
                "bounding-box": {
                    "x": 270.2113309352518,
                    "y": 238.84892086330933,
                    "width": 107.91366906474819,
                    "height": 122.3021582733813
                },
                "lock": true
            }
        ]
    }
]

Lock is available for all annotation types, including classifications, except relations. We plan on supporting locking relations soon.


Tools

Bounding Box

x and y refer to the coordinates of the bounding box's top-left corner.

[
    {
        "externalId": "example.png",
        "objects": [
            {
                "schemaId": "09f90db83b842d7bf0c2225",
                "bounding-box": {
                    "x": 192,
                    "y": 166,
                    "width": 66,
                    "height": 61
                }
            },
            {
                "schemaId": "09f90db83b842d7bf0c2225",
                "bounding-box": {
                    "x": 56,
                    "y": 56,
                    "width": 67,
                    "height": 44
                }
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Car",
      "tool": "bounding-box",
      "required": false,
      "schemaId": "09f90db83b842d7bf0c2225",
      "ocrEnabled": false,
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

You may include OCR information such that, when imported, if in the category schema the "Targeted OCR" toggle was enabled for the bounding box tool:

then you may add the "ocr" field to the bounding box to import, as pre-labels, the OCR contents. Here is an example JSON with the OCR field:

[
  {
    "data": "cute-dog.jpg",
    "objects": [
      {
        "schemaId": "1e3e0890979c5afb23a1857",
        "title": "BBox",
        "bounding-box": {
          "width": 120.005,
          "height": 135.345,
          "x": 50.3,
          "y": 30.4
        },
        "ocr": {
          "text": "This is the OCR text imported in."
        }
      }
    ]
  },
  {
    "data": "cute-cat.jpg",
    "objects": [
      {
        "schemaId": "1e3e0890979c5afb23a1857",
        "title": "Bbox",
        "bounding-box": {
          "width": 120.005,
          "height": 135.345,
          "x": 50.3,
          "y": 30.4
        },
        "ocr": {
          "text": "This is the OCR text imported in."
        }
      }
    ]
  }
]

And this is what it will look like to annotators once they first open the asset and right-click on one of the pre-labeled bounding boxes:

Rotated Bounding Box

[
  {
    "externalId": "example.png",
    "objects": [
      {
        "schemaId": "678717a10e50d6563edf230",
        "title": "Bottom",
        "rotated-bounding-box": {
          "width": 100,
          "height": 100,
          "x": 200,
          "y": 200,
          "rotation": 45
        }
      },
      {
        "schemaId": "c9d96c7f6b863df8dc88790",
        "title": "Right",
        "rotated-bounding-box": {
          "width": 100,
          "height": 100,
          "x": 200,
          "y": 200,
          "rotation": -45
        }
      },
      {
        "schemaId": "205ae9eb900f7ca929dd497",
        "title": "Top",
        "rotated-bounding-box": {
          "width": 100,
          "height": 100,
          "x": 200,
          "y": 200,
          "rotation": -135
        }
      },
      {
        "schemaId": "23921c9aa563f1257253471",
        "title": "Left",
        "rotated-bounding-box": {
          "width": 100,
          "height": 100,
          "x": 200,
          "y": 200,
          "rotation": 135
        }
      }
    ]
  }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Top",
      "tool": "rotated-bounding-box",
      "required": false,
      "schemaId": "205ae9eb900f7ca929dd497",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    },
    {
      "title": "Left",
      "tool": "rotated-bounding-box",
      "required": false,
      "schemaId": "23921c9aa563f1257253471",
      "classifications": [],
      "multiple": false,
      "color": "#03a9f4",
      "shortcutKey": "2"
    },
    {
      "title": "Bottom",
      "tool": "rotated-bounding-box",
      "required": false,
      "schemaId": "678717a10e50d6563edf230",
      "classifications": [],
      "multiple": false,
      "color": "#9c27b0",
      "shortcutKey": "3"
    },
    {
      "title": "Right",
      "tool": "rotated-bounding-box",
      "required": false,
      "schemaId": "c9d96c7f6b863df8dc88790",
      "classifications": [],
      "multiple": false,
      "color": "#673ab7",
      "shortcutKey": "4"
    }
  ],
  "classifications": [],
  "relations": []
}

Rotated Bounding Box Angles

Polygon

[
    {
        "externalId": "example.png",
        "objects": [
            {
                "schemaId": "3db073f1a9deba207b65123",
                "polygon": [
                    [
                        118,
                        459
                    ],
                    [
                        299,
                        327
                    ],
                    [
                        479,
                        459
                    ],
                    [
                        411,
                        672
                    ],
                    [
                        187,
                        671
                    ]
                ]
            },
            {
                "schemaId": "3db073f1a9deba207b65123",
                "polygon": [
                    [
                        534,
                        345
                    ],
                    [
                        656,
                        678
                    ],
                    [
                        843,
                        675
                    ],
                    [
                        978,
                        234
                    ],
                    [
                        848,
                        345
                    ]
                ]
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Car",
      "tool": "polygon",
      "required": false,
      "schemaId": "3db073f1a9deba207b65123",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Polyline

[
    {
        "externalId": "example.png",
        "objects": [
            {
                "schemaId": "7e8475173033ca753606470",
                "polyline": [
                    [
                        128,
                        128
                    ],
                    [
                        128,
                        256
                    ],
                    [
                        256,
                        320
                    ]
                ]
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Line",
      "tool": "polyline",
      "required": false,
      "schemaId": "7e8475173033ca753606470",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Spline

[
  {
    "externalId": "image-png.png",
    "tools": [
      {
        "title": "Road Marking",
        "spline": [
          [
            298.1302490234375,
            561.50872802734375,
            3.28
          ],
          [
            306.56967163085938,
            575.17254638671875,
            3.2
          ],
          [
            315.8128662109375,
            588.43450927734375,
            6.16
          ]
        ]
      }
    ]
  }
]

The first value being the X distance in pixels from the left, the second the Y distance in pixels from the top, and the third the width of the spline at that point.

Segmentation

Segmentations are composed of instances, zones, regions, and holes.

An instance may contain more than one zone. One zone contains exactly one region. A region can contain more than one hole.

Each of the points composing the segmentation is represented as an X/Y coordinate pair. For more information on how X/Y pairs work in the Ango Annotation Format, check out this section. For the way Ango Hub exports segmentation labels, check out this page.

[
  {
    "externalId": "example.png",
    "objects": [
      {
        "schemaId": "2ff45d51337052241bcb680",
        "segmentation": {
          "zones": [
            {
              "region": [
                [
                  64,
                  64
                ],
                [
                  64,
                  156
                ],
                [
                  156,
                  156
                ],
                [
                  156,
                  64
                ]
              ],
              "holes": []
            },
            {
              "region": [
                [
                  64,
                  256
                ],
                [
                  64,
                  360
                ],
                [
                  256,
                  360
                ],
                [
                  320,
                  256
                ]
              ],
              "holes": [
                [
                  [
                    100,
                    270
                  ],
                  [
                    140,
                    270
                  ],
                  [
                    140,
                    320
                  ]
                ],
                [
                  [
                    200,
                    300
                  ],
                  [
                    240,
                    300
                  ],
                  [
                    240,
                    350
                  ],
                  [
                    200,
                    350
                  ]
                ]
              ]
            }
          ]
        }
      }
    ]
  }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Sample",
      "tool": "segmentation",
      "required": false,
      "schemaId": "2ff45d51337052241bcb680",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Entity

Audio Labeling

The start and end properties refer to the seconds elapsed since the start of the audio file.

[
    {
        "externalId": "example.mp3",
        "objects": [
            {
                "schemaId": "6ab93a0c0c3553e5b598887",
                "ner": {
                    "start": 2.18,
                    "end": 3.36
                }
            },
            {
                "schemaId": "6ab93a0c0c3553e5b598887",
                "ner": {
                    "start": 6.7,
                    "end": 8.1
                }
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Sample Entity",
      "tool": "ner",
      "required": false,
      "schemaId": "6ab93a0c0c3553e5b598887",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Text Labeling

The start and end properties refer to the character indices of the entity.

[
    {
        "externalId": "example.txt",
        "objects": [
            {
                "schemaId": "6ab93a0c0c3553e5b598887",
                "ner": {
                    "start": 6,
                    "end": 10
                }
            },
            {
                "schemaId": "6ab93a0c0c3553e5b598887",
                "ner": {
                    "start": 28,
                    "end": 38
                }
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Sample Entity",
      "tool": "ner",
      "required": false,
      "schemaId": "6ab93a0c0c3553e5b598887",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Point

[
    {
        "externalId": "example.png",
        "objects": [
            {
                "schemaId": "63f2ca2a1e5404f14f14039",
                "point": [
                    64,
                    64
                ]
            },
            {
                "schemaId": "63f2ca2a1e5404f14f14039",
                "point": [
                    256,
                    64
                ]
            },
            {
                "schemaId": "63f2ca2a1e5404f14f14039",
                "point": [
                    64,
                    256
                ]
            },
            {
                "schemaId": "63f2ca2a1e5404f14f14039",
                "point": [
                    256,
                    256
                ]
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Point",
      "tool": "point",
      "required": false,
      "schemaId": "63f2ca2a1e5404f14f14039",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

PDF

height and width refer to the dimensions of the relevant page of the pdf file.

[
    {
        "externalId": "example.pdf",
        "objects": [
            {
                "schemaId": "a95b7523d9d5e523aade085",
                "pdf": {
                    "height": 384,
                    "width": 384,
                    "x1": 64,
                    "y1": 64,
                    "x2": 128,
                    "y2": 128,
                    "pageNumber": 1,
                    "text": "sample text"

                }
            } 
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Paragraph",
      "tool": "pdf",
      "required": false,
      "schemaId": "a95b7523d9d5e523aade085",
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Brush

Brush

For how to import brush traces with the brush tool, refer to the following page.

Medical Brush

For how to import brush traces with the medical brush tool, refer to the following page.

Tools + Nested Classifications

Bounding Box / Radio

[
    {
        "externalId": "example.png",
        "objects": [
            {
                "schemaId": "c72440f85fecbd439bca284",
                "bounding-box": {
                    "x": 192,
                    "y": 166,
                    "width": 66,
                    "height": 61
                },
                "classifications": [
                    {
                        "schemaId": "a7800ce15dcae82c8d51463",
                        "answer": "Black"
                    }
                ]

            },
            {
                "schemaId": "c72440f85fecbd439bca284",
                "bounding-box": {
                    "x": 56,
                    "y": 56,
                    "width": 67,
                    "height": 44
                },
                "classifications": [
                    {
                        "schemaId": "a7800ce15dcae82c8d51463",
                        "answer": "Yellow"
                    }
                ]
            }
        ]
    }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Car",
      "tool": "bounding-box",
      "required": false,
      "schemaId": "c72440f85fecbd439bca284",
      "ocrEnabled": false,
      "classifications": [
        {
          "title": "Color",
          "tool": "radio",
          "required": false,
          "schemaId": "a7800ce15dcae82c8d51463",
          "frameSpecific": false,
          "classifications": [],
          "multiple": false,
          "options": [
            {
              "value": "Red",
              "schemaId": "752a2fcac3678fe2ce55143"
            },
            {
              "value": "White",
              "schemaId": "3c1f49512c9ce13d3b9c051"
            },
            {
              "value": "Black",
              "schemaId": "850cd2aa1a984d2e0759492"
            },
            {
              "value": "Blue",
              "schemaId": "027e53efb4f96329a0d2278"
            },
            {
              "value": "Green",
              "schemaId": "ae4281fc4ebf50e9bf2f625"
            },
            {
              "value": "Yellow",
              "schemaId": "6d5e4052b7a54c23c20e163"
            }
          ]
        }
      ],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Video and Multi-Image Labeling

All annotations on DICOM files, regardless of whether the DICOMs are single- or multi-frame, need the page property.

For single-frame DICOM annotations, the page property needs to be equal to 0. For example:

bbox_obj = {
  "schemaId": schema_id,
  "page": 0,
  "bounding-box": {
    "x": x,
    "y": y,
    "width": w,
    "height": h
  }
}

Video Labeling

Video labeling is functionally the same as image labeling, with the only difference being that we add an extra page property to indicate the frame to which the annotation belongs.

Additionally, you may add an "interpolationStopped": true object as shown below to make an annotation disappear from the asset at a specific frame. You may then make it reappear by indicating the same objectId and using "interpolationStopped": false.

"interpolationStopped" field is necessary to stop the linear interpolation of the bounding boxes across the video.

[
  {
    "externalId": "example.mp4",
    "objects": [
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 5,
        "objectId": "12345",
        "bounding-box": {
          "x": 100,
          "y": 166,
          "width": 66,
          "height": 61
        }
      },
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 20,
        "objectId": "12345",
        "bounding-box": {
          "x": 200,
          "y": 266,
          "width": 66,
          "height": 61
        }
      },
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 35,
        "objectId": "12345",
        "bounding-box": {
          "x": 300,
          "y": 166,
          "width": 66,
          "height": 61
        }
      },
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 36,
        "objectId": "12345",
        "interpolationStopped": true
      },
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 50,
        "objectId": "12345",
        "interpolationStopped": false
      }
    ]
  }
]
Sample Category Schema
{
  "tools": [
    {
      "title": "Car",
      "tool": "bounding-box",
      "required": false,
      "schemaId": "09f90db83b842d7bf0c2225",
      "ocrEnabled": false,
      "classifications": [],
      "multiple": false,
      "color": "#f44336",
      "shortcutKey": "1"
    }
  ],
  "classifications": [],
  "relations": []
}

Multi-Image Labeling

Importing annotations for multi-image assets is functionally the same as importing video annotations, with each "image" being a page. Pages start from 0.

[
  {
    "externalId": "example.tiff",
    "objects": [
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 6,
        "bounding-box": {
          "x": 192,
          "y": 166,
          "width": 66,
          "height": 61
        }
      },
      {
        "schemaId": "09f90db83b842d7bf0c2225",
        "page": 7,
        "bounding-box": {
          "x": 192,
          "y": 166,
          "width": 66,
          "height": 61