clip_boxes_to_image¶
- torchvision.ops.clip_boxes_to_image(boxes: Tensor, size: Tuple[int, int]) Tensor [source]¶
Clip boxes so that they lie inside an image of size
size
.Note
For clipping a
BoundingBoxes
object, consider using the transformClampBoundingBoxes()
instead.- Parameters:
boxes (Tensor[N, 4]) – boxes in
(x1, y1, x2, y2)
format with0 <= x1 < x2
and0 <= y1 < y2
.size (Tuple[height, width]) – size of the image
- Returns:
clipped boxes
- Return type:
Tensor[N, 4]