def box_xyxy_to_cxcywh(x: "torch.Tensor"):
    """
    From DETR source: https://github.com/facebookresearch/detr
    (detr/util/box_ops.py)
    """

    x_0, y_0, x_1, y_1 = x.unbind(-1)
    box = [(x_0 + x_1) / 2, (y_0 + y_1) / 2, (x_1 - x_0), (y_1 - y_0)]
    return torch.stack(box, dim=-1)

    From DETR source: https://github.com/facebookresearch/detr
    (detr/util/box_ops.py)
    
art/estimators/object_detection/detr.py