Annotations

Get annotations into memory

To get image annotations into the memory:

annotations = sa.get_annotations(
    project = "Project Name", 
    image_name = "image_name.png")

🚧

This works for Pixel Projects and Vector Projects only.

This will return a Python dictionary with a annotation_json key with the value of the annotations in the SuperAnnotate format.

import json
print(json.dumps(annotations["annotation_json"], indent = 4, sort_keys = True))

This is the output:

{
    "instances": [
        {
            "attributes": [],
            "classId": 816825,
            "className": "apple",
            "createdAt": "2021-06-09T11:24:54.794Z",
            "createdBy": {
                "email": "[email protected]",
                "role": "Annotator"
            },
            "creationType": "Manual",
            "error": null,
            "groupId": 0,
            "locked": false,
            "pointLabels": {},
            "points": {
                "x1": 126.35,
                "x2": 384.42,
                "y1": 748.26,
                "y2": 921.96
            },
            "probability": 100,
            "trackingId": null,
            "type": "bbox",
            "updatedAt": "2021-07-27T14:21:52.904Z",
            "updatedBy": {
                "email": "[email protected]",
                "role": "QA"
            },
            "visible": true
        }
    ],
    "metadata": {
        "height": 1024,
        "width": 1024,
        "name": "fruit.png",  
        "lastAction": {
            "email": "[email protected]",
            "timestamp": 1627395705911
        }
    },
    "tags": [],
    "comments": []
}

Download annotations

To download image annotations:

sa.download_image_annotations(
    project = "Project Name",
    image_name = "image_name.png",
    local_dir_path = "./annotations")

🚧

Use the prepare_export functionality to download images or annotations in bulk. Learn more here.


Did this page help you?