clip_boxes_to_image¶
- torchvision.ops.clip_boxes_to_image(boxes: Tensor, size: tuple[int, int]) Tensor[原始碼]¶
將邊界框剪輯到大小為
size的影像內。注意
對於剪輯
BoundingBoxes物件,請考慮使用變換ClampBoundingBoxes()代替。- 引數:
boxes (Tensor[..., 4]) – 格式為
(x1, y1, x2, y2)的邊界框,其中0 <= x1 < x2和0 <= y1 < y2。size (Tuple[height, width]) – 影像的大小
- 返回:
剪輯後的邊界框
- 返回型別:
Tensor[…, 4]