class_docstr: Constructs a BridgeTower image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
          `do_resize` parameter in the `preprocess` method.
      size (`Dict[str, int]` *optional*, defaults to 288):
          Resize the shorter side of the input to `size["shortest_edge"]`. The longer side will be limited to under
          `int((1333 / 800) * size["shortest_edge"])` while preserving the aspect ratio. Only has an effect if
          `do_resize` is set to `True`. Can be overridden by the `size` parameter in the `preprocess` method.
      size_divisor (`int`, *optional*, defaults to 32):
          The size by which to make sure both the height and width can be divided. Only has an effect if `do_resize`
          is set to `True`. Can be overridden by the `size_divisor` parameter in the `preprocess` method.
      resample (`PILImageResampling`, *optional*, defaults to `Resampling.BICUBIC`):
          Resampling filter to use if resizing the image. Only has an effect if `do_resize` is set to `True`. Can be
          overridden by the `resample` parameter in the `preprocess` method.
      do_rescale (`bool`, *optional*, defaults to `True`):
          Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the `do_rescale`
          parameter in the `preprocess` method.
      rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
          Scale factor to use if rescaling the image. Only has an effect if `do_rescale` is set to `True`. Can be
          overridden by the `rescale_factor` parameter in the `preprocess` method.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether to normalize the image. Can be overridden by the `do_normalize` parameter in the `preprocess`
          method. Can be overridden by the `do_normalize` parameter in the `preprocess` method.
      image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_MEAN`):
          Mean to use if normalizing the image. This is a float or list of floats the length of the number of
          channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method. Can be
          overridden by the `image_mean` parameter in the `preprocess` method.
      image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_STD`):
          Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
          number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
          Can be overridden by the `image_std` parameter in the `preprocess` method.
      do_center_crop (`bool`, *optional*, defaults to `True`):
          Whether to center crop the image. Can be overridden by the `do_center_crop` parameter in the `preprocess`
          method.
      do_pad (`bool`, *optional*, defaults to `True`):
          Whether to pad the image to the `(max_height, max_width)` of the images in the batch. Can be overridden by
          the `do_pad` parameter in the `preprocess` method.
class_docstr_tok: ["Constructs","a","BridgeTower","image","processor",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","the","specified","`","size","`",".","Can","be","overridden","by","the","`","do_resize","`","parameter","in","the","`","preprocess","`","method",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","288",")",":","Resize","the","shorter","side","of","the","input","to","`","size","[","``","shortest_edge","''","]","`",".","The","longer","side","will","be","limited","to","under","`","int","(","(","1333","\/","800",")","*","size","[","``","shortest_edge","''","]",")","`","while","preserving","the","aspect","ratio",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","Can","be","overridden","by","the","`","size","`","parameter","in","the","`","preprocess","`","method",".","size_divisor","(","`","int","`",",","*","optional","*",",","defaults","to","32",")",":","The","size","by","which","to","make","sure","both","the","height","and","width","can","be","divided",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","Can","be","overridden","by","the","`","size_divisor","`","parameter","in","the","`","preprocess","`","method",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","Resampling.BICUBIC","`",")",":","Resampling","filter","to","use","if","resizing","the","image",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","Can","be","overridden","by","the","`","resample","`","parameter","in","the","`","preprocess","`","method",".","do_rescale","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","rescale","the","image","by","the","specified","scale","`","rescale_factor","`",".","Can","be","overridden","by","the","`","do_rescale","`","parameter","in","the","`","preprocess","`","method",".","rescale_factor","(","`","int","`","or","`","float","`",",","*","optional","*",",","defaults","to","`","1\/255","`",")",":","Scale","factor","to","use","if","rescaling","the","image",".","Only","has","an","effect","if","`","do_rescale","`","is","set","to","`","True","`",".","Can","be","overridden","by","the","`","rescale_factor","`","parameter","in","the","`","preprocess","`","method",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","normalize","the","image",".","Can","be","overridden","by","the","`","do_normalize","`","parameter","in","the","`","preprocess","`","method",".","Can","be","overridden","by","the","`","do_normalize","`","parameter","in","the","`","preprocess","`","method",".","image_mean","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_STANDARD_MEAN","`",")",":","Mean","to","use","if","normalizing","the","image",".","This","is","a","float","or","list","of","floats","the","length","of","the","number","of","channels","in","the","image",".","Can","be","overridden","by","the","`","image_mean","`","parameter","in","the","`","preprocess","`","method",".","Can","be","overridden","by","the","`","image_mean","`","parameter","in","the","`","preprocess","`","method",".","image_std","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_STANDARD_STD","`",")",":","Standard","deviation","to","use","if","normalizing","the","image",".","This","is","a","float","or","list","of","floats","the","length","of","the","number","of","channels","in","the","image",".","Can","be","overridden","by","the","`","image_std","`","parameter","in","the","`","preprocess","`","method",".","Can","be","overridden","by","the","`","image_std","`","parameter","in","the","`","preprocess","`","method",".","do_center_crop","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","center","crop","the","image",".","Can","be","overridden","by","the","`","do_center_crop","`","parameter","in","the","`","preprocess","`","method",".","do_pad","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","pad","the","image","to","the","`","(","max_height",",","max_width",")","`","of","the","images","in","the","batch",".","Can","be","overridden","by","the","`","do_pad","`","parameter","in","the","`","preprocess","`","method","."]
code: def __init__(
      self,
      do_resize: bool = True,
      size: Dict[str, int] = 288,
      size_divisor: int = 32,
      resample: PILImageResampling = PILImageResampling.BICUBIC,
      do_rescale: bool = True,
      rescale_factor: Union[int, float] = 1 / 255,
      do_normalize: bool = True,
      image_mean: Optional[Union[float, List[float]]] = None,
      image_std: Optional[Union[float, List[float]]] = None,
      do_center_crop: bool = True,
      do_pad: bool = True,
      **kwargs,
  ) -> None:
      if "pad_and_return_pixel_mask" in kwargs:
          do_pad = kwargs.pop("pad_and_return_pixel_mask")
  
      super().__init__(**kwargs)
      size = size if size is not None else {"shortest_edge": 288}
      size = get_size_dict(size, default_to_square=False)
  
      self.do_resize = do_resize
      self.size = size
      self.size_divisor = size_divisor
      self.resample = resample
      self.do_rescale = do_rescale
      self.rescale_factor = rescale_factor
      self.do_normalize = do_normalize
      self.image_mean = (
          image_mean if image_mean is not None else OPENAI_CLIP_MEAN
      )
      self.image_std = (
          image_std if image_std is not None else OPENAI_CLIP_STD
      )
      self.do_pad = do_pad
      self.do_center_crop = do_center_crop
  
file_path: transformers/src/transformers/models/bridgetower/image_processing_bridgetower.py
imports: from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import PaddingMode, center_crop, pad, resize, to_channel_dimension_format
  from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_batched, is_scaled_image, to_numpy_array, valid_images
  from ...utils import TensorType, is_vision_available, logging
label_desc: Use image node_id 1 to create a new BridgeTowerImageProcessor object from inherited base classes: BaseImageProcessor with example: obj = BridgeTowerImageProcessor(do_resize, size, size_divisor, resample, do_rescale, rescale_factor, do_normalize, image_mean, image_std, do_center_crop, do_pad)