Open In Colab Open a Colab to go through the exercise of importing text annotations.

Supported annotations

To import annotations in Labelbox, you need to create the annotations payload. In this section, we provide this payload for every annotation type.

Labelbox support two formats for the annotations payload: Python Annotation types (recommended) and NDJSON. Both are described below.

Entity

named_entity = TextEntity(start=10, end=20)
named_entitity_annotation = ObjectAnnotation(value=named_entity, name = "named_entity")

entities_ndjson = { 
    "name": "named_entity",
    "location": { 
        "start": 67, 
        "end": 128 
    }
}

Classification - Radio

// Single radio classification
radio_annotation = ClassificationAnnotation(
    name="radio_question",
    value=Radio(answer = 
        ClassificationAnswer(name = "first_radio_answer")
    )
)


// Nested radio classifications

radio_annotation_nested = ClassificationAnnotation(
    name="radio_question_sub", 
    value=Radio(answer = ClassificationAnswer(name = "first_radio_answer")),
    classifications=[
        ClassificationAnnotation(
            name="sub_radio_question",
            value=Radio(answer=ClassificationAnswer(name="first_sub_radio_answer"))
      )
    ]
)
// Single radio classification 
radio_annotation_ndjson = {
  'name': 'radio_question',
  'answer': {'name': 'first_radio_answer'}
} 


// Nested radio classifications
radio_annotation_ndjson_with_subclass = {
  'name': 'radio_question_sub',
  'answer': {
      'name': 'first_radio_answer',
      'classifications': [{
          'name':'sub_radio_question',
          'answer': { 'name' : 'first_sub_radio_answer'}
        }]
    }
}

Classification - Checklist (Multi-choice)

checklist_annotation = ClassificationAnnotation(
    name="checklist_question",
    value=Checklist(answer = [
        ClassificationAnswer(name = "first_checklist_answer"),
        ClassificationAnswer(name = "second_checklist_answer"),
        ClassificationAnswer(name = "third_checklist_answer")
    ])
  )
checklist_annotation_ndjson = {
  'name': 'checklist_question',
  'answer': [
    {'name': 'first_checklist_answer'},
    {'name': 'second_checklist_answer'},
    {'name': 'third_checklist_answer'},
  ]
}

Classification - Free-form text

text_annotation = ClassificationAnnotation(
    name = "free_text", 
    value = Text(answer="sample text")
)

text_annotation_ndjson = {
  'name': 'free_text',
  'answer': 'sample text',
}

Segmentation mask

Not supported

Polygon

Not supported

Bounding Box

Not supported

Polyline

Not supported

Point

Not supported