vis4d.vis.image.bbox3d_visualizer

Bounding box 3D visualizer.

Classes

BoundingBox3DVisualizer(*args[, n_colors, ...])

Bounding box 3D visualizer class.

DataSample(image, image_name, intrinsics, ...)

Dataclass storing a data sample that can be visualized.

DetectionBox3D(corners, label, color, track_id)

Dataclass storing box informations.

MultiCameraBBox3DVisualizer(*args, cameras, ...)

Bounding box 3D visualizer class for multi-camera datasets.

class BoundingBox3DVisualizer(*args, n_colors=50, cat_mapping=None, file_type='png', image_mode='RGB', width=2, camera_near_clip=0.15, axis_mode=AxisMode.ROS, trajectory_length=10, plot_trajectory=True, canvas=None, viewer=None, **kwargs)[source]

Bounding box 3D visualizer class.

Creates a new Visualizer for Image and 3D Bounding Boxes.

Parameters:
  • n_colors (int) – How many colors should be used for the internal color map. Defaults to 100.

  • cat_mapping (dict[str, int]) – Mapping from class names to class ids. Defaults to None.

  • file_type (str) – Desired file type. Defaults to “png”.

  • image_mode (str) – Image channel mode (RGB or BGR). Defaults to “RGB”.

  • width (int) – Width of the drawn bounding boxes. Defaults to 2.

  • camera_near_clip (float) – Near clipping plane of the camera. Defaults to 0.15.

  • axis_mode (AxisMode) – Axis mode for the input bboxes. Defaults to AxisMode.ROS (i.e. global coordinate).

  • trajectory_length (int) – How many past frames should be used to draw the trajectory. Defaults to 10.

  • plot_trajectory (bool) – If the trajectory should be plotted. Defaults to True.

  • canvas (CanvasBackend) – Backend that is used to draw on images. If None a PillowCanvasBackend is used.

  • viewer (ImageViewerBackend) – Backend that is used show images. If None a MatplotlibImageViewer is used.

process(cur_iter, images, image_names, boxes3d, intrinsics, extrinsics=None, scores=None, class_ids=None, track_ids=None, sequence_names=None)[source]

Processes a batch of data.

Parameters:
  • cur_iter (int) – Current iteration.

  • images (list[ArrayLike]) – Images to show.

  • image_names (list[str]) – Image names.

  • boxes3d (list[ArrayLikeFloat]) – List of predicted bounding boxes with shape [B, N, 10].

  • intrinsics (ArrayLikeFloat) – Camera intrinsics with shape [B, 3, 3].

  • extrinsics (None | ArrayLikeFloat, optional) – Camera extrinsics with shape [B, 4, 4]. Defaults to None.

  • scores (None | list[ArrayLikeFloat], optional) – List of predicted box scores each of shape [B, N]. Defaults to None.

  • class_ids (None | list[ArrayLikeInt], optional) – List of predicted class ids each of shape [B, N]. Defaults to None.

  • track_ids (None | list[ArrayLikeInt], optional) – List of predicted track ids each of shape [B, N]. Defaults to None.

  • sequence_names (None | list[str], optional) – List of sequence names of shape [B,]. Defaults to None.

Return type:

None

process_single_image(image, image_name, boxes3d, intrinsics, extrinsics=None, scores=None, class_ids=None, track_ids=None, sequence_name=None, camera_name=None)[source]

Processes a single image entry.

Parameters:
  • image (ArrayLike) – Image to show.

  • image_name (str) – Image name.

  • boxes3d (ArrayLikeFloat) – Predicted bounding boxes with shape [N, 10], where N is the number of boxes.

  • intrinsics (ArrayLikeFloat) – Camera intrinsics with shape [3, 3].

  • extrinsics (None | ArrayLikeFloat, optional) – Camera extrinsics with shape [4, 4]. Defaults to None.

  • scores (None | ArrayLikeFloat, optional) – Predicted box scores of shape [N]. Defaults to None.

  • class_ids (None | ArrayLikeInt, optional) – Predicted class ids of shape [N]. Defaults to None.

  • track_ids (None | ArrayLikeInt, optional) – Predicted track ids of shape [N]. Defaults to None.

  • sequence_name (None | str, optional) – Sequence name. Defaults to None.

  • camera_name (None | str, optional) – Camera name. Defaults to None.

Return type:

None

reset()[source]

Reset visualizer.

Return type:

None

save_to_disk(cur_iter, output_folder)[source]

Saves the visualization to disk.

Writes all processes samples to the output folder naming each image <sample.image_name>.<filetype>.

Parameters:
  • cur_iter (int) – Current iteration.

  • output_folder (str) – Folder where the output should be written.

Return type:

None

show(cur_iter, blocking=True)[source]

Shows the processed images in a interactive window.

Parameters:
  • cur_iter (int) – Current iteration.

  • blocking (bool) – If the visualizer should be blocking i.e. wait for human input for each image. Defaults to True.

Return type:

None

class DataSample(image, image_name, intrinsics, extrinsics, sequence_name, camera_name, boxes)[source]

Dataclass storing a data sample that can be visualized.

class DetectionBox3D(corners, label, color, track_id)[source]

Dataclass storing box informations.

class MultiCameraBBox3DVisualizer(*args, cameras, **kwargs)[source]

Bounding box 3D visualizer class for multi-camera datasets.

Creates a new Visualizer for Image and 3D Bounding Boxes.

Parameters:

cameras (Sequence[str]) – Camera names.

process(cur_iter, images, image_names, boxes3d, intrinsics, extrinsics=None, scores=None, class_ids=None, track_ids=None, sequence_names=None)[source]

Processes a batch of data.

Parameters:
  • cur_iter (int) – Current iteration.

  • images (list[ArrayLike]) – Images to show.

  • image_names (list[str]) – Image names.

  • boxes3d (list[ArrayLikeFloat]) – List of predicted bounding boxes with shape [B, N, 10].

  • intrinsics (ArrayLikeFloat) – Camera intrinsics with shape [num_cam, B, 3, 3].

  • extrinsics (None | ArrayLikeFloat, optional) – Camera extrinsics with shape [num_cam, B, 4, 4]. Defaults to None.

  • scores (None | list[ArrayLikeFloat], optional) – List of predicted box scores each of shape [B, N]. Defaults to None.

  • class_ids (None | list[ArrayLikeInt], optional) – List of predicted class ids each of shape [B, N]. Defaults to None.

  • track_ids (None | list[ArrayLikeInt], optional) – List of predicted track ids each of shape [B, N]. Defaults to None.

  • sequence_names (None | list[str], optional) – List of sequence names of shape [B,]. Defaults to None.

Return type:

None