py123detection.annotations

Per-frame 3D annotations in mmdetection3d’s nuScenes layout.

123D stores boxes in the global frame, mmdet3d wants them in the keyframe’s lidar frame: gt_boxes (N, 7) as [x, y, z, l, w, h, yaw] around the box center (mmdet3d moves the origin to the bottom face at load time) and gt_velocity (N, 2).

Module Attributes

BOX_LAYOUTS

"streampetr": [x, y, z, l, w, h, yaw], written and read by StreamPETR and mmdetection3d >= 1.0.

Functions

build_frame_annotations(records, global_to_lidar)

Move global-frame records into the lidar frame and build the mmdet3d arrays.

extract_detection_records(detections, taxonomy)

Map 123D detections onto taxonomy classes, dropping unmapped ones.

Classes

DetectionRecord(class_name, label_id, ...)

One annotated object, in the global frame.

FrameAnnotations(gt_boxes, gt_names, ...)

The 3D annotation block of one info, in the lidar frame.

py123detection.annotations.BOX_LAYOUTS = ('streampetr', 'mmdet3d_0.17')

“streampetr”: [x, y, z, l, w, h, yaw], written and read by StreamPETR and mmdetection3d >= 1.0. “mmdet3d_0.17”: [x, y, z, w, l, h, -yaw - pi/2], written by mmdetection3d 0.17’s nuScenes converter and fed verbatim into LiDARInstance3DBoxes by its dataset (PETR v1 pins 0.17).

class py123detection.annotations.DetectionRecord(class_name, label_id, center_global, rotation_global, size_lwh, velocity_global, num_lidar_points, track_token, corners_global)[source]

Bases: object

One annotated object, in the global frame.

class_name: str
label_id: int
center_global: ndarray
rotation_global: ndarray
size_lwh: ndarray
velocity_global: ndarray
num_lidar_points: int
track_token: str
corners_global: ndarray
class py123detection.annotations.FrameAnnotations(gt_boxes, gt_names, gt_velocity, num_lidar_pts, num_radar_pts, valid_flag, track_tokens, records)[source]

Bases: object

The 3D annotation block of one info, in the lidar frame.

gt_boxes: ndarray
gt_names: ndarray
gt_velocity: ndarray
num_lidar_pts: ndarray
num_radar_pts: ndarray
valid_flag: ndarray
track_tokens: List[str]
records: List[DetectionRecord]
py123detection.annotations.extract_detection_records(detections, taxonomy, velocity_overrides=None)[source]

Map 123D detections onto taxonomy classes, dropping unmapped ones.

Parameters:

velocity_overrides (Optional[Mapping[str, ndarray]]) – Global-frame velocities by track token (see py123detection.velocity.TrackVelocityTable). Tracks not in it keep the stored velocity.

Return type:

List[DetectionRecord]

py123detection.annotations.build_frame_annotations(records, global_to_lidar, yaw_convention='mmdet3d', planar_velocity=True, box_layout='streampetr')[source]

Move global-frame records into the lidar frame and build the mmdet3d arrays.

Parameters:
Return type:

FrameAnnotations