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_idsandclass_id_to_index_maptrain_image_ids,validation_image_ids, andtest_image_idslabel_uuidsandlabels
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 dimensionsimage_id,class_id, andclass_nameimage_heightandimage_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")