The standard input format used to upload annotations to Labelbox.
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.
- Format conversion
- Native support for Model-assisted labeling (MAL) & Model diagnostics
Annotation Types is part of
data extra of the Labelbox Python SDK.
pip install "labelbox[data]"
LabelCollectionis a list or generator for working with a collection of
Labelis constructed from
Annotations. E.g. an image and bounding boxes
Annotationis either an
Annotationshave a name and a
Classification, or some
A simple example creating a
Point at the coordinate (10, 10) with the class name "target" on an image.
from labelbox.data.annotation_types import Label, LabelList, ImageData, Point, ObjectAnnotation labels = [ Label( data = ImageData(url = "http://my-img.jpg"), annotations = [ ObjectAnnotation( value = Point(x = 10, y = 10), name = "target" ) ] ) ] labels = LabelList(labels)
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 labelbox.data.serialization 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( name="upload-job-1", annotations=ndjsons, validate=True )
You can explore the functionality of the library through the following notebooks.
Updated about 2 months ago