Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Learn how to work with pre-annotations by acquiring a fundamental understanding of project configuration. The subsequent example demonstrates the process of uploading pre-annotations for image annotation. This procedure remains consistent across all project types. Sample files, JSON structures , and custom code are provided for each project type.

...

  1. Once the rest of the project configuration is done, go to Advanced > Project Task > Custom code > On load. Add the following code, click on SAVE.

...

  1. Create an input file containing two fields MediaURL and JsonData . The field JsonData should have the JSON data containing our pre-annotations. The JSON structure is as follows. Import it as a dataset.

Code Block
[
  {
    "id": "e1c6b909-5533-4207-b3dd-7c58deb25620",
    "label": [
      "Eyes"
    ],
    "shape": "rectangle",
    "points": [  //Co-ordinates for bounding box points X1Y1,X1Y2,X2Y2,X2Y1
      [
        0.5665601469237833,
        0.44077134986225897
      ],
      [
        0.6820606060606061,
        0.44077134986225897
      ],
      [
        0.6820606060606061,
        0.54178145087236
      ],
      [
        0.5665601469237833,
        0.54178145087236
      ]
    ],
    "notes": "",
    "attributes": {
      "Colour": [
        "Hazel"
      ]
    },
    "imageWidth": 1000,
    "imageHeight": 662
  },
  {
    "id": "a1e40daf-5beb-434b-ac13-62edaff3e132",
    "label": [
      "Nose"
    ],
    "shape": "rectangle",
    "points": [
      [
        0.45957024793388435,
        0.5252525252525253
      ],
      [
        0.5957392102846649,
        0.5252525252525253
      ],
      [
        0.5957392102846649,
        0.6685032139577594
      ],
      [
        0.45957024793388435,
        0.6685032139577594
      ]
    ],
    "notes": "",
    "attributes": {      
    },
    "imageWidth": 1000,
    "imageHeight": 662
  }  
]

...

Code Block
{
  "version": 2,
  "annotations": {
    "entities": [
      {
        "uuid": "51789a7a-5b5e-4763-8366-53f5ab640fb2",
        "start_offset": 0,
        "end": 10,
        "entity_pos": "",
        "text": "Dostoevsky",
        "attributes": {
          
        },
        "taskId": "6870299",
        "entity_type": "Author",
        "relations": [
          {
            "relation": "Writer",
            "end": "1f0e2476-e838-46a7-82a1-3adf2e143d40",
            "uuid": "3baa759a-1aed-4523-ad61-1c8e6a629458",
            "parentEntity": "Author",
            "childEntity": "Novel",
            "relStartText": "Dostoevsky",
            "relEndText": "Poor Folk"
          }
        ]
      },
      {
        "uuid": "105b637d-28c2-49a0-b15c-a152d7b0a58e",
        "start_offset": 21,
        "end": 24,
        "entity_pos": "",
        "text": "his",
        "attributes": {
          
        },
        "taskId": "6870299",
        "entity_type": "Pronoun"
      }      
    ]
  }
}

  1. For Segmentation pre-annotation in Segmentation, use the same custom code as Image used for image annotation.

JSON structure :

...