Minor enhancement: Bounding box drawing of object detection should follow some edge cases. 
Author: Anindyadeep
Pull request: no

### System Info

```
- `transformers` version: 4.35.2
- Platform: Linux-5.15.120+-x86_64-with-glibc2.35
- Python version: 3.10.12
- Huggingface_hub version: 0.19.4
- Safetensors version: 0.4.1
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.1.0+cu118 (False)
- Tensorflow version (GPU?): 2.14.0 (False)
- Flax version (CPU?/GPU?/TPU?): 0.7.5 (cpu)
- Jax version: 0.4.20
- JaxLib version: 0.4.20
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No
```

### Who can help?

@stevhliu and @MKhalusova

### Information

- [X] The official example scripts
- [X] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

So, I was trying to do object detection using the [official example](https://huggingface.co/docs/transformers/tasks/object_detection). I was at the dataset exploration stage. There I was using some another dataset. For starting out, I simply copy pasted this part of the code:

```python
import numpy as np
import os
from PIL import Image, ImageDraw

image = cppe5["train"][0]["image"]
annotations = cppe5["train"][0]["objects"]
draw = ImageDraw.Draw(image)

categories = cppe5["train"].features["objects"].feature["category"].names

id2label = {index: x for index, x in enumerate(categories, start=0)}
label2id = {v: k for k, v in id2label.items()}

for i in range(len(annotations["id"])):
    box = annotations["bbox"][i]
    class_idx = annotations["category"][i]
    x, y, w, h = tuple(box)
    draw.rectangle((x, y, x + w, y + h), outline="red", width=1)
    draw.text((x, y), id2label[class_idx], fill="white")

image
```

This worked for `cppe-5` dataset. Here is an example of this dataset
```
cppe5["train"][0]
{'image_id': 15,
 'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=943x663 at 0x7F9EC9E77C10>,
 'width': 943,
 'height': 663,
 'objects': {'id': [114, 115, 116, 117],
  'area': [3796, 1596, 152768, 81002],
  'bbox': [[302.0, 109.0, 73.0, 52.0],
   [810.0, 100.0, 57.0, 28.0],
   [160.0, 31.0, 248.0, 616.0],
   [741.0, 68.0, 202.0, 401.0]],
  'category': [4, 4, 0, 0]}}
```

But, I was using a [different dataset](https://huggingface.co/datasets/kili-technology/plastic_in_river), with the following info:

```
'image': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=1280x720>,
 'litter': {'label': [2, 2],
  'bbox': [[0.6937950849533081,
    0.17073695361614227,
    0.017922647297382355,
    0.011738809756934643],
   [0.5574886202812195,
    0.18079878389835358,
    0.021695835515856743,
    0.010061836801469326]]}}
```

The simply copy-pasting the initial code will not draw the bounding box. So, a simple if-else check, of whether the box is normalized or not can make this code more robust and optimized and helps new-comer not to get blocked, when they are simply starting out and understanding by copy-pasting the code. 


### Expected behavior

The expected behaviour, should be the same for the sample dataset, when I swap out the dataset name with the new one and replace it's metadata. Here is a sample solution for this:


```python
image = cppe5["train"][0]["image"]
annotations = cppe5["train"][0]["objects"]
draw = ImageDraw.Draw(image)
width, height = image.size

categories = cppe5["train"].features["objects"].feature["category"].names

id2label = {index: x for index, x in enumerate(categories, start=0)}
label2id = {v: k for k, v in id2label.items()}

for i in range(len(annotations["id"])):
    box = annotations["bbox"][i]
    class_idx = annotations["category"][i]
    x, y, w, h = tuple(box)

    # Check if coordinates are normalized or not
    if max(box) > 1.0:
        # Coordinates are un-normalized, rescale them
        x1, y1 = int(x), int(y)
        x2, y2 = int(x + w), int(y + h)
    else:
        # Coordinates are normalized, scale them
        x1 = int(x * width)
        y1 = int(y * height)
        x2 = int((x + w) * width)
        y2 = int((y + h) * height)

    draw.rectangle((x1, y1, x2, y2), outline="red", width=1)
    draw.text((x1, y1), id2label[class_idx], fill="white")

image
```

This generates the same output. **

Let me know, I am open to fix this under a small PR. 

Comments:
Thanks for the suggestion, please feel free to open a PR :)