For the complete documentation index, see llms.txt. This page is also available as Markdown.

Labeled Datasets

Labeled datasets include all of your ground truth labels for your dataset

Overview

Labeled datasets contain your ground truth/labels. A labeled dataset belongs to a Project and consist of multiple labeled frames.

A labeled frame is one logical "frame" of data, such as an image from a camera stream. They can contain one or more media/sensor inputs, zero or more ground truth labels, and arbitrary user provided metadata.

For example, in a 2D classification case, a frame would contain the image, labels, and all associated metadata. Whereas with a 3D object detection use case, a frame can contain images, point clouds, labels, and metadata too.

For real examples of uploading labeled data, please look at our quickstart guides!

Prerequisites to Uploading Labeled Data

In order to ensure the following steps will work smoothly, this guide assumes you have already:

  • Installed the Aquarium SDK

  • Have URLs for your raw data (images, point clouds, etc.)

    • See our data sharing docs for more details on URL requirements.

  • Have access to your labels for your raw data

To view your labeled data once uploaded, you will have to make sure that you have selected and set up the appropriate data sharing method for your team.

Creating and Formatting Your Labeled Data

To ingest a labeled dataset, there are two main objects you'll work with:

  • LabeledFrame

    • An object containing all relevant information for a single frame/image. Data URLs, labels, metadata, etc.

  • LabeledDataset

    • A collection of LabeledFrames.

For each datapoint, we create a LabeledFrame and add it to the LabeledDataset in order to create the dataset that we upload into Aquarium.

This usually means looping through your data and creating LabeledFrames to add to the LabeledDataset object.

If you have generated your own embeddings and want to use them during your labeled data uploads, please also see this section for additional guidance!

Defining these objects looks like this:

Once you've defined your frame, we need to associate some data with it! In the next sections, we show you how to add your main form of input data to the frame (images, point clouds, etc), and then associate the ground truth labels to that frame.

Adding Data to Your Labeled Frame

Each LabeledFrame in your dataset can contain one or more input pieces of data. In many computer vision tasks, this may be a single image. In a robotics or self-driving task, this may be a full suite of camera images, lidar point clouds, and radar scans.

Here are some common data types, their expected formats, and how to work with them in Aquarium:

Your ML task utilizes images and you would like to add an image to your labeled data

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

image_url

string - URL to load the image by

preview_url (Optional)

string - URL to a compressed form of the image for faster loading in browsers, must be same pixel dimensions as original image

date_captured (Optional)

ISO formatted date-time string

width (Optional)

int - will be inferred otherwise

height (Optional)

int - will be inferred otherwise

Your ML task utilizes images and you would like to add an image to your labeled data

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

key

string - URL to load the image by

val

string - URL to a compressed form of the image for faster loading in browsers, must be same pixel dimensions as original image

val_type(Optional)

ISO formatted date-time string

Your ML task utilizes geospatial data and you want to add the data as context for analysis and filtering

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

lat

float - lattitude of Geo Location

lon

float - longitude of Geo Location

If your model also works against spectrograms, you can provide both an audio data input and an image. The Aquarium UI will then present both alongside each other.

Aquarium supports audio files that are natively playable in browsers. For maximum compatibility, we recommend providing .mp3 files.

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

audio_url

string - URL to load the mp3 file from

date_captured

string - ISO formatted date-time string

Because point cloud formats haven't standardized as much as image data yet, we currently supported two formats. Please reach out if you have a different representation as we'd be more than happy to support your in-house representation.

PCL / PCD

Aquarium supports the *.pcd file format used by the PCL library, including the binary and compressed binary encodings. Numeric values for the following column names are expected: x, y, z, intensity (optional), range (optional).

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

pcd_url

string - URL to load the point cloud by

coord_frame_id (Optional)

string - If your point cloud is relative to a specific coordinate frame, you can reference it by name here

date_captured (Optional)

string - ISO formatted date-time string

KITTI-like binary files

Similar to the raw KITTI lidar formats, we can also take in raw, dense binary files of little-endian values. This is in many ways more fragile, but also requires no third party libraries.

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

point_cloud_url

string - URL for the point positions:

intensity_url

string - URL for the point intensities:

range_url

string - URL for the point ranges

coord_frame_id (Optional)

string - If your point cloud is relative to a specific coordinate frame, you can reference it by name here.

date_captured (Optional)

string - ISO formatted date-time string

Aquarium supports rendering basic 3D geometry meshes. Please reach out if you have any needs that aren't captured here.

.OBJ (Wavefront) Files

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

obj_url

string - URL to add a *.obj formatted text

coord_frame_id (Optional)

string - If your object geometry is relative to a specific coordinate frame, you can reference it by name here

date_captured (Optional)

string - ISO formatted date-time string

In robotics applications, you often have multiple sensors in multiple coordinate frames. Aquarium supports specifying different coordinate frames, which will be used when interpreting 3D data inputs and labels.

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

coord_frame_id

string - String identifier for this coordinate frame

position

dictionary with keys 'x', 'y', 'z' - Position offset of this coordinate frame, values can be an int or float

orientation

dictionary with keys 'w', 'x', 'y', 'z' - Rotation/Orientation of this coordinate frame, represented as a quaternion, values can be an int or a float

parent_frame_id (Optional)

string - string ID of the parent coordinate frame that this one is relative to

Adding Labels to Your Labeled Frame

Each labeled frame in your dataset can contain zero or more ground truth labels.

Here are some common label types, their expected formats, and how to work with them in Aquarium:

