Download utilities

carlanomaly.download.PARTS: Dict[str, str] = {'base': 'Front camera + segmentation, GNSS/IMU/weather/actions/collisions, and (test only) front anomaly masks + timestep labels.', 'camera-extended': 'Left/right/rear RGB + segmentation, and (test only) their anomaly masks.', 'depth': 'Depth maps for all four cameras.', 'kitti': 'LiDAR labels in KITTI format.', 'lidar': 'LiDAR point clouds, and (test only) per-point anomaly labels.'}

All downloadable parts, with a short human-readable description of the directories each one contributes to a scenario (see package_dataset.sh).

carlanomaly.ensure_parts(root, parts, splits=None, *, verify=True, progress=True, keep_archive=False, base_url=None)[source]

Download and extract dataset parts into root (idempotent).

Parameters:
  • root – Dataset root (archives extract to root/{train,test}/...).

  • parts – One part name or a sequence of them (see PARTS).

  • splits – 'train', 'test', or both. Defaults to both.

  • verify – Verify the SHA-256 checksum after download. When no checksum is published for an archive, a warning is logged and the file is kept.

  • progress – Show a download progress bar (tqdm if available, else textual).

  • keep_archive – Keep the downloaded .tar.gz after extraction (default: delete it).

  • base_url – Override DATA_BASE_URL for this call.

Return type:

None

Parameters:
carlanomaly.part_for(modality, direction=None)[source]

Return the archive part that contains a given modality/direction.

Depth maps are bundled together regardless of camera direction; the RGB, segmentation and anomaly-label modalities split by direction: front is in base, the other camera directions are in camera-extended, and sensor labels for lidar live in the lidar part.

Return type:

str

Parameters:
  • modality (str)

  • direction (str | None)

carlanomaly.download.part_present(root, part, split)[source]

Whether part of archive split split is already in root.

True if the downloader left its marker, or if every scenario of the split has the part’s probe directory (PART_PROBES), i.e. the archive was downloaded and extracted by hand. An interrupted manual extraction of a non-base part is caught; one of base is not (the missing scenarios simply do not exist yet).

Return type:

bool

Parameters:
carlanomaly.download.require_parts(root, parts, splits)[source]

Raise FileNotFoundError if any of parts is missing from root.

The message names the missing parts and both ways to fetch them.

Return type:

None

Parameters:

Datasets do not download by default. With download=True they call ensure_parts(), which skips parts that are already in root: those it downloaded itself (marker file) and those extracted by hand (part_present()).

CLI

The carlanomaly-download command-line tool wraps ensure_parts():

# List available parts
carlanomaly-download --list

# Download the base part (front camera + tabular + test labels)
carlanomaly-download --root /data/carlanomaly --parts base

# Download LiDAR data for the test split only
carlanomaly-download --root /data/carlanomaly --parts lidar --splits test