Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unittest for cam_box3d fixed init #150

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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