Vector Project - Import annotation format

To import annotations to a Vector Project, you need to import a JSON file of the annotations.

The explanation will be based on the following example:

19661966

The annotations JSON in a Vector Project contains four main fields: metadata, instances, tags, and comments.

{
    "metadata": {},
    "instances": [],
    "tags": [],
    "comments": []
}

🚧

The fields that are marked in bold in the descriptions are mandatory.

Metadata

{
    "lastAction": {
      "email": "[email protected]",
      "timestamp": 1610622159937
    },
    "width": 1920,
    "height": 1080,
    "name": "94573794",
    "projectId": 9425,
    "isPredicted": false,
    "qaEmail": [email protected],
    "annotatorEmail": [email protected],
    "status": "Returned",
    "pinned": false
}

Description:

  • “lastAction”: The user who last edited the image. Edits include changing the class of an instance, adding or deleting attributes, adding point labels, approving or disapproving instances, and moving or scaling instances.
    • “email”: string - The email address of the last user who added or edited an instance.
    • “timestamp”: number - The date and time when the last instance edit was made.
  • "width": integer - The image’s width.
  • "height": integer - The image’s height.
  • "name": string - The name of the image.
  • "projectId": integer - The project ID.
  • "isPredicted": boolean - If it’s true, then Smart Prediction was run on the image. If it’s false, then Smart Prediction wasn't run on the image.
  • "qaEmail": string - The QA’s email address.
  • "annotatorEmail": string - The annotator's email address.
  • "status": string - The image status. It can be: NotStarted, InProgress, QualityCheck, Returned, Skipped, or Completed.
  • "pinned": boolean - If it’s true, then the image is pinned. If it’s false, then the image isn’t pinned.

📘

Mandatory fields

  • The object name is mandatory.
  • If the object lastAction exists, then the email and timestamp are mandatory.

Comments

[{
      "correspondence": [
        {
          "text": "Fix this",
          "email": "[email protected]"
        }
      ],
      "x": 987.98,
      "y": 722.87,
      "resolved": false,
      "createdAt": "2021-01-14T07:34:00.695Z",
      "createdBy": {
        "email": "[email protected]",
        "role": "Admin"
      },
      "creationType": "Manual",
      "updatedAt": "2021-01-14T07:34:04.783Z",
      "updatedBy": {
        "email": "[email protected]",
        "role": "Admin"
      }
}]

Description:

  • "correspondence": array of objects - List of messages in the comment.
    • "text": string - The comment.
    • "email": string - The email address of the user who wrote the comment.
  • “x”: number - X position of the comment on the image.
  • “y”: number - Y position of the comment on the image.
  • “resolved”: boolean - If it’s true, then the comment is resolved. If it’s false, then the comment isn't resolved.
  • “createdAt”: string - The date and time when the comment was created.
  • “createdBy”: objects - Information about the user who created the comment.
    • “email”: string - The email of the user who created the comment.
    • “role”: string - The role of the user who created the comment.
  • “creationtype”: string - If it’s manual, then the comment was created manually. If it’s pre-annotation, then the comment was imported with Python SDK.
  • “updatedAt”: string - The time the comment was updated.
  • “updatedBy”: objects - Information about the user who last updated the comment.
    • “email”: string - The email address of the user who last updated the comment.
    • “role”: string - The role of the user who last updated the comment.

📘

Mandatory fields

  • The array correspondence and its objects are mandatory.
  • If the array comment exists, it can be either empty or it can contain objects with the following fields: correspondence, x, and y.
  • If the objects createdBy and updatedBy exist, then email and role are mandatory.

Tags

[
    "Shapes",
    "Vector"
  ]

Description:

  • "Shapes": string - The tag name.

Instances

Tag

