Skip to main content

Dataset versions

Download generated ML datasets and inspect their labels and image splits.

Module method

sdk.dataset_version.get(dataset_version_id) returns a DatasetVersionResource. It lazily exposes:

  • class_ids and class_id_to_index_map
  • train_image_ids, validation_image_ids, and test_image_ids
  • label_uuids and labels

download(folder_path) creates a subdirectory named after the version ID and downloads the generated dataset artifact there.

Label resources

Each LabelResource lazily exposes:

  • mask: a NumPy boolean array with the source image's dimensions
  • image_id, class_id, and class_name
  • image_height and image_width

Example

dataset_version = sdk.dataset_version.get(dataset_version_id=2929)

print("Train images:", dataset_version.train_image_ids)
print("Validation images:", dataset_version.validation_image_ids)
print("Test images:", dataset_version.test_image_ids)
print("Class index map:", dataset_version.class_id_to_index_map)

first_label = dataset_version.labels[0]
print(first_label.class_name, first_label.mask.shape)

dataset_version.download(folder_path="/local/downloads/datasets")