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 是宽度和高度。