You are working with 2D or 3D data and want to add a classification label

Python API Definition Link - 2D

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

label_id

string - a unique id across all other labels in this dataset

classification

string - what the label is classified as

user_attrs (Optional)

dict - Any additional label-level metadata fields. Defaults to None.

You are creating a label on an image that is a 2D bounding box

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

label_id

string - a unique id across all other labels in this dataset

classification

string - what the label is classified as

top, left, width, height

int or float - Coordinates are in absolute pixel space

user_attrs (Optional)

dict - Any additional label-level metadata fields. Defaults to None.

Aquarium supports 3D cuboid labels, with 6-DOF position and orientation.

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

label_id

string - Unique string identifier for this coordinate frame

classification

string - classification of the cuboid

dimensions

list with values for xyz dimensions - xyz dimensions of cuboid

position (Optional)

list with values for xyz - Position of the center of the object

rotation (Optional)

list with values for XYZW - Ordered object rotation quaternion

coord_frame_id (Optional)

str - If your cuboid is relative to a specific coordinate frame, you can reference it by name here

user_attrs (Optional)

dict - Any additional label-level metadata fields. Defaults to None.

3D Cuboid Image Projection (Optional)

Example of 3D cuboids projected onto image

If you have images attached to your frames alongside 3D cuboids, we can project the cuboids onto the images! First you will need to add a 2D coordinate frame:

View the Python API docs for more information on the parameters to add_coordinate_frame_2d

And then you can use this 2D coordinate frame when adding your image to the frame:

Now you will be able to see your 3D cuboids projected onto your images and have camera distortion properly accounted for!

2D Semantic Segmentation labels are represented by an image mask, where each pixel is assigned an integer value in the range of [0,255]. For efficient representation across both servers and browsers, Aquarium expects label masks to be encoded as grey-scale PNGs of the same dimension as the underlying image.

If you have your label masks in the form of a numpy ndarray, we recommend using the pillow python library to convert it into a PNG:

Because this will be loaded dynamically by the web-app for visualization, this image mask will need to be hosted somewhere. To upload it as an asset to Aquarium, you can use the following utility:

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

project_id

string - name of the project

dataset_id

string - name of the labeled dataset

filepath

string - The filepath to grab the assset data from

user_attrs (Optional)

dict - Any additional label-level metadata fields. Defaults to None.

This utility hosts and stores a copy of the label mask (not the underlying RGB image) with Aquarium. If you would like your label masks to remain outside of Aquarium, chat with us and we'll help figure out a good setup.

Now, we add the label to the frame like any other label type:

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

label_id

string - a unique id across all other labels in this dataset

classification

string - what the label is classified as

top, left, width, height

int or float - Coordinates are in absolute pixel space

user_attrs (Optional)

dict - Any additional label-level metadata fields. Defaults to None.

Aquarium represents instance segmentation labels as 2D Polygon Lists. Each label is represented by one or more polygons, which do not need to be connected.

Python API Definition Link

Example Usage

Relevant Function Parameter Descriptions

Parameter Name
Description

label_id

string - Unique id across all other labels in this dataset

classification

string - classification of the polygon label

polygons

dictionary with format {'vertices': [(x1, y1), (x2, y2) ...]} - coordinates are in absolute pixel space -- these are polygon vertices, not a line string, there should be no duplicated vertices in the list

center (Optional)

list of ints or floats - indicate the center position of the object

user_attrs

dict - Any additional label-level metadata fields. Defaults to None.

Making Metadata Fields Queryable

When you add metadata fields to your Label, we need to take one extra step so that you can query those fields and search for them in the Analysis view! Add the code below to your script, you can add it in right after you call create_dataset():

You can also run update_dataset_object_metadata_schema() on it's own after an upload to update the metadata to be queryable.

You can run this snippet on it's own after an upload:

Putting It All Together

In the API docs you can see the other operations associated with a LabeledFrame.

Now that we've discussed the general steps for adding labeled data, here is an example of what this would look like for a 2D classification example would look like this:

Uploading Your Labeled Dataset

Now that we have everything all set up, let's submit your new labeled dataset to Aquarium!

Aquarium does some processing of your data, like indexing metadata and possibly calculating embeddings, so after they're submitted so you may see a delay before they show up in the UI. You can view some examples of what to expect as well as troubleshooting your upload here!

Submitting Your Dataset

You can submit your LabeledDataset to be uploaded in to Aquarium by calling .create_dataset().

To spot check our data immediately, we can set the preview_first_frame flag toTrue and see a link in the console to a preview frame allows you to make sure data and labels look right.

This is an example of what the create_dataset() call will look like:

After kicking off your dataset, it can take anywhere from minutes to multiple hours depending on your dataset size.

You can monitor your uploads under the "Streaming Uploads" tab in the project view. Here is a guide on how to find that page.

Once completed within Aquarium on the Project page, you'll be able to see your project with an updated count of how many labeled datasets have been added to the Project (the count also includes then number of unlabeled datasets).

You can see your new labeled dataset fully uploaded and reflected in the count in the bottom left corner of the project card.

Additional Features

Multiple Sensor IDs

Sensor IDs are used reference data points that exist on a frame. They are usually omitted in frames and labels, but become necessary if there exists more than one type of data point on a single frame. A good example of this is a frame with multiple camera view points.

Quickstart Examples

For examples of how to upload labeled datasets, check out our quickstart examples.

Quickstart Guides

Last updated

Was this helpful?