class_docstr: Constructs an OWL-ViT feature extractor.
  
  This feature extractor inherits from [`FeatureExtractionMixin`] which contains most of the main methods. Users
  should refer to this superclass for more information regarding those methods.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the shorter edge of the input to a certain `size`.
      size (`int` or `Tuple[int, int]`, *optional*, defaults to (768, 768)):
          The size to use for resizing the image. Only has an effect if `do_resize` is set to `True`. If `size` is a
          sequence like (h, w), output size will be matched to this. If `size` is an int, then image will be resized
          to (size, size).
      resample (`int`, *optional*, defaults to `PIL.Image.Resampling.BICUBIC`):
          An optional resampling filter. This can be one of `PIL.Image.Resampling.NEAREST`,
          `PIL.Image.Resampling.BOX`, `PIL.Image.Resampling.BILINEAR`, `PIL.Image.Resampling.HAMMING`,
          `PIL.Image.Resampling.BICUBIC` or `PIL.Image.Resampling.LANCZOS`. Only has an effect if `do_resize` is set
          to `True`.
      do_center_crop (`bool`, *optional*, defaults to `False`):
          Whether to crop the input at the center. If the input size is smaller than `crop_size` along any edge, the
          image is padded with 0's and then center cropped.
      crop_size (`int`, *optional*, defaults to 768):
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether or not to normalize the input with `image_mean` and `image_std`. Desired output size when applying
          center-cropping. Only has an effect if `do_center_crop` is set to `True`.
      image_mean (`List[int]`, *optional*, defaults to `[0.48145466, 0.4578275, 0.40821073]`):
          The sequence of means for each channel, to be used when normalizing images.
      image_std (`List[int]`, *optional*, defaults to `[0.26862954, 0.26130258, 0.27577711]`):
          The sequence of standard deviations for each channel, to be used when normalizing images.
