Table of Contents

Labels

Alex Cota Updated by Alex Cota

Below are some frequently used methods for Labels. For a complete list of methods see the API reference.

A Label is a collection of annotations on a Data Row.

Before you start

Make sure the client is initialized.

from labelbox import Client
client = Client()

Get labels

Use this sample code to get labels from a project. Then, iterate through the PaginatedCollection object to list each label.

project = client.get_project("<project_id>")
labels = project.labels()
for x in labels: print(x)

Export labels

The sample below uses the export_labels method to print a URL to a JSON file containing the labels of a project.

project = client.get_project("<project_id>")
url = project.export_labels()
print(url)

The response will be a URL of the label data file.

'https://storage.googleapis.com/labelbox-exports/cjnywra4rytzd
079735j0hfnt/ck22dy2gmnbw08111o6y2ycs9/export-2019-10-29T22:59
:08.592Z.json'

Bulk delete labels

Use the bulk_delete method for deleting multiple labels at a time. Users usually seek to do this when they realize there was an error in the way that the labels were initially created. This method allows you to remove the existing annotations.

Specify a project and delete use the bulk_delete method to delete all labels from that project.

project = client.get_project("<project_id>")
Label.bulk_delete(list(project.labels()))

Was this page helpful?

Import annotations

General concepts

Contact