Labelbox Python API
Project description
Labelbox Python SDK
Labelbox is a cloud-based data-centric AI platform designed to help teams create high-quality training data for their AI models. It provides a suite of tools and features that streamline the process of data curation, labeling, model output evaluation for computer vision and large language models. Visit Labelbox for more information.
The Python SDK provides a convenient way to interact with Labelbox programmatically, offering advantages over REST or GraphQL APIs:
- Simplified interactions: The SDK abstracts away the complexities of API calls, making it easier to work with Labelbox.
- Object-oriented approach: The SDK provides an object-oriented interface, allowing you to interact with Labelbox entities (projects, datasets, labels, etc.) as Python objects.
- Extensibility: The SDK can be extended to support custom data formats and operations.
Table of Contents
Installation
Welcome to the quick start guide for integrating Labelbox into your Python projects. Whether you're looking to incorporate advanced data labeling into your workflow or simply explore the capabilities of the Labelbox Python SDK, this guide will walk you through the two main methods of setting up Labelbox in your environment: via a package manager and by building it locally.
Install using pip
To get started with the least amount of hassle, follow these simple steps to install the Labelbox Python SDK using pip, Python's package manager.
-
Ensure pip is installed: First, make sure you have
pip
installed on your system. It's the tool we'll use to install the SDK. -
Sign up for Labelbox: If you haven't already, create a free account at Labelbox to access its features.
-
Generate your API key: Log into Labelbox and navigate to Account > API Keys to generate an API key. You'll need this for programmatic access to Labelbox.
-
Install the SDK: Open your terminal or command prompt and run the following command to install the Labelbox Python SDK:
pip install labelbox
-
Install optional dependencies: For enhanced functionality, such as data processing, you can install additional dependencies with:
pip install "labelbox[data]"
This includes essential libraries like Shapely, GeoJSON, NumPy, Pillow, and OpenCV-Python, enabling you to handle a wide range of data types and perform complex operations.
Building and installing locally
For those who prefer or require a more hands-on approach, such as contributing to the SDK or integrating it into a complex project, building the SDK locally is the way to go.
Steps for local installation
-
Clone the SDK repository: First, clone the Labelbox SDK repository from GitHub to your local machine.
-
Install required dependencies: To ensure all dependencies are met, run:
pip install -r requirements.txt
-
Install the SDK locally: Navigate to the root directory of the cloned repository and run:
pip install -e .
For additional data processing capabilities, remember to install the
data
extra as mentioned in the easy installation section.
Code architecture
The Labelbox Python SDK is designed to provide a clean and intuitive interface for interacting with the Labelbox API. It primarily uses GraphQL for communication, with some REST API calls for specific functionalities. The SDK wraps the GraphQL API calls and provides object-oriented representations of Labelbox entities like projects, datasets, and labels. This allows developers to interact with Labelbox in a more Pythonic way, making code easier to read and maintain.
Key files and classes include:
labelbox/client.py
: Contains theClient
class, which provides methods for interacting with the Labelbox API.labelbox/orm/model.py
: Defines the data model for Labelbox entities like projects, datasets, and labels.labelbox/schema/*.py
: Contains classes representing specific Labelbox entities and their attributes.labelbox/data/annotation_types/*.py
: Defines classes for different annotation types, such as bounding boxes, polygons, and classifications.labelbox/data/serialization/*.py
: Provides converters for different data formats.
The SDK wraps the GraphQL APIs and provides a Pythonic interface for interacting with Labelbox.
Contribution guidelines
We encourage developers to contribute to the Labelbox Python SDK and help improve its functionality and usability. Please refer to the CONTRIB.md file in the root folder of the repository for detailed information on how to contribute.
Develop with AI assistance
Use the codebase as context for large language models
Using the GPT repository loader, we have created lbx_prompt.txt
that contains data from all .py
and .md
files. The file has about 730k tokens. We recommend using Gemini 1.5 Pro with 1 million context length window.
Documentation
The Labelbox Python SDK is well-documented to help developers get started quickly and use the SDK effectively. Here are some resources:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for labelbox-3.66.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bedb2b0ba130a78fc8bf80d7fe63b04c981942b74b632f0ae8e16560e7cff918 |
|
MD5 | a6c6dcb02953de1000ab4c1a1915bdbf |
|
BLAKE2b-256 | e0f6540ff28d3aebe908dd28b1dd5f1a7c1ff12069b03862b35e5de19c6562ae |