py123detection.sources

Resolving “a 123D data root plus split names” into the scenes an export iterates over.

A frame-indexed pkl needs exactly one scene per log, spanning the whole log. Source builds the SceneFilter for that and exposes the few options that matter:

Source(data_root="/data/py123d", splits=["nuscenes-mini_train"], sample_rate_hz=2.0)

Scenes built elsewhere can be passed in directly with Source.from_scenes(scenes).

Classes

Source([data_root, splits, datasets, ...])

One 123D input to export: where the logs are, which of them, and at what rate.

class py123detection.sources.Source(data_root=None, splits=None, datasets=None, split_types=None, log_names=None, sample_rate_hz=None, frame_stride=None, required_modalities=None, max_logs=None, timestamp_offset_us=0, name=None, scene_filter=None, scenes=None)[source]

Bases: object

One 123D input to export: where the logs are, which of them, and at what rate.

data_root: str | Path | None = None

123D data root holding logs/ and maps/. None uses PY123D_DATA_ROOT.

splits: List[str] | None = None

Split names, e.g. ["nuscenes-mini_train"]. None reads every split under the root.

datasets: List[str] | None = None
split_types: List[str] | None = None

train / val / test. Ignored when splits is set.

log_names: List[str] | None = None
sample_rate_hz: float | None = None

Target frame rate; 2.0 on a 10 Hz log keeps every 5th frame. Wins over frame_stride.

frame_stride: int | None = None
required_modalities: List[str] | None = None

SceneFilter.required_scene_modalities entries, e.g. ["camera:any", "box_detections_se3"].

max_logs: int | None = None
timestamp_offset_us: int = 0

Added to every exported timestamp of this source.

mmdet3d’s NuScenesDataset.load_annotations sorts all infos by timestamp, so merged datasets whose timestamps overlap would get their logs interleaved. An offset keeps them apart without touching intra-log time deltas.

name: str | None = None

Label for logs and metadata. Defaults to the joined splits.

scene_filter: SceneFilter | None = None

Use this filter instead of building one. Leave future_duration_s and future_num_iterations unset, or frames get exported more than once.

scenes: List[SceneAPI] | None = None

Pre-built scenes, one per full log. No filtering happens when set.

classmethod from_scenes(scenes, name=None, timestamp_offset_us=0)[source]
Return type:

Source

property label: str
property is_subsampled: bool
build_scene_filter(native_rate=False)[source]

Build the filter for this source.

Leaving future_* unset puts the 123D scene builder in its one-scene-per-full-log mode.

Parameters:

native_rate (bool) – Drop the sampling options and keep every frame. The export uses this view for lidar sweeps and track velocities.

Return type:

SceneFilter

load_scenes(executor=None, native_rate=False)[source]

Scenes of this source, one per log, sorted by (split, log_name) for reproducible exports.

Return type:

List[SceneAPI]