Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry-pick for 0.21] Fix doc of masks_to_boxes (#8798) #8799

Merged
merged 1 commit into from
Dec 12, 2024
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