box_convert¶
- torchvision.ops.box_convert(boxes: Tensor, in_fmt: str, out_fmt: str) Tensor [源代码]¶
将给定
in_fmt
格式的torch.Tensor
边界框转换为out_fmt
格式。注意
要在不同格式之间转换
torch.Tensor
或BoundingBoxes
对象,请考虑使用convert_bounding_box_format()
。或者查看相应的变换ConvertBoundingBoxFormat()
。支持的
in_fmt
和out_fmt
字符串有:'xyxy'
: 边界框通过左上角 x1, y1 和右下角 x2, y2 表示。这是 torchvision 工具所期望的格式。'xywh'
: 边界框通过左上角 x1, y1、宽度 w 和高度 h 表示。'cxcywh'
: 边界框通过中心点 cx, cy、宽度 w 和高度 h 表示。'xywhr'
: 边界框通过左上角 x1, y1、宽度 w、高度 h 和旋转角度 r 表示。r 是相对于框中心,在图像平面上逆时针旋转的度数 \(|r|\)。'cxcywhr'
: 边界框通过中心点 cx, cy、宽度 w、高度 h 和旋转角度 r 表示。r 是相对于框中心,在图像平面上逆时针旋转的度数 \(|r|\)。'xyxyxyxy'
: 边界框通过四个顶点表示:左上角 x1, y1、右上角 x2, y2、右下角 x3, y3 和左下角 x4, y4。