Skip to main content

Get Catalog slices via SDK

You can programmatically retrieve a slice’s data rows and all associated information via our Python SDK. From there, you can use Catalog to inspect the data rows you retrieved via the SDK visually. Retrieving a slice programmatically is a convenient way to curate a new batch or a model run dataset directly from a saved slice.

End-to-end example: create and retrieve Catalog slices

Before you start

You must import these libraries to use the code examples in this section

Replace with your API key

Create a Catalog slice

Currently, we do not support creating slices through the SDK; for the purpose of this demo, we will create a catalog slice through the UI.
1
Navigate to the Catalog section of the Labelbox Platform, and select All datasets or a particular dataset you would like to create a slice from.
2
Navigate to Search your data dropdown menu or use a similarity search to create a filter.

Example of final view after executing steps 1 - 2

3
Hit Enter and select Save slice
4
Give the slice name and select Save
5
Copy the Slice ID

Example of final view after executing steps 3 - 5

6
Paste Slice ID

Get Catalog Slice

Obtain Data Row IDs and Data Row objects from the Catalog slice

Obtain Data Row identifiers

Data row identifiers are objects that contain both the data row ID(s) and global keys.

Curate a batch from a Catalog slice via SDK

You can create a new batch from your slice or create a random sample from a slice using our Python SDK. See the Python example below to learn how to do this.
You can append data rows to your model runs for inference from your slice. See the Python example below to learn how to do this.