Inconsistency in DETR preprocessing step
Author: ksmdnl
Pull request: no
Labels: name: bug

### System Info

I would like to point out an inconsistency. First I'd like to lay down some things I understood in the preprocessing steps.
- By default DETR preprocessing takes bounding boxes in COCO format, i.e. `xywh`, where x, y, w, h represent the top left, the width and the height of each box respectively.
- By default  `do_convert_annotation` is set to `True`. According to the docs this does the following

   > Whether to convert the annotations to the format expected by the model. Converts the bounding
                boxes from the format `(top_left_x, top_left_y, width, height)` to `(center_x, center_y, width, height)`
                and in relative coordinates.
-  which makes sense since we want it to be consistent with the output of the model which is in `cxcywh`.
- However, it isn't implemented as documented. See the function [normalize_annotation](https://github.com/huggingface/transformers/blob/33868a057c02f0368ba63bd1edb746be38fe3d90/src/transformers/models/detr/image_processing_detr.py#L1068) or snippet below.
```
def normalize_annotation(self, annotation: Dict, image_size: Tuple[int, int]) -> Dict:
    """
    Normalize the boxes in the annotation from `[top_left_x, top_left_y, bottom_right_x, bottom_right_y]` to
    `[center_x, center_y, width, height]` format and from absolute to relative pixel values.
    """
    return normalize_annotation(annotation, image_size=image_size)
...
...
def normalize_annotation(annotation: Dict, image_size: Tuple[int, int]) -> Dict:
    image_height, image_width = image_size
    norm_annotation = {}
    for key, value in annotation.items():
        if key == "boxes":
            boxes = value
            boxes = corners_to_center_format(boxes)
            boxes /= np.asarray([image_width, image_height, image_width, image_height], dtype=np.float32)
            norm_annotation[key] = boxes
        else:
            norm_annotation[key] = value
    return norm_annotation
...
...
...
def corners_to_center_format(bboxes_corners: TensorType) -> TensorType:
    """
    Converts bounding boxes from corners format to center format.

    corners format: contains the coordinates for the top-left and bottom-right corners of the box
        (top_left_x, top_left_y, bottom_right_x, bottom_right_y)
    center format: contains the coordinate for the center of the box and its the width, height dimensions
        (center_x, center_y, width, height)
    """
    # Inverse function accepts different input types so implemented here too
    if is_torch_tensor(bboxes_corners):
        return _corners_to_center_format_torch(bboxes_corners)
    elif isinstance(bboxes_corners, np.ndarray):
        return _corners_to_center_format_numpy(bboxes_corners)
    elif is_tf_tensor(bboxes_corners):
        return _corners_to_center_format_tf(bboxes_corners)

    raise ValueError(f"Unsupported input type {type(bboxes_corners)}")
```
Is this the expected behaviour and if yes could you elaborate why that's so?
Thanks in advance and looking forward for a discussion!

### Who can help?

@amyeroberts @qubvel @stevhliu 

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

```
def normalize_annotation(self, annotation: Dict, image_size: Tuple[int, int]) -> Dict:
    """
    Normalize the boxes in the annotation from `[top_left_x, top_left_y, bottom_right_x, bottom_right_y]` to
    `[center_x, center_y, width, height]` format and from absolute to relative pixel values.
    """
    return normalize_annotation(annotation, image_size=image_size)
...
...
def normalize_annotation(annotation: Dict, image_size: Tuple[int, int]) -> Dict:
    image_height, image_width = image_size
    norm_annotation = {}
    for key, value in annotation.items():
        if key == "boxes":
            boxes = value
            boxes = corners_to_center_format(boxes)
            boxes /= np.asarray([image_width, image_height, image_width, image_height], dtype=np.float32)
            norm_annotation[key] = boxes
        else:
            norm_annotation[key] = value
    return norm_annotation
...
...
...
def corners_to_center_format(bboxes_corners: TensorType) -> TensorType:
    """
    Converts bounding boxes from corners format to center format.

    corners format: contains the coordinates for the top-left and bottom-right corners of the box
        (top_left_x, top_left_y, bottom_right_x, bottom_right_y)
    center format: contains the coordinate for the center of the box and its the width, height dimensions
        (center_x, center_y, width, height)
    """
    # Inverse function accepts different input types so implemented here too
    if is_torch_tensor(bboxes_corners):
        return _corners_to_center_format_torch(bboxes_corners)
    elif isinstance(bboxes_corners, np.ndarray):
        return _corners_to_center_format_numpy(bboxes_corners)
    elif is_tf_tensor(bboxes_corners):
        return _corners_to_center_format_tf(bboxes_corners)

    raise ValueError(f"Unsupported input type {type(bboxes_corners)}")
```

### Expected behavior

We would expect the function to transform the bounding boxes in COCO format, i.e. `xywh` instead of `xyxy` as in the current implementation, and output them in centered format.

Comments:
It appears that I have missed one preprocessing step, where the boxes are converted to `xyxy` in the preceding step which leads to my confusion. I think my confusion is thus cleared up for now:)