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")
Use a finalized scene split
Read explicit assignments from the same version used in Clarity. A researcher can select held-out images by ID without downloading any imagery.
import hashlib
import json
manifest = sdk.dataset_version.get_scene_split_manifest(dataset_version_id)
payload = manifest.to_dict()
expected_hash = payload.pop("sha256")
encoded = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()
assert hashlib.sha256(encoded).hexdigest() == expected_hash
test_layers = [
layer_id
for scene in manifest.scenes if scene.split == "test"
for layer_id in scene.image_layer_ids
]
The digest covers the dataset/version IDs and the image-layer assignments. Record the scientific source revision separately when pinning the input pixels for a method. A version using an automatic training/validation split or assigning one image to multiple splits returns HTTP 409.
Public MCP clients can read the same manifest using plan_operation with operation_type="dataset.scene_split_manifest". Supply dataset_version_id, then use next_offset and the returned sha256 as expected_sha256 to retrieve subsequent pages from that snapshot.