Annotations

Annotation file format

You can upload annotations with the JSON structure in the SuperAnnotate annotation format. The annotation files should have the following naming conventions:

Project type

Annotation file naming convention

Image (Legacy)

<item_name>.json
<item_name>___save.png

Image

<item_name>.json

Text

<document_name>.json

Video

<video_name>.json

❗️

When you upload annotations, make sure that their corresponding items are available in the project. If they aren’t, then the annotations won’t be uploaded.

Learn more about annotation formats.

đźš§

The annotations you upload override the existing annotations.

Upload annotations from memory

To upload annotations from memory, create an annotation object and pass it to the function:

my_annotations = [
    {
        "metadata": {
            "name": "image1.png"
        },
        "instances": [
            {
                "type": "tag",
                "className": "Dog"
            }
        ]
    }
]

sa.upload_annotations(
    project = "Project Name",
    annotations = my_annotations)

Upload annotations from local storage

To upload annotations from a local directory:

sa.upload_annotations_from_folder_to_project(
    project = "Project Name",
    folder_path = "./data/annotations")

To enable recursive subfolder upload (when annotations are stored within multiple subfolders) set recursive_subfolders to true:

sa.upload_annotations_from_folder_to_project(
    project = "Project Name",
    folder_path = "./data/annotations", 
    recursive_subfolders = True)
đźš§

When you upload annotations, the status of an image will change to inProgress.

Upload annotations from a cloud storage

AWS S3 Bucket

To upload annotations from a AWS S3 bucket:

sa.upload_annotations_from_folder_to_project(
    project = "Project Name",
    folder_path = "./data/annotations",
    s3_bucket_name = "Bucket Name")
đźš§

  • When you upload annotations, the status of an image will change to inProgress.

Identify invalid annotations

When you want to upload annotations from a folder, the function will identify the invalid annotations and show you a warning message that contains the number of invalid annotations.

The function will also put the paths of invalid annotations to the return tuple of (uploaded, could-not-upload, missing-images), in the could-not-upload list accordingly.

Use the function below to fetch the possible reason(s) for why an annotation is invalid.

superannotate.validate_annotations(
     project_type = “Video”, 
     annotations_json = “./<video_name.json>”)