no default_to_square and max_size passed [self.resize(image=image, size=self.size, resample=self.resample) for image in images]
### System Info

ubantu 20.04 cuda 11.6 cudnn8.8 transformer 4.24.0



### Who can help?

@amyeroberts @sgugger @vanpelt 

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

   if self.do_resize and self.size is not None:
            images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]

the parameters  default_to_square and max_size of self.resize( ) function in feature_extraction_vit  can't be passed by preprocessor_config.json file,i don't want to use the default resize ways, how to modify the config file or code. 

the content of preprocessor_config is as follows:

{
  "do_normalize": true,
  "do_resize": true,
  "feature_extractor_type": "ViTFeatureExtractor",
  "image_mean": [
    0.5,
    0.5,
    0.5
  ],
  "image_std": [
    0.5,
    0.5,
    0.5
  ],
  "resample": 2,
  "size": 384,
  "default_to_square": false,
  "max_size": 384

}


### Expected behavior

   if self.do_resize and self.size is not None:
            images = [self.resize(image=image, size=self.size, resample=self.resample) for image in images]

the parameters  default_to_square and max_size of self.resize( ) function in feature_extraction_vit  can't be passed by preprocessor_config.json file,i don't want to use the default resize ways, how to modify the config file or code. 

the content of preprocessor_config is as follows:

{
  "do_normalize": true,
  "do_resize": true,
  "feature_extractor_type": "ViTFeatureExtractor",
  "image_mean": [
    0.5,
    0.5,
    0.5
  ],
  "image_std": [
    0.5,
    0.5,
    0.5
  ],
  "resample": 2,
  "size": 384,
  "default_to_square": false,
  "max_size": 384

}

Hi @cqray1990, thanks for raising this issue.

So that we can be help, could you explain a bit more about the expected behaviour and what you're trying to do with the image processor? Do you have a checkpoint on the hub you could share? 

To change the resizing behaviour of the image processor, you can either modify the `size` parameter in the config file e.g.: 

```json
{
"do_normalize": true,
"do_resize": true,
"image_processor_type": "ViTImageProcessor",
"image_mean": [
0.5,
0.5,
0.5
],
"image_std": [
0.5,
0.5,
0.5
],
"resample": 2,
"size": {"height": 384, "width": 384},
}
```
note: the feature extractors for vision models have been deprecated in place of image processors. 

Pass it into the image processor when instantiating:
```
# Override size settings from a pretrained checkpoint
image_processor = ViTImageProcessor.from_pretrained(checkpoint, size={"height": 384, "width": 384})

# Create a new image processor, override the default size parameter
image_processor = ViTImageProcessor(size={"height": 384, "width": 384})
```

Or keep the default behaviour and modify just when processing
```
image_processor = ViTImageProcessor()

# default behaviour - images are resized to 224x224
pixel_values = image_processor(image).pixel_values

# Override default - images resized to 384x384
pixel_values = image_processor(image, size={"height": 384, "width": 384}).pixel_values
```



<|||||>> Hi @cqray1990, thanks for raising this issue.
> 
> So that we can be help, could you explain a bit more about the expected behaviour and what you're trying to do with the image processor? Do you have a checkpoint on the hub you could share?
> 
> To change the resizing behaviour of the image processor, you can either modify the `size` parameter in the config file e.g.:
> 
> ```json
> {
> "do_normalize": true,
> "do_resize": true,
> "image_processor_type": "ViTImageProcessor",
> "image_mean": [
> 0.5,
> 0.5,
> 0.5
> ],
> "image_std": [
> 0.5,
> 0.5,
> 0.5
> ],
> "resample": 2,
> "size": {"height": 384, "width": 384},
> }
> ```
> 
> note: the feature extractors for vision models have been deprecated in place of image processors.
> 
> Pass it into the image processor when instantiating:
> 
> ```
> # Override size settings from a pretrained checkpoint
> image_processor = ViTImageProcessor.from_pretrained(checkpoint, size={"height": 384, "width": 384})
> 
> # Create a new image processor, override the default size parameter
> image_processor = ViTImageProcessor(size={"height": 384, "width": 384})
> ```
> 
> Or keep the default behaviour and modify just when processing
> 
> ```
> image_processor = ViTImageProcessor()
> 
> # default behaviour - images are resized to 224x224
> pixel_values = image_processor(image).pixel_values
> 
> # Override default - images resized to 384x384
> pixel_values = image_processor(image, size={"height": 384, "width": 384}).pixel_values
> ```

@amyeroberts 
the ViTImageProcessor ways to preprocess the image is only rdirectly resize to size={"height": 384, "width": 384},don't inlucde padding, old version 2.24.- have this operation,but the parameters  default_to_square and max_size of self.resize( ) function i can't be passes ,cause i need padding<|||||>@cqray1990 The image processors are written to be aligned with the model's preprocessing from its paper, so they won't all perform the same operations. 

Could you share the checkpoint being used? ViT's feature extractor / image processor has never padded the images. [This is the class in v4.24](https://github.com/huggingface/transformers/blob/94b3f544a1f5e04b78d87a2ae32a7ac252e22e31/src/transformers/models/vit/feature_extraction_vit.py). I don't believe the values of `default_to_square` have ever been used by these classes if in the config. `default_to_square` controls the behaviour of how the output image size is calculated and is model specific. `max_size` is a deprecated argument and also hasn't ever been used by the vit image processor. 

If there's a specific set of transformations you wish to perform with the input images, I suggest [looking through the different model image processors](https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+path%3Asrc%2Ftransformers%2Fmodels%2F**%2Fimage_processing_*.py+ImageProcessor%28BaseImageProcessor%29&type=code), and finding one which suits your needs, or writing your own custom one. If padding is needed, you can search for [image processors that use the `do_pad` flag](https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+path%3Asrc%2Ftransformers%2Fmodels%2F**%2Fimage_processing_*.py+do_pad&type=code).

<|||||>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/main/CONTRIBUTING.md) are likely to be ignored.