Skip to content

Commit

Permalink
Add unittest for cam_box3d fixed init (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai-Wang authored Oct 7, 2020
1 parent 733df01 commit 42c55c2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_box3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,15 @@ def test_camera_boxes3d():
# the pytorch print loses some precision
assert torch.allclose(boxes.corners, expected_tensor, rtol=1e-4, atol=1e-7)

# test init with a given origin
boxes_origin_given = CameraInstance3DBoxes(
th_boxes.clone(), box_dim=7, origin=(0.5, 0.5, 0.5))
expected_tensor = th_boxes.clone()
expected_tensor[:, :3] = th_boxes[:, :3] + th_boxes[:, 3:6] * (
th_boxes.new_tensor((0.5, 1.0, 0.5)) - th_boxes.new_tensor(
(0.5, 0.5, 0.5)))
assert torch.allclose(boxes_origin_given.tensor, expected_tensor)


def test_boxes3d_overlaps():
"""Test the iou calculation of boxes in different modes.
Expand Down

0 comments on commit 42c55c2

Please sign in to comment.