py123d_detection.torch.visualize.boxes

Box corners, and the edges that join them.

Both renderers need the same thing from a box, where its eight corners are, so the geometry lives here once rather than in each of them. Pure numpy: no torch, no matplotlib, no py123d, which is what makes it cheap to test exhaustively.

Module Attributes

YAW

Columns of a box: [x, y, z, w, l, h, yaw, vx, vy]; only the first seven are needed here.

EDGES

The twelve edges of a box, as index pairs into corners()' output.

Functions

corners(boxes)

(N, 7+) boxes as (N, 8, 3) corners, in the frame the boxes are given in.

footprints(boxes)

(N, 4, 2) ground-plane outlines, for a bird's-eye view.

to_ego(boxes, ego_pose)

Global-frame boxes back into the ego frame, so a view can be drawn vehicle-forward.

py123d_detection.torch.visualize.boxes.YAW = 6

Columns of a box: [x, y, z, w, l, h, yaw, vx, vy]; only the first seven are needed here.

py123d_detection.torch.visualize.boxes.EDGES = ((0, 1), (1, 2), (2, 3), (3, 0), (4, 5), (5, 6), (6, 7), (7, 4), (0, 4), (1, 5), (2, 6), (3, 7))

The twelve edges of a box, as index pairs into corners()’ output. Bottom face, top face, then the four uprights.

py123d_detection.torch.visualize.boxes.corners(boxes)[source]

(N, 7+) boxes as (N, 8, 3) corners, in the frame the boxes are given in.

Corners 0-3 are the bottom face and 4-7 the top, each going round in the same direction, so EDGES joins them without a special case. w spans y and l spans x, matching the layout the dataset and the metric both use.

Return type:

ndarray

py123d_detection.torch.visualize.boxes.footprints(boxes)[source]

(N, 4, 2) ground-plane outlines, for a bird’s-eye view.

Return type:

ndarray

py123d_detection.torch.visualize.boxes.to_ego(boxes, ego_pose)[source]

Global-frame boxes back into the ego frame, so a view can be drawn vehicle-forward.

The inverse of the conversion py123d_detection.torch.evaluate applies on the way out. Without it a bird’s-eye view is aligned to global north, which is readable but tells you nothing about where the vehicle was pointing.

Return type:

ndarray