class_docstr: Wraps an OWL-ViT FLAX model for convenient inference.
  
  All public methods apply to a single example and take and return Numpy arrays.
  
  Attributes:
    config: ConfigDict with model configuration.
    module: OWL-ViT Flax module.
    variables: Variable dict to be used with module.apply.
docstr: Preprocesses a uint8 image to the format required by the model.
docstr_tok: ["Preprocesses","a","uint8","image","to","the","format","required","by","the","model","."]
code: def preprocess_image(self, image: np.ndarray) -> np.ndarray:
      """Preprocesses a uint8 image to the format required by the model."""
      if image.dtype != np.uint8:
          raise ValueError(f"Image should be uint8, got {image.dtype}")
      image = image.astype(np.float32) / 255.0
  
      # Pad to square with gray pixels on bottom and right:
      h, w, _ = image.shape
      size = max(h, w)
      image_padded = np.pad(
          image,
          ((0, size - h), (0, size - w), (0, 0)),
          constant_values=0.5,
      )
  
      # Resize to model input size:
      return skimage_transform.resize(
          image_padded,
          (
              self.config.dataset_configs.input_size,
              self.config.dataset_configs.input_size,
          ),
          anti_aliasing=True,
      )
  
imports: import dataclasses
  import functools
  from typing import Any, Dict, Tuple
  from flax import linen
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.base_models import box_utils
  from scenic.projects.owl_vit.notebooks import numpy_cache
  from scipy import special
  from skimage import transform
  import tensorflow
label_desc: Use image node_id 4 for calling the Model obj's underlying member method code with example usage: obj.preprocess_image(image) and returns: skimage_transform