- torchvision.ops.masks_to_boxes(masks: Tensor) 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 < x2and
0 <= y1 < y2.
masks (Tensor[N, H, W]) – masks to transform where N is the number of masks and (H, W) are the spatial dimensions.
- Return type:
masks_to_boxes:Repurposing masks into bounding boxes