box_convert¶
- torchvision.ops.box_convert(boxes: Tensor, in_fmt: str, out_fmt: str) Tensor [源代码]¶
将
torch.Tensor
框从给定的in_fmt
格式转换为out_fmt
格式。注意
对于在不同格式之间转换
torch.Tensor
或BoundingBoxes
对象,请考虑改用convert_bounding_box_format()
。或参阅相应的转换函数ConvertBoundingBoxFormat()
。支持的
in_fmt
和out_fmt
字符串包括'xyxy'
: 框由角点表示,x1、y1 是左上角,x2、y2 是右下角。这是 torchvision 工具函数期望的格式。'xywh'
: 框由角点、宽度和高度表示,x1、y2 是左上角,w、h 是宽度和高度。'cxcywh'
: 框由中心点、宽度和高度表示,cx、cy 是框的中心,w、h 是宽度和高度。