{
      "name": "Dog",
      "color": "#4e7b3a",
      "type": "tag",
      "attribute_groups": [
        {
          "name": "Position",
          "is_multiselect": 0,
          "attributes": [
            {
              "name": "Labrador"
            }
          ]
        }
      ]
    }
  • "name": string - Class Name
  • "color": string - Class’s hex color code (e.g. #000000)
  • "type": string - Class type. It could either be object or tag.
  • "attribute_groups": array of objects - List of all the attributes
    • "name": string - Attribute Name

Polyline and polygon

{
      "type": "polygon",
      "className":"pentagon",
      "probability": 100,
      "points": [
                322.18,
                249.03,
                585.14,
                261.22,
                377.9,
                449.31,
                243.81,
                410.99
       ],
      "groupId": 0,
      "pointLabels": {},
      "attributes": [
        {
          "name":"Green",
          "groupName":"Color"
        }
      ],
      "error": null,
      "locked": false
}

Description:

  • “type” : string - Instance type.
  • "className": string - Class name (one of the class names in “classes.json”)
  • “probability”: integer - Instance prediction score. If the instance was created manually, then the probability value is 100.
  • “points”: array of objects - Points of the polygon. The list of floats is: [x0, y0, x1, y1, ….. xN, yN].
  • “groupId”: integer - Group ID of instances
  • “pointLabels”: string - The keys are from “0” to “N-1” where a polygon has N vertices.
  • “attributes”: array of objects - List of attributes for this polygon.
    • "name": string - Attribute name
    • "groupName": string - Group name
  • “error”: boolean - If the instance is approved, then it’s false. If it’s disapproved, then it’s true. If you approve or disapprove an instance then undo the action, then it’s null. If the instance is neither approved nor disapproved, then error won’t appear in JSON.
  • “locked”: boolean - If it’s true, you won't be able to move the instance. If it’s false, you'll be able to move the instance.

Bounding box and rotated bounding box

{
      "type": "bbox",
      "className": "Square",
      "probability": 100,
      "points": {
        "x1": 104.73,
        "x2": 549.82,
        "y1": 137.45,
        "y2": 377.45
      },
      "groupId": 0,
      "pointLabels": {},
      "attributes": [
        {
          "name":"Purple",
          "groupName":"Color"
        }
      ],
      "error": null,
      "locked": false
    }

Description:

  • “type”: string - Instance type.
  • "className": string - Class name (one of the class names in “classes.json”)
  • “probability”: integer - Instance prediction score. If the instance was created manually, then the probability value is 100.
  • “points”: objects - Points of the bounding box. The list of floats is: "x1, y1" for the left upper corner, and "x2, y2" for the right lower corner.
  • “groupId”: integer - Group ID of instances
  • “pointLabels”: objects - The keys are from “0” to “7” for the 8 vertices of the bounding box.
  • “attributes”: array of objects - List of attributes for this bounding box.
    • "name": string - Attribute name
    • "groupName": string - Group name
  • “error”: boolean - If the instance is approved, then it’s false. If it’s disapproved, then it’s true. If you approve or disapprove an instance then undo the action, then it’s null. If the instance is neither approved nor disapproved, then error won’t appear in JSON.
  • “locked”: boolean - If it’s true, you won't be able to move the instance. If it’s false, you'll be able to move the instance.

Point

{
      "type": "point",
      "className": "Point",
      "probability": 100,
      "x": 1769.45,
      "y": 425.45,
      "groupId": 0,
      "pointLabels": {},
      "attributes": [
        {
          "name": "Blue",
          "groupName": "Color"
        }
      ],
      "error": null,
      "locked": false
}

Description:

  • “type”: string - Instance type.
  • "className": string - Class name (one of the class names in “classes.json”)
  • “probability”: integer - Instance prediction score. If the instance was created manually, then the probability value is 100.
  • “x”: number - x-coordinate
  • “y”: number - y-coordinate
  • “groupId”: integer - Group ID of instances
  • “pointLabels”: objects - The key is "0".
  • “attributes”: array of objects - List of attributes for this polygon.
    • "name": string - Attribute name
    • "groupName": string - Group name
  • “error”: boolean - If the instance is approved, then it’s false. If it’s disapproved, then it’s true. If you approve or disapprove an instance then undo the action, then it’s null. If the instance is neither approved nor disapproved, then error won’t appear in JSON.
  • “locked”: boolean - If it’s true, you won't be able to move the instance. If it’s false, you'll be able to move the instance.

Ellipse

{
      "type": "ellipse",
      "className": "Ellipse",
      "probability": 100,
      "cx": 377.46,
      "cy": 806.18,
      "rx": 316.36,
      "ry": 134.18,
      "angle": 0,
      "groupId": 0,
      "pointLabels": {},
      "attributes": [
        {
          "name": "Red",
          "groupName": "Color"
        }
      ],
      "error": null,
      "locked": false
    }

Description:

  • “type”: string - Instance type.
  • "className": string - Class name (one of the class names in “classes.json”)
  • “probability”: integer - Instance prediction score. If the instance was created manually, then the probability value is 100.
  • “cx”: number - x-coordinate of the center
  • “cy”: number - y-coordinate of the center
  • “rx”: number - x radius
  • “ry”: number - y radius
  • "angle”: integer - rotation angle
  • “groupId”: integer - Group ID of instances
  • “pointLabels”: objects - The keys are numbers that range from "0" to "8", and the values are texts.
  • “attributes”: array of objects - List of attributes for this polygon.
    • "name": string - Attribute name
    • "groupName": string - Group name
  • “error”: boolean - If the instance is approved, then it’s false. If it’s disapproved, then it’s true. If you approve or disapprove an instance then undo the action, then it’s null. If the instance is neither approved nor disapproved, then error won’t appear in JSON.
  • “locked”: boolean - If it’s true, you won't be able to move the instance. If it’s false, you'll be able to move the instance.

Cuboid

{
      "type": "cuboid",
      "className":"Cuboid",
      "probability": 100,
      "points": {
        "f1": {
          "x": 835.63,
          "y": 545.46
        },
        "f2": {
          "x": 1232.72,
          "y": 846.55
        },
        "r1": {
          "x": 1082.18,
          "y": 735.27
        },
        "r2": {
          "x": 1474.91,
          "y": 1042.91
        }
      },
      "groupId": 0,
      "pointLabels": {},
      "attributes": [
        {
          "name":"Green",
          "groupName":"Color"
        }
      ],
      "error": null,
      "locked": false
}

Description:

  • “type”: string - Instance type.
  • "className": string - Class name (one of the class names in “classes.json”)
  • “probability”: integer - Instance prediction score. If the instance was created manually, then the probability value is 100.
  • “points”: objects - “f1” and “f2” are front box points with “x” and “y” coordinates, and “r1” and “r2” are rear box points with “x” and “y” coordinates.
  • “groupId”: integer - Group ID of instances
  • “pointLabels”: objects - The keys are numbers that range from "0" to "8", and the values are texts.
  • “attributes”: array of objects - List of attributes for this cuboid.
    • "name": string - Attribute name
    • "groupName": string - Group name
  • “error”: boolean - If the instance is approved, then it’s false. If it’s disapproved, then it’s true. If you approve or disapprove an instance then undo the action, then it’s null. If the instance is neither approved nor disapproved, then error won’t appear in JSON.
  • “locked”: boolean - If it’s true, you won't be able to move the instance. If it’s false, you'll be able to move the instance.