clip_boxes_to_image¶
- torchvision.ops.clip_boxes_to_image(boxes: Tensor, size: Tuple[int, int]) Tensor [source]¶
裁剪框,使其位于尺寸为
size
的图像内。注意
对于裁剪
BoundingBoxes
对象,请考虑使用转换ClampBoundingBoxes()
代替。- 参数:
boxes (Tensor[N, 4]) –
(x1, y1, x2, y2)
格式的框,其中0 <= x1 < x2
且0 <= y1 < y2
。size (Tuple[height, width]) – 图像尺寸(高度,宽度)
- 返回:
裁剪后的框
- 返回类型:
Tensor[N, 4]