docstr: Main method to prepare for the model one or several image(s).
  
  <Tip warning={true}>
  
  NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
  PIL images.
  
  </Tip>
  
  Args:
      images (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`):
          The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
          tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W) or (H, W, C),
          where C is a number of channels, H and W are image height and width.
  
      return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
          If set, will return tensors of a particular framework. Acceptable values are:
  
          - `'tf'`: Return TensorFlow `tf.constant` objects.
          - `'pt'`: Return PyTorch `torch.Tensor` objects.
          - `'np'`: Return NumPy `np.ndarray` objects.
          - `'jax'`: Return JAX `jnp.ndarray` objects.
  
  Returns:
      [`BatchFeature`]: A [`BatchFeature`] with the following fields:
  
      - **pixel_values** -- Pixel values to be fed to a model.
docstr_tok: ["Main","method","to","prepare","for","the","model","one","or","several","image","(","s",")",".","<","Tip","warning=","{","true","}",">","NumPy","arrays","and","PyTorch","tensors","are","converted","to","PIL","images","when","resizing",",","so","the","most","efficient","is","to","pass","PIL","images",".","<","\/Tip",">","Args",":","images","(","`","PIL.Image.Image","`",",","`","np.ndarray","`",",","`","torch.Tensor","`",",","`","List","[","PIL.Image.Image","]","`",",","`","List","[","np.ndarray","]","`",",","`","List","[","torch.Tensor","]","`",")",":","The","image","or","batch","of","images","to","be","prepared",".","Each","image","can","be","a","PIL","image",",","NumPy","array","or","PyTorch","tensor",".","In","case","of","a","NumPy","array\/PyTorch","tensor",",","each","image","should","be","of","shape","(","C",",","H",",","W",")","or","(","H",",","W",",","C",")",",","where","C","is","a","number","of","channels",",","H","and","W","are","image","height","and","width",".","return_tensors","(","`","str","`","or","[","`","~utils.TensorType","`","]",",","*","optional","*",",","defaults","to","`","'np","'","`",")",":","If","set",",","will","return","tensors","of","a","particular","framework",".","Acceptable","values","are",":","-","`","'tf","'","`",":","Return","TensorFlow","`","tf.constant","`","objects",".","-","`","'pt","'","`",":","Return","PyTorch","`","torch.Tensor","`","objects",".","-","`","'np","'","`",":","Return","NumPy","`","np.ndarray","`","objects",".","-","`","'jax","'","`",":","Return","JAX","`","jnp.ndarray","`","objects",".","Returns",":","[","`","BatchFeature","`","]",":","A","[","`","BatchFeature","`","]","with","the","following","fields",":","-","*","*","pixel_values","*","*","--","Pixel","values","to","be","fed","to","a","model","."]
code: def __call__(
      self,
      images: Union[
          Image.Image,
          np.ndarray,
          "torch.Tensor",
          List[Image.Image],
          List[np.ndarray],
          List["torch.Tensor"],  # noqa
      ],
      return_tensors: Optional[Union[str, TensorType]] = None,
      **kwargs,
  ) -> BatchFeature:
      """
      Main method to prepare for the model one or several image(s).
  
      <Tip warning={true}>
  
      NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
      PIL images.
  
      </Tip>
  
      Args:
          images (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`):
              The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
              tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W) or (H, W, C),
              where C is a number of channels, H and W are image height and width.
  
          return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
              If set, will return tensors of a particular framework. Acceptable values are:
  
              - `'tf'`: Return TensorFlow `tf.constant` objects.
              - `'pt'`: Return PyTorch `torch.Tensor` objects.
              - `'np'`: Return NumPy `np.ndarray` objects.
              - `'jax'`: Return JAX `jnp.ndarray` objects.
  
      Returns:
          [`BatchFeature`]: A [`BatchFeature`] with the following fields:
  
          - **pixel_values** -- Pixel values to be fed to a model.
      """
      # Input type checking for clearer error
      valid_images = False
  
      # Check that images has a valid type
      if isinstance(
          images, (Image.Image, np.ndarray)
      ) or is_torch_tensor(images):
          valid_images = True
      elif isinstance(images, (list, tuple)):
          if isinstance(
              images[0], (Image.Image, np.ndarray)
          ) or is_torch_tensor(images[0]):
              valid_images = True
  
      if not valid_images:
          raise ValueError(
              "Images must of type `PIL.Image.Image`, `np.ndarray` or `torch.Tensor` (single example), "
              "`List[PIL.Image.Image]`, `List[np.ndarray]` or `List[torch.Tensor]` (batch of examples)."
          )
  
      is_batched = bool(
          isinstance(images, (list, tuple))
          and (
              isinstance(images[0], (Image.Image, np.ndarray))
              or is_torch_tensor(images[0])
          )
      )
  
      if not is_batched:
          images = [images]
  
      # transformations (resizing + center cropping + normalization)
      if (
          self.do_resize
          and self.size is not None
          and self.resample is not None
      ):
          images = [
              self.resize(
                  image=image,
                  size=self.size,
                  resample=self.resample,
                  default_to_square=True,
              )
              for image in images
          ]
      if self.do_center_crop and self.crop_size is not None:
          images = [
              self.center_crop(image, self.crop_size)
              for image in images
          ]
      if self.do_normalize:
          images = [
              self.normalize(
                  image=image, mean=self.image_mean, std=self.image_std
              )
              for image in images
          ]
  
      # return as BatchFeature
      data = {"pixel_values": images}
      encoded_inputs = BatchFeature(
          data=data, tensor_type=return_tensors
      )
  
      return encoded_inputs
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/owlvit/feature_extraction_owlvit.py
imports: from typing import List, Optional, Union
  import numpy
  from PIL import Image
  from transformers.image_utils import PILImageResampling
  from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
  from ...image_utils import ImageFeatureExtractionMixin, is_torch_tensor
  from ...utils import TensorType, is_torch_available, logging
label_desc: Use image node_id 3 for calling the OwlViTFeatureExtractor obj's underlying member method code with example usage: obj.__call__(images, return_tensors) and returns: encoded_inputs