box_convert¶
- torchvision.ops.box_convert(boxes: Tensor, in_fmt: str, out_fmt: str) Tensor[source]¶
Converts
torch.Tensorboxes from a givenin_fmttoout_fmt.Note
For converting a
torch.Tensoror aBoundingBoxesobject between different formats, consider usingconvert_bounding_box_format()instead. Or see the corresponding transformConvertBoundingBoxFormat().Supported
in_fmtandout_fmtstrings are:'xyxy': boxes are represented via corners, x1, y1 being top left and x2, y2 being bottom right. This is the format that torchvision utilities expect.'xywh': boxes are represented via corner, width and height, x1, y2 being top left, w, h being width and height.'cxcywh': boxes are represented via centre, width and height, cx, cy being center of box, w, h being width and height.- Parameters:
- Returns:
Boxes into converted format.
- Return type:
Tensor[N, 4]