py123d_detection.torch.visualize.viewer

py123det-view: a run’s predictions inside py123d’s own viewer.

py123det-view work_dirs/petr_nuscenes/eval/nuscenes/predictions.jsonl –split nuscenes_val

py123d ships a Viser viewer with lidar, map, camera frustums, ground truth and playback. This adds one element to it, the model’s boxes for the frame on screen, rather than writing a second viewer, so everything else in the picture stays py123d’s and keeps working when py123d improves it.

Two things have to line up for a prediction to land on the right frame, and both are checked rather than assumed:

  • The scenes. A predictions file names scenes by uuid, so the logs are looked up by uuid and a uuid the data root does not hold is reported, not silently dropped.

  • The frame numbering. A token is <scene uuid>:<iteration>, and the iteration is an index into the scene as the evaluation built it. A run scored at frame_stride=12 numbered every twelfth frame 0, 1, 2, so viewing it against the native-rate log would put frame 1’s boxes on the second frame of the log instead of the twelfth. Pass the same --frame-stride the run used; when the numbering cannot fit the scene, this says so instead of drawing something plausible.

Module Attributes

PREDICTION_COLOUR

Predictions, dodgerblue, the colour the still renderers give them.

TRUTH_COLOUR

Ground truth as this package filtered it, which is not always what the scene itself shows.

Functions

build_parser()

The py123det-view command line.

check_alignment(scenes, predictions)

Fail loudly when the frame numbering cannot be the one the predictions were written with.

frames_by_scene(path[, dataset])

A predictions file as scene uuid -> iteration -> frame, which is how a viewer reads it.

load_scenes(uuids[, data_root, splits, ...])

The 123D logs a predictions file refers to, built the way the evaluation built them.

main([argv])

Classes

PredictionViewer(scenes, predictions[, ...])

py123d's viewer with one element added.

PredictionsElement(frames, origin[, ...])

One scene's predictions, drawn as wireframes over whatever else the viewer shows.

py123d_detection.torch.visualize.viewer.PREDICTION_COLOUR = (30, 144, 255)

Predictions, dodgerblue, the colour the still renderers give them.

py123d_detection.torch.visualize.viewer.TRUTH_COLOUR = (255, 140, 0)

Ground truth as this package filtered it, which is not always what the scene itself shows. Darkorange, again as in the still renderers. The grey this used to be read as nothing against the viewer’s dark scene, so the overlay looked broken rather than empty.

class py123d_detection.torch.visualize.viewer.PredictionsElement(frames, origin, score_threshold=0.3, line_width=3.0, show_ground_truth=False)[source]

Bases: ViewerElement

One scene’s predictions, drawn as wireframes over whatever else the viewer shows.

Wireframes rather than solid boxes: py123d already draws the scene’s own detections as shaded meshes, and a second set of meshes would hide them. An outline reads as an overlay.

The frame’s own ground truth can be drawn too. It is not the same thing as the scene’s detections, which is the point of offering it: this is ground truth after the box filters the run was scored with, so a box the scene shows and this does not is a box the model was never charged for missing.

property name: str

Human-readable name used for the GUI folder.

create_gui(server)[source]

Create GUI controls inside the element’s own folder. Called once per scene load.

Return type:

None

update(iteration)[source]

Fetch data from SceneAPI and update viser scene handles. Called on every timestep change.

Return type:

None

remove()[source]

Remove all scene handles and clean up. Called before scene switch.

Return type:

None

on_dark_mode_changed(dark_mode)[source]

Called when the viewer’s dark mode setting changes. Override to adapt colors.

Return type:

None

class py123d_detection.torch.visualize.viewer.PredictionViewer(scenes, predictions, viser_config=None, score_threshold=0.3, show_ground_truth=False)[source]

Bases: ViserViewer

py123d’s viewer with one element added.

Subclassing rather than copying: _build_elements is the hook py123d provides for exactly this, so lidar, map, cameras, ground truth and playback remain py123d’s own and keep working as it changes them.

py123d_detection.torch.visualize.viewer.frames_by_scene(path, dataset=None)[source]

A predictions file as scene uuid -> iteration -> frame, which is how a viewer reads it.

Return type:

Dict[str, Dict[int, FramePrediction]]

py123d_detection.torch.visualize.viewer.load_scenes(uuids, data_root=None, splits=None, frame_stride=None, sample_rate_hz=None, max_scenes=None)[source]

The 123D logs a predictions file refers to, built the way the evaluation built them.

Goes through Source rather than assembling a SceneFilter here, so the scenes are resolved by the same code that resolved them for training and evaluation; only the uuid list is added on top.

Return type:

List

py123d_detection.torch.visualize.viewer.check_alignment(scenes, predictions)[source]

Fail loudly when the frame numbering cannot be the one the predictions were written with.

A prediction whose iteration is past the end of the scene is proof that the two disagree. The reverse, a stride that happens to leave enough frames, cannot be detected from the file, so this is a floor rather than a guarantee, and the error says which knob fixes it.

Return type:

None

py123d_detection.torch.visualize.viewer.build_parser()[source]

The py123det-view command line.

Return type:

ArgumentParser

py123d_detection.torch.visualize.viewer.main(argv=None)[source]
Return type:

int