Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion torchvision/ops/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,13 @@ def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor:
Compute the bounding boxes around the provided masks.

Returns a [N, 4] tensor containing bounding boxes. The boxes are in ``(x1, y1, x2, y2)`` format with
``0 <= x1 < x2`` and ``0 <= y1 < y2``.
``0 <= x1 <= x2`` and ``0 <= y1 <= y2``.

.. warning::

In most cases the output will guarantee ``x1 < x2`` and ``y1 < y2``. But
if the input is degenerate, e.g. if a mask is a single row or a single
column, then the output may have x1 = x2 or y1 = y2.

Args:
masks (Tensor[N, H, W]): masks to transform where N is the number of masks
Expand Down
Loading