facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.81k stars 1.32k forks source link

box3d_overlap gives wrong results for bounding boxes far away from coordinate system origin #1551

Open JennySeidenschwarz opened 1 year ago

JennySeidenschwarz commented 1 year ago

If you do not know the root cause of the problem / bug, and wish someone to help you, please post according to this template:

🐛 Bugs / Unexpected behaviors

Computing 3DIoU of bounding box with itself in city coordinate system of AV dataset gives wrong values.

Input bounding box a: [[-24931.9805, 40325.3438, -254.5391],
[-24931.1562, 40325.4336, -254.5391],
[-24931.3105, 40326.8789, -254.5391],
[-24932.1348, 40326.7891, -254.5391],
[-24931.9805, 40325.3438, -253.7584],
[-24931.1562, 40325.4336, -253.7584],
[-24931.3105, 40326.8789, -253.7584],
[-24932.1348, 40326.7891, -253.7584]]

--> Bounding box IoU with itself gives 0.5

Input bounding box b: [[-24946.6211, 40271.9648, -254.5117],
[-24946.5137, 40275.6836, -254.5117],
[-24948.3086, 40275.7344, -254.5117],
[-24948.4141, 40272.0195, -254.5117],
[-24946.6211, 40271.9648, -253.5219],
[-24946.5137, 40275.6836, -253.5219],
[-24948.3086, 40275.7344, -253.5219],
[-24948.4141, 40272.0195, -253.5219]]

--> Bounding box IoU with itself gives 2.0

Problem is solved if subtracting [-25000, 40300, -250]. Therefore, I guess it is a numerical instability. Problem can be solved by just subtracting maximum absolute values of all input bounding boxes, but of course more a quick and dirty solution :)