import_labels

imerit_ango.sdk.SDK.

import_labels(project_id, labels)

Import labels to the project. More details on importing existing labels to Hub here.

You can only import annotations for tasks in the Start stage.

Please ensure the assets you are trying to annotate as in the Start stage of your project before continuing.

Parameters

  • project_id: string

  • labels: List[dict]

    • List of labels to import. See more on our label format here: Ango Annotation Format and learn more about importing labels into Ango Hub here.

Example
[
  {
    "externalId": "Test Pattern 844x844.png",
    "objects": [
      {
        "schemaId": "8f60cb0209a4d80f9add122",
        "title": "bbb",
        "bounding-box": {
          "width": 86,
          "height": 86,
          "x": 83,
          "y": 83
        }
      },
      {
        "schemaId": "8f60cb0209a4d80f9add122",
        "title": "bbb",
        "bounding-box": {
          "width": 167,
          "height": 167,
          "x": 338,
          "y": 338
        }
      },
      {
        "schemaId": "8f60cb0209a4d80f9add122",
        "title": "bbb",
        "bounding-box": {
          "width": 84,
          "height": 84,
          "x": 675,
          "y": 675
        }
      }
    ]
  }
]

Returns:

  • output: dict

Example

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

schema_id = '<Schema ID of Car Class>'
annotations = [{"externalId": "10001.png",
                "objects": [{"schemaId": schema_id,
                             "title": 'Car',
                             "bounding-box": {"x": 20, "y": 30, "width": 50, "height": 60}}]
               }]

ango_sdk.import_labels(project_id, annotations)

Last updated