Creating your first project
Before you start
Make sure you have completed the [installation and authentication] steps before continuing to the steps below. Also, to better understand the functionalities described from here on out, take a moment to read Overview & data types.
In order for the following methods to work, make sure the API client is initialized:
from labelbox import Client
client = Client()
Step 1 Build your project's foundation
In the rough hierarchical structure of Labelbox’s data objects, projects and datasets are considered "top-level" objects. They are the foundation upon which your labeling pipeline is structured. Because they are top-level, projects and datasets are created using the Labelbox Client directly.
create_project method to create and name your project. You will be attaching your datasets to your project so name it accordingly.
project = client.create_project(name="<project_name>")
Within your project, use the
create_dataset method to create a dataset, name it, and attach it to your project. The name of the dataset should reflect the nature of the data it contains.
dataset = client.create_dataset(name="<dataset_name>", projects=project)
Step 2 Add data to your project
There are two ways to create data rows within a dataset, in bulk and individually. For details on acceptable file types, see Supported file types.
create_data_row method accepts files individually and is a synchronous operation.
dataset = client.get_dataset("dataset_id")
data_row = dataset.create_data_row(row_data="http://my_site.com/photos/img_01.jpg")
You can also pass a string to a local file.
data_row = dataset.create_data_row(row_data="path/to/file.jpg")
For instructions on how to bulk upload data rows using the
create_data_rows method, see Data Rows.
Was this section helpful? Give your feedback below.