Pixel Project - Import annotation format

To import annotations to a Pixel Project, you need to import:

Annotations JSON format

The JSON of annotations in a Pixel Project contains four main parts: metadata, comments, tags, and instances.

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

🚧

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

Metadata

{
    "lastAction": {
      "email": "[email protected]",
      "timestamp": 1610614861660
    },
    "width": 1920,
    "height": 1280,
    "name": "image1.jpg",
    "projectId": 8806,
    "isSegmented": true,
    "isPredicted": false,
    "qaEmail": [email protected],
    "annotatorEmail": [email protected],
    "status": "InProgress",
    "pinned": false,
    "projectId": 1345
}

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”: integer - 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.
  • "isSegmented": boolean - If it’s true, then Smart Segmentation was run on the image. If it’s false, then Smart Segmentation wasn't run on the image.
  • "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.
  • "projectId": integer - The project's ID.

📘

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”: 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 Preannotation, then the comment was imported with Python SDK.
  • “updatedAt”: string - The time the comment was updated.
  • “updatedBy”: 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

[
    "Road",
    "Car"
  ]

Description:

  • “Road”: string - The tag name.

Instances

[{
      "className": "Car",
      "probability": 100,
      "visible": true,
      "attributes": [
        {
          "id": 275033,
          "groupId": 66874,
          "name":"Taxi",
          "groupName":"Type"
        }
      ],
      "parts": [
        {
          "color": "#00013b"
        }
      ],
      "error": null,
      "locked": false,
      "createdAt": "2021-01-14T07:33:51.370Z",
      "createdBy": {
        "email": "[email protected]",
        "role": "Annotator"
      },
      "creationType": "Manual",
      "updatedAt": "2021-01-14T10:21:08.010Z",
      "updatedBy": {
        "email": "[email protected]",
        "role": "QA"
      }
}]

Description:

  • “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.
  • “visible”: boolean - If it’s true, you’ll be able to see the annotations on the canvas.
  • “attributes”: array of objects - List of attributes for this instance.
    • “id”: integer - Attribute ID (must be in “classes.json”)
    • “groupId”: integer - Group ID (must be in “classes.json”)
    • "name": string - Attribute name
    • "groupName": string - Group name
  • "parts": array of objects - The colors of the instance's segment in the mask PNG file.
    • "color": string - HEX color code of the instance
  • “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.
  • "createdAt": string - The time the instance was created.
  • "createdBy": objects - The user who created the instance.
    • "email": string -The email address of the user who created the instance.
    • "role": string - The role of the user who created the instance.
  • "creationType": string - The method that was used to create the instance. If it's manual, then the user created the instance in the editor. If it's prediction, then the instance was created using Smart Prediction. If it's pre-annotation, then the instance was uploaded with Python SDK.
  • "updatedAt": string - The time the instance was updated.
  • "updatedBy": objects - The user who updated the instance.
    • "email": string - The email address of the user who updated the instance.
    • "role": string - The role of the user who updated the instance.

📘

Mandatory fields

  • If the objects createdBy and updatedBy exist, then email and role are mandatory.
  • If the array attributes exists, it can be either empty or it can contain objects with the following fields: name and groupName.
  • If the array parts exists, it can be either empty or it can contain objects with the following fields: color.

Annotation masks

An annotation mask is a PNG file that contains one instance or multiple instances. The instances will be colored while the areas that aren't annotated will have all four channels (R,G,B,A) set to zero.

12001200

Instances in the Pixel Editor / Instances in the annotation mask