Introduction
Hybrid & On-prem
Hybrid cloud
Cloud data overview
Restrict data access by IP range
How to generate signed URLs
How to generate non-expiring signed URLs
On-prem
App
Overview
Ontology management
Projects
Data import
Labeling guides
Label export
Members
Workforce
Quality assurance
Automation
Model-assisted labeling
MAL import formats
Webhooks setup
Queue system
Real-time human-in-the-loop labeling
Custom label interface
Images
Videos
Text
Geospatial data
Python SDK
Getting started
Creating your first project
Project setup script
Projects
Datasets
Data Rows
Import annotations
Labels
General concepts
Python SDK FAQ
API reference
Model-assisted labeling Python script
GraphQL API
Intro to the GraphQL API
Getting started
Data types overview
Ontologies
Datasets
Data Rows
Bulk import requests
Labeling parameters
Labels
Members
Attachments
Review queue
Webhooks
Legacy editor
Migration guide
Legacy vs new editor ontology
Legacy vs new editor JSON exports
Legacy vs new editor hotkeys
Model predictions (legacy)
Multistep labeling
Release notes
Release definitions
January 6, 2021
December 7, 2020
November 4, 2020
October 9, 2020
September 25, 2020
August 21, 2020
August 6, 2020
July 6, 2020
June 22, 2020
June 2, 2020
May 19, 2020
April 14, 2020
April 1, 2020
March 3, 2020
February 18, 2020
February 5, 2020
January 17, 2020
Terms of use
Table of Contents
- All Categories
- Python SDK
- Labels
Labels
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:
user = x.created_by()
dataRow = x.data_row()
print(dataRow.row_data)
print(user.email)
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()))