Text classification (free-form string)

Free-form classifications can be applied at the global level and can be nested within an object-type annotation.

Import

Python SDK

Text is a type of ClassificationAnnotation.

Definition

Text(answer="sample text")

ParameterValue
answerText string

Supported data types

Data typeSupported
Images, Text, HTML, DICOM, Tiled, and Document- Yes for global classifications

- Partially yes for nested classifications
VideoNo

🚧

Nested classifications with annotation types

In order to import a nested classification with annotation types, the following conditions must be met:

  • Must be nested under an ObjectAnnotation
  • Root ObjectAnnotation type must be supported on the respective data type

Importing nested classifications within classifications is currently not supported in the Python SDK. Use NDJSON format instead.

text_annotation = ClassificationAnnotation(value=Text(answer="sample text"), name="text")
bbox_with_free_text_subclass = ObjectAnnotation(
    name="bounding_box_class_name",
    value=Rectangle(
        start=Point(x=0, y=0), # Top left
        end=Point(x=10, y=10), # Bottom right
    ),
    classifications=[
      	ClassificationAnnotation(
        	name="free_text_class_name",
        	value=Text(answer="sample text")
    	)
    ]
)

NDJSON

NDJSON format is recommended if an annotation type is not yet supported in Python SDK or if you are unable to use the Python environment.

Definition

ParameterAsset typeRequiredDescription
uuidImage
Text
Audio
Document
Tiled imagery
YesA user-generated UUID for each annotation. If you import an annotation to a Data Row and there is already an imported annotation with the same uuid on that Data Row, the latest import will override the previous one. The uuid must be 128 bits (32 characters). The following formats are supported:

- A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11

- {a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}

- a0eebc999c0b4ef8bb6d6bb9bd380a11

- a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11

- {a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}
schemaIdImage
Text
Audio
Document
Tiled imagery
YesThe ID of the schema that contains all of the information needed for rendering your annotation.
dataRow.idImage
Text
Audio
Document
Tiled imagery
YesThe ID of the Data Row where you want to attach the imported annotations.
answerImage
Text
Audio
Document
Tiled imagery
YesCorrect answer for the free-form text classification.

Supported data types

Data typeSupported
Images, Text, HTML, DICOM, Tiled and DocumentYes
VideoNo

Format

{
    "uuid": "4f1fe322-7b80-49a1-81cb-5914404df378",
    "dataRow": {
        "id": "ckd1299m8cqck0cq42lsz5khc"
    },
    "schemaId": "ckd1295hg006c0z0u6x41hx0d",
    "answer": "<correct_text_answer>"
}
{
    "uuid": "4f1fe322-7b80-49a1-81cb-5914404df378",
    "dataRow": {
        "id": "ckd1299m8cqck0cq42lsz5khc"
    },
    "schemaId": "ckd1295hg006c0z0u6x41hx0d",
    "answer": "<correct_text_answer>"
}
{
    "uuid": "4f1fe322-7b80-49a1-81cb-5914404df378",
    "dataRow": {
        "id": "ckd1299m8cqck0cq42lsz5khc"
    },
    "schemaId": "ckd1295hg006c0z0u6x41hx0d",
    "answer": "<correct_text_answer>"
}
{
    "uuid": "4f1fe322-7b80-49a1-81cb-5914404df378",
    "dataRow": {
        "id": "ckd1299m8cqck0cq42lsz5khc"
    },
    "schemaId": "ckd1295hg006c0z0u6x41hx0d",
    "answer": "<correct_text_answer>"
}
{
    "uuid": "4f1fe322-7b80-49a1-81cb-5914404df378",
    "dataRow": {
        "id": "ckd1299m8cqck0cq42lsz5khc"
    },
    "schemaId": "ckd1295hg006c0z0u6x41hx0d",
    "answer": "<correct_text_answer>"
}

Export

When you export your Free-form text classifications from Labelbox, the export file will contain the following information for each Free-form text classification.

Python SDK

The export format of the polygon is similar to the import format.

Learn more about exporting annotations using the SDK here

JSON

You will receive a JSON file when you generate an export from the app.

ParameterAsset typeDescription
featureIdImage
Text
Audio
Document
Tiled imagery
ID of the classification question in the ontology.
schemaIdImage
Text
Audio
Document
Tiled imagery
ID of the schema that contains all of the structural information for the classification question.
titleImage
Text
Audio
Document
Tiled imagery
Text that appears as the classification question.
valueImage
Text
Audio
Document
Tiled imagery
Name of the classification question in the Labelbox database.
answerImage
Text
Audio
Document
Tiled imagery
Correct answer for the free-form text classification.

Format

{
    "featureId": "ckmuzkkhw000a3g68xegct9wz",
    "schemaId": "ckmuzjtfa64bq0y839bn8ci4l",
    "title": "Free-form text",
    "value": "free-form_text",
    "answer": "Correct text answer"
}
{
    "featureId": "cknp3dugp00073g68fkudn092",
    "schemaId": "cknp3ctsu06nu0yctf0v5gzij",
    "title": "Free-form text",
    "value": "free-form_text",
    "answer": "Correct text answer"
}
{
    "featureId": "ckmuzkkhw000a3g68xegct9wz",
    "schemaId": "ckmuzjtfa64bq0y839bn8ci4l",
    "title": "Free-form text",
    "value": "free-form_text",
    "answer": "Correct text answer"
}
{
    "featureId": "ckmuzkkhw000a3g68xegct9wz",
    "schemaId": "ckmuzjtfa64bq0y839bn8ci4l",
    "title": "Free-form text",
    "value": "free-form_text",
    "answer": "Correct text answer"
}
{
    "featureId": "cknp3dugp00073g68fkudn092",
    "schemaId": "cknp3ctsu06nu0yctf0v5gzij",
    "title": "Free-form text",
    "value": "free-form_text",
    "answer": "Correct text answer"
}