Skip to content

Commit 2f2466f

Browse files
nikhilaravifacebook-github-bot
authored andcommitted
Update eps for coplanar check in 3D IoU
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
1 parent 53d9967 commit 2f2466f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pytorch3d/ops/iou_box3d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
]
4646

4747

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

9090

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

139-
_check_coplanar(boxes1)
140-
_check_coplanar(boxes2)
139+
_check_coplanar(boxes1, eps)
140+
_check_coplanar(boxes2, eps)
141141

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

0 commit comments

Comments
 (0)