Skip to content

Commit

Permalink
Update eps for coplanar check in 3D IoU
Browse files Browse the repository at this point in the history
Summary: Make eps=1e-4 by default for coplanar check and also enable it to be set by the user in call to `box3d_overlap`.

Reviewed By: gkioxari

Differential Revision: D31596836

fbshipit-source-id: b57fe603fd136cfa58fddf836922706d44fe894e
  • Loading branch information
nikhilaravi authored and facebook-github-bot committed Oct 13, 2021
1 parent 53d9967 commit 2f2466f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pytorch3d/ops/iou_box3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
]


def _check_coplanar(boxes: torch.Tensor, eps: float = 1e-5) -> None:
def _check_coplanar(boxes: torch.Tensor, eps: float = 1e-4) -> None:
faces = torch.tensor(_box_planes, dtype=torch.int64, device=boxes.device)
# pyre-fixme[16]: `boxes` has no attribute `index_select`.
verts = boxes.index_select(index=faces.view(-1), dim=1)
Expand Down Expand Up @@ -89,7 +89,7 @@ def backward(ctx, grad_vol, grad_iou):


def box3d_overlap(
boxes1: torch.Tensor, boxes2: torch.Tensor
boxes1: torch.Tensor, boxes2: torch.Tensor, eps: float = 1e-4
) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Computes the intersection of 3D boxes1 and boxes2.
Expand Down Expand Up @@ -136,8 +136,8 @@ def box3d_overlap(
if not all((8, 3) == box.shape[1:] for box in [boxes1, boxes2]):
raise ValueError("Each box in the batch must be of shape (8, 3)")

_check_coplanar(boxes1)
_check_coplanar(boxes2)
_check_coplanar(boxes1, eps)
_check_coplanar(boxes2, eps)

# pyre-fixme[16]: `_box3d_overlap` has no attribute `apply`.
vol, iou = _box3d_overlap.apply(boxes1, boxes2)
Expand Down

0 comments on commit 2f2466f

Please sign in to comment.