def bbox_xy_to_wh()

in phosa/utils/bbox.py [0:0]


def bbox_xy_to_wh(bbox):
    if not isinstance(bbox, (tuple, list)):
        original_shape = bbox.shape
        bbox = bbox.reshape((-1, 4))
    else:
        original_shape = None
    bbox = BoxMode.convert(
        box=bbox, from_mode=BoxMode.XYXY_ABS, to_mode=BoxMode.XYWH_ABS
    )
    if original_shape is not None:
        return bbox.reshape(original_shape)
    return bbox