Unlabeled Datasets

Unlabeled datasets consists of unlabeled datapoints with or without model results/predictions

Overview

Unlabeled dataset can be uploaded to utilize Aquarium's Collection Campaign functionality. Collection Campaigns allow you to group together elements within a dataset, and use that group to search through the unlabeled dataset to find similar examples.

Uploading Unlabeled Datasets is a very similar process to uploading Labeled Datasets. But instead of LabeledDataset and LabeledFrame, you will use UnlabeledDataset and UnlabeledFrame.Because of this, much of the upload documentation will look similar to the documentation for Labeled Datasets.

Unlabeled datasets can also contain inferences. For example, your team collected images for your specific task and ran them through a model to produce some crops, but the image has not been labeled. In this way, the upload still looks very similar to a labeled dataset upload, but you are using the model predictions to populate the required fields like 'classification'.

Steps to upload an unlabeled dataset:

  1. Ensure labeled dataset has already been uploaded

  2. (Optional) Acquire inferences for the unlabeled data

  3. Wait for labeled dataset to complete the upload and find the embedding version (see next section)

  4. Create UnlabeledDataset

  5. Add UnlabeledFrames that have been created with the inference data to the UnlabeledDataset

  6. Upload UnlabeledDataset

Locating The Embedding Version

An important difference in uploading an unlabeled dataset is adding the embedding version during data upload. You'll need the embedding version that was issued for the base labeled dataset you are working with. You add this in as a property in the .create_dataset() call.

You will call .create_dataset() just like you did when uploading a LabeledDataset object, but now you'll call it and pass in your UnlabeledDataset object and the embedding version:

 al_client.create_dataset(
        AL_PROJECT, 
        AL_DATASET, 
        dataset=unlabeled_dataset,
        existing_embedding_version_uuid="EMBEDDING_VERSION_ID"
    )

Because you need the embedding version to upload unlabeled data, you need to wait until the value has been generated before you can upload your unlabeled dataset.

Where Do I Find The Embedding Version?

In order for similarity search to work, your search dataset and your seed dataset must have compatible embedding spaces. To specify this explicitly, you will be using embedding versions (represented by UUIDs).

Note that the Get Version button will be disabled if your seed dataset is still post-processing. Usually the upload order is labeled dataset, then unlabeled dataset to retrieve the embedding version.

To determine the embedding version for your seed dataset, go to the Project Details page and select the Embeddings tab:

Select the name of your seed dataset from the dropdown and click Get Version:

The UUID that appears is the embedding version that you will use in the following section, when uploading an unlabeled indexed dataset via the Python client.

Creating and Formatting Your Unlabeled Data

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

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

This usually means looping through your data and creating unlabeled frames and then adding them to your unlabeled dataset.

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:

# defining the UnlabeledDataset object
unlabeled_dataset = al.UnabeledDataset()

# defining UnlabeledFrame object
# frames must have a unique id
# unlabeled frames should contain new data like images or point clouds
# so the frame id should be completely unique and uncoupled from any 
# labeled or inference data
frame_id = FILE_OR_IMAGE_NAME.split('.jpg')[0]
unlabeled_frame = al.UnlabeledFrame(frame_id=frame_id)

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).

Adding Data to Your Unlabeled Frame

Each UnlabeledFrame 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:

unlabeled_frame.add_image(
    # A URL to load the image by
    image_url='',
    # A URL to a compressed form of the image for faster loading in browsers.
    # It must be the same pixel dimensions as the original image.
    preview_url='',
    # Optional: ISO formatted date-time string
    date_captured='',
    # Optional: width of image in pixels, will be inferred otherwise
    width=1280,
    # Optional: height of image in pixels, will be inferred otherwise
    height=720
)

Adding Inferences to Your Unlabeled Frame

Each unlabeled frame requires at least one label in order to upload. However in the case of unlabeled data, the data populating the label is model inference data generated on your unlabeled samples.

In the case where you don't have the ability to generate inferences for the unlabeled data, you will have to create some kind of fake "label" depending on what your task is.

For example, a fake classification or an arbitrary bounding box.

For example, when attaching inference results to the unlabeled frame, we use the functions for labels, not inferences, even though the classifications/bounding boxes/etc are being populated with inference data. For example we use:

unlabeled_frame.add_label_2d_classification(
    label_id="unique_id_for_this_label",
    classification=PREDICTED_INFERENCE_CLASSIFICATION
)

unlabeled_frame.add_label_2d_bbox(
    # A unique id across all other labels in this dataset
    label_id='unique_id_for_this_label',
    classification=PREDICTED_INFERENCE_CLASSIFICATION,
    # Coordinates are in absolute pixel space
    top=INFERENCE_VALUE_TOP,
    left=INFERENCE_VALUE_LEFT,
    width=INFERENCE_VALUE_WIDTH,
    height=INFERENCE_VALUE_HEIGHT
)

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

# Standard 2D case
unlabeled_frame.add_label_2d_classification(
    # A unique id across all other labels in this dataset
    label_id='unique_id_for_this_label',
    classification='dog'
)

# 3D classification
unlabeled_frame.add_label_3d_classification(
    # A unique id across all other labels in this dataset
    label_id='unique_id_for_this_label',
    classification='dog',        
    # Optional, defaults to implicit WORLD coordinate frame
    coord_frame_id='robot_ego_frame',
)

Putting It All Together

We offer a variety of options when it comes to working with unlabeled data and we've elaborated on some of the more nuanced operations in another section below.

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

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:

# Add an image to the frame
image_url = "https://storage.googleapis.com/aquarium-public/quickstart/pets/imgs/" + entry['file_name']
unlabeled_frame.add_image(image_url=image_url)

# Add the ground truth classification label to the frame
label_id = frame_id + '_gt'
unlabeled_frame.add_label_2d_classification(
    label_id=label_id, 
    classification="CLASSIFICATION_FROM_INFERENCE"
)

# once you have created the frame, add it to the dataset you created
unlabeled_dataset.add_frame(unlabeled_frame)

Uploading Your Unlabeled 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 UnlabeledDataset to be uploaded in to Aquarium by calling .create_dataset(). It is the same function we use with LabeledDataset uploads.

Please use a unique name for your unlabeled dataset. Do not use the same name as an existing labeled dataset.

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

UNLABELED_DATASET_NAME = 'unlabeled_dataset'
al_client.create_dataset(
    PROJECT_NAME, 
    UNLABELED_DATASET_NAME, 
    dataset=unlabeled_dataset.
    existing_embedding_version_uuid="EMBEDDING_VERSION_ID"
)

After kicking off your inferences upload, 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 in the specific Project page, you'll be able to see your unlabeled dataset details in the "Unlabeled Dataset" tab.

Last updated