code: def distorted_bounding_box_crop(
      image_bytes,
      bbox,
      min_object_covered=0.1,
      aspect_ratio_range=(0.75, 1.33),
      area_range=(0.05, 1.0),
      max_attempts=100,
  ):
      """Generates cropped_image using one of the bboxes randomly distorted.
  
      See `tf.image.sample_distorted_bounding_box` for more documentation.
  
      Args:
        image_bytes: TF tensor; Binary image data.
        bbox: `Tensor; Bounding boxes arranged `[1, num_boxes, coords]` where each
          coordinate is [0, 1) and the coordinates are arranged as `[ymin, xmin,
          ymax, xmax]`. If num_boxes is 0 then use the whole image.
        min_object_covered: float; Defaults to `0.1`. The cropped area of the image
          must contain at least this fraction of any bounding box supplied.
        aspect_ratio_range: list[float]; The cropped area of the image must have an
          aspect ratio = width / height within this range.
        area_range: list[float]; The cropped area of the image must contain a
          fraction of the supplied image within in this range.
        max_attempts: int; Number of attempts at generating a cropped region of the
          image of the specified constraints. After `max_attempts` failures, return
          the entire image.
  
      Returns:
        Cropped image TF Tensor.
      """
      shape = tf.image.extract_jpeg_shape(image_bytes)
      sample_distorted_bounding_box = (
          tf.image.sample_distorted_bounding_box(
              shape,
              bounding_boxes=bbox,
              min_object_covered=min_object_covered,
              aspect_ratio_range=aspect_ratio_range,
              area_range=area_range,
              max_attempts=max_attempts,
              use_image_if_no_bounding_boxes=True,
          )
      )
      bbox_begin, bbox_size, _ = sample_distorted_bounding_box
  
      # Crop the image to the specified bounding box.
      offset_y, offset_x, _ = tf.unstack(bbox_begin)
      target_height, target_width, _ = tf.unstack(bbox_size)
      crop_window = tf.stack(
          [offset_y, offset_x, target_height, target_width]
      )
      image = tf.image.decode_and_crop_jpeg(
          image_bytes, crop_window, channels=3
      )
  
      return image
  
file_path: scenic/scenic/dataset_lib/imagenet_dataset.py
imports: import functools
  from typing import Optional
  from absl import logging
  from flax import jax_utils
  import jax
  import jax.numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 1 for calling a global function with example usage: distorted_bounding_box_crop(image_bytes, bbox, min_object_covered, aspect_ratio_range, area_range, max_attempts) and returns: image