Python annotation types



The standard input format used to upload annotations to Labelbox.

Python annotation types

The Labelbox Python Annotation Types are a common format for representing human and machine-generated annotations. Teams can use Annotations Types to standardize and simplify many aspects of their machine learning data management.

Key features:


Annotation Types is part of data extra of the Labelbox Python SDK.

pip install "labelbox[data]"


  • A LabelCollection is a list or generator for working with a collection of Labels
  • A Label is constructed fromData and Annotations. E.g. an image and bounding boxes
  • An Annotation is either an ObjectAnnotation or a ClassificationAnnotation.
  • Annotations have a name and a Geometry, Classification, or some Text data.


Creating labels and annotations

A simple example creating a Point at the coordinate (10, 10) with the class name "target" on an image.

from import  Label, LabelList, ImageData, Point, ObjectAnnotation

labels = [
    data = ImageData(url = "http://my-img.jpg"),
    annotations = [
            value = Point(x = 10, y = 10),
            name = "target"
labels = LabelList(labels)

Serializing annotations

It's a common workflow to change the format for annotations to work with tools like Model diagnostics or Model-assisted labeling (MAL). Using a built-in or custom serializer you can transform annotations to the necessary format.

from import NDJsonConverter

project = client.get_project("<project-id>")

# To assign feature schema ids to named fields
lblabels = labels.assign_feature_schema_ids(OntologyBuilder.from_project(project))
# conver to NDJSON format
ndlabels = NDJsonConverter.serialize(lblabels)

# Upload for model assisted labeling
upload_task = project.upload_annotations(


You can explore the functionality of the library through the following notebooks.

Python Tutorial


Google Colab

Annotation Type Basics

Open in Github

Open in Google Colab


Open in Github

Open in Google Colab

Label Containers

Open in Github

Open in Google Colab

MAL Using Annotation Types

Open in Github

Open in Google Colab

Did this page help you?