Open ChihaoZhang opened 8 months ago
Current code to transfer uses:-
AxisAlignedBoundingBox box(device);
box.SetMaxBound(max_bound_.To(device, true));
box.SetMinBound(min_bound_.To(device, true));
The problem is that default box has min bound and max bound set to 0. Setting max_bound fails since this is negative in your usecase.
Easy fix should be to change open3d code to
AxisAlignedBoundingBox box(min_bound_.To(device, true), max_bound_.To(device, true));
Will add a PR soon with unit tests.
@saurabheights Thanks for your reply and I agree with the fix code which should be a solution to my problem with the minimal change. However, for fixing the problems in AxisAlignedBoundingBox
existed for now, there are additional points I should remind you:
AxisAlignedBoundingBox
when it calls To()
method, there is no need to do data check once more.SetMinBound()
and SetMaxBound()
, which uses the preset value (i.e., 0s) together with input to compute the volume mistakenly. Since they are public methods and also bound to python interface, any calls with negative input will cause the warning and hence no value set. The fix should avoid volume check when only one bound is set.If the first point is my personal stance and can be ignored, the second point is worthy of attention. And my personal view on them is to combine the two into a single one considering a valid AxisAlignedBoundingBox
does need both min_bound
and max_bound
set explicitly.
Checklist
main
branch).Describe the issue
Hi, thanks for the excellent work you've done. Today, I found an unnecessary warning displayed when I try to move an instance of
AxisAlignedBoundingBox
from CPU to CUDA thoughmin_bound
is indeed smaller thanmax_bound
, which causes no values set to the returnedbbox
.After reviewing the source code (in
cpp/open3d/t/geometry/BoundingVolume.cpp
), I guess the reason is when callingTo()
method, it creates an instance on the specific device withmin_bound
as well asmax_bound
set to 0 first, thenSetMinBound()
andSetMaxBound()
will check ifmax_bound_
andmin_bound_
are valid before setting by comparing it with the initial value, i.e., 0 in this case.Since the only requirement for a bounding box specified by min/max bound is
min_bound
is less thanmax_bound
strictly and when an instance callsTo()
, it's already valid, I believe data checking inTo()
is redundant.Steps to reproduce the bug
Error message
[Open3D WARNING] Invalid axis-aligned bounding box. Please make sure all the elements in max bound are larger than min bound. [Open3D WARNING] Invalid axis-aligned bounding box. Please make sure all the elements in min bound are smaller than max bound. AxisAlignedBoundingBox[[0 0 0] - [0 0 0], Float32, CUDA:0]
Expected behavior
min_bound
andmax_bound
should be set successfully (without any warnings) tobbox
which is an instance ofAxisAlignedBoundingBox
stored in CUDA.Open3D, Python and System information
Additional information
This problem can be sidestepped by creating
min_bound
as well asmax_bound
in the desired device, then there is no need to callto()
method. But I do hope it can be solved in the source code.