box_convert¶
- torchvision.ops.box_convert(boxes: Tensor, in_fmt: str, out_fmt: str) Tensor[source]¶
将
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 是宽度和高度。