code: def __call__(self, img):
      # https://github.com/tensorflow/tensorflow/blob/9274bcebb31322370139467039034f8ff852b004/tensorflow/core/kernels/sample_distorted_bounding_box_op.cc#L111
      original_width, original_height = img.size
      min_area = self.area_range[0] * (original_width * original_height)
      max_area = self.area_range[1] * (original_width * original_height)
  
      for _ in range(self.max_attempts):
          aspect_ratio = random.uniform(*self.aspect_ratio_range)
          height = int(round(math.sqrt(min_area / aspect_ratio)))
          max_height = int(round(math.sqrt(max_area / aspect_ratio)))
  
          if max_height * aspect_ratio > original_width:
              max_height = (original_width + 0.5 - 1e-7) / aspect_ratio
              max_height = int(max_height)
              if max_height * aspect_ratio > original_width:
                  max_height -= 1
  
          if max_height > original_height:
              max_height = original_height
  
          if height >= max_height:
              height = max_height
  
          height = int(round(random.uniform(height, max_height)))
          width = int(round(height * aspect_ratio))
          area = width * height
  
          if area < min_area or area > max_area:
              continue
          if width > original_width or height > original_height:
              continue
          if area < self.min_covered * (
              original_width * original_height
          ):
              continue
          if width == original_width and height == original_height:
              return self._fallback(
                  img
              )  # https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/preprocessing.py#L102
  
          x = random.randint(0, original_width - width)
          y = random.randint(0, original_height - height)
          return img.crop((x, y, x + width, y + height))
  
      return self._fallback(img)
  
imports: import math
  import random
label_desc: Use image node_id 2 for calling the EfficientNetRandomCrop obj's underlying member method code with example usage: obj.__call__(img) and returns: self, img, self