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