DetrFeatureExtractor fails if do_normalize set to false
Author: felixdittrich92
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.11.0
- Platform: Ubuntu 20.04
- Python version: Python 3.8.10
- PyTorch version (GPU?):  1.8.1
- Tensorflow version (GPU?): -
- Using GPU in script?: yes 
- Using distributed or parallel set-up in script?: yes (but same error on local machine CPU normal script)

### Who can help
@LysandreJik 
@NielsRogge 

## Information

Model I am using:
Detr with COCOText-v2 dataset for text detection

The problem arises when using:
* [x ] my own modified scripts:
```
    def __getitem__(self, index):
        image_id = self.image_ids[index]
        image_file = self.image_info[index]
        annotations = self.ann_info[index]
        image_path = os.path.join(self.image_folder_path, image_file[0]['file_name'])
        image = Image.open(image_path).convert("RGB")

        target = {'image_id': image_id[0], 'annotations': annotations}
        encoding = self.feature_extractor(images=image, annotations=target, return_tensors="pt")
        pixel_values = encoding["pixel_values"].squeeze() # remove batch dimension
        target = encoding["labels"][0] # remove batch dimension
        return pixel_values, target
```

## To reproduce

Steps to reproduce the behavior:

1.` feature_extractor = DetrFeatureExtractor(format="coco_detection", do_resize=False, do_normalize=False, image_mean=[0.485, 0.456, 0.406], image_std=[0.229, 0.224, 0.225])`
2. `encoding = self.feature_extractor(images=image, annotations=target, return_tensors="pt")`
3.


transformers lib: DetrFeatureExtractor class line 584
```
        if pad_and_return_pixel_mask:
            # pad images up to largest image in batch and create pixel_mask
            max_size = self._max_by_axis([list(image.shape) for image in images])
```
```
  File "/home/felix/Desktop/memoresa-work-ml/Task_CV/Lightning_OCR/1_text_scene_detector/detr/dataloader.py", line 102, in __getitem__
    encoding = self.feature_extractor(images=image, annotations=target, return_tensors="pt")
  File "/home/felix/anaconda3/envs/work/lib/python3.8/site-packages/transformers/models/detr/feature_extraction_detr.py", line 584, in __call__
    max_size = self._max_by_axis([list(image.shape) for image in images])
  File "/home/felix/anaconda3/envs/work/lib/python3.8/site-packages/transformers/models/detr/feature_extraction_detr.py", line 584, in <listcomp>
    max_size = self._max_by_axis([list(image.shape) for image in images])
  File "/home/felix/anaconda3/envs/work/lib/python3.8/site-packages/PIL/Image.py", line 546, in __getattr__
    raise AttributeError(name)
AttributeError: shape
```



## Expected behavior




Comments:
Thanks for reporting.

If you don't set `normalize` to `True`, then the images remain PIL images, i.e. they are not converted to Numpy arrays. If you then specify `pad_and_return_pixel_mask`, it cannot compute a shape.

I can add a check that converts the images to numpy arrays in any case. What's your use case for not normalizing the images? Do you already do this yourself?

@NielsRogge 
this would be great ! 

I do experiment currently with Detr for text detection and would check what i get back from my dataloader so in the normalize step the annotations ( targets ) would be also normalized which makes the reconstruction harder. 

So for example visualize/reconstruct some examples for test purpose with there bounding boxes before passing into the model.

I have also opened a thread about this use case if you have a bit time would be nice to get  your opinion :)
[Detr for text detection](https://discuss.huggingface.co/t/detection-transformer-detr-for-text-detection-in-documents/10396)

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.