Advanced

You normally do not need anything on this page: datasets and evaluators cover the benchmark workflow end to end.

Scenario index

Datasets build a ScenarioIndex internally from the root/split you pass them, so you normally never construct one yourself (for the evaluator identifiers, use WithIdentifiers or a composite dataset — see Evaluating your model). It is documented here because the keyword arguments datasets forward to it (clip_len, stride, anomaly_types, towns, download, parts) are defined on its constructor.

class carlanomaly.ScenarioIndex(root, split='train', clip_len=1, stride=None, anomaly_types=None, towns=None, download=False, parts=None, download_verify=True)[source]

Bases: object

Discovers scenarios and builds a flat sliding-window index.

Datasets construct this internally from the root/split you pass them, so you normally never instantiate it directly. Datasets built with the same parameters produce identical indices, so dataset_a[i] and dataset_b[i] always refer to the same scenario and timestep window.

Parameters:
  • root – Path to the CarlAnomaly root directory (contains train/ and test/).

  • split – 'train', 'test_normal', 'test_anomaly', or 'test' (= normal + anomaly combined).

  • clip_len – Number of consecutive timesteps per item.

  • stride – Sliding-window stride. Defaults to clip_len.

  • anomaly_types – Restrict test anomaly clips to a subset of types.

  • towns – Restrict to scenarios from specific towns.

  • download – If True, download and extract the required dataset archives into root (via carlanomaly.download.ensure_parts()) before discovery. Idempotent: already-present archives are skipped.

  • parts – Which dataset parts to download when download=True. Defaults to ["base"] (the minimum needed for scenario discovery). Add more (e.g. "lidar", "depth", "camera-extended") for the modalities you intend to load.

  • download_verify – Verify SHA-256 checksums of downloaded archives (default True).

Parameters:
  • root (Union[str, Path])

  • split (str)

  • clip_len (int)

  • stride (Optional[int])

  • anomaly_types (Optional[Sequence[str]])

  • towns (Optional[Sequence[str]])

  • download (bool)

  • parts (Optional[Sequence[str]])

  • download_verify (bool)

property records: List[ScenarioRecord]
__len__()[source]
Return type:

int

__getitem__(idx)[source]

Return (ScenarioRecord, timestep_start) for the given item index.

Return type:

Tuple[ScenarioRecord, int]

Parameters:

idx (int)

timesteps_for(idx)[source]

Return the list of timestep indices for item idx.

Return type:

List[int]

Parameters:

idx (int)

Constants

carlanomaly.CAMERAS = ("front", "left", "right", "rear")

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

carlanomaly.ANOMALY_TYPES = ('change-weather', 'running-pedestrian', 'spawn-props', 'steer-driver', 'street-light-flicker', 'traffic-light-flicker', 'traffic-light-off', 'traffic-light-yellow-blinking', 'vanish-actor')

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.