Skip to content

Commit 2bf8563

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Fix doc of masks_to_boxes (#8798)
Reviewed By: vmoens Differential Revision: D68096272 fbshipit-source-id: 17f67701ded9b0f36c9c3c2c043cae6266588494
1 parent 1f2a98d commit 2bf8563

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

torchvision/ops/boxes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,13 @@ def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor:
404404
Compute the bounding boxes around the provided masks.
405405
406406
Returns a [N, 4] tensor containing bounding boxes. The boxes are in ``(x1, y1, x2, y2)`` format with
407-
``0 <= x1 < x2`` and ``0 <= y1 < y2``.
407+
``0 <= x1 <= x2`` and ``0 <= y1 <= y2``.
408+
409+
.. warning::
410+
411+
In most cases the output will guarantee ``x1 < x2`` and ``y1 < y2``. But
412+
if the input is degenerate, e.g. if a mask is a single row or a single
413+
column, then the output may have x1 = x2 or y1 = y2.
408414
409415
Args:
410416
masks (Tensor[N, H, W]): masks to transform where N is the number of masks

0 commit comments

Comments
 (0)