class_docstr: Cropping for SSD, according to original paper
  Choose between following 3 conditions:
  1. Preserve the original image
  2. Random crop minimum IoU is among 0.1, 0.3, 0.5, 0.7, 0.9
  3. Random crop
  Reference to https://github.com/chauhan-utk/src.DomainAdaptation
code: def __call__(self, img, img_size, bboxes, labels):
      # Ensure always return cropped image
      while True:
          mode = random.choice(self.sample_options)
  
          if mode is None:
              return img, img_size, bboxes, labels
  
          htot, wtot = img_size
  
          min_iou, max_iou = mode
          min_iou = float("-inf") if min_iou is None else min_iou
          max_iou = float("+inf") if max_iou is None else max_iou
  
          # Implementation use 50 iteration to find possible candidate
          for _ in range(1):
              # suze of each sampled path in [0.1, 1] 0.3*0.3 approx. 0.1
              w = random.uniform(0.3, 1.0)
              h = random.uniform(0.3, 1.0)
  
              if w / h < 0.5 or w / h > 2:
                  continue
  
              # left 0 ~ wtot - w, top 0 ~ htot - h
              left = random.uniform(0, 1.0 - w)
              top = random.uniform(0, 1.0 - h)
  
              right = left + w
              bottom = top + h
  
              ious = calc_iou_tensor(
                  bboxes, torch.tensor([[left, top, right, bottom]])
              )
  
              # tailor all the bboxes and return
              if not ((ious > min_iou) & (ious < max_iou)).all():
                  continue
  
              # discard any bboxes whose center not in the cropped image
              xc = 0.5 * (bboxes[:, 0] + bboxes[:, 2])
              yc = 0.5 * (bboxes[:, 1] + bboxes[:, 3])
  
              masks = (
                  (xc > left)
                  & (xc < right)
                  & (yc > top)
                  & (yc < bottom)
              )
  
              # if no such boxes, continue searching again
              if not masks.any():
                  continue
  
              bboxes[bboxes[:, 0] < left, 0] = left
              bboxes[bboxes[:, 1] < top, 1] = top
              bboxes[bboxes[:, 2] > right, 2] = right
              bboxes[bboxes[:, 3] > bottom, 3] = bottom
  
              # print(left, top, right, bottom)
              # print(labels, bboxes, masks)
              bboxes = bboxes[masks, :]
              labels = labels[masks]
  
              left_idx = int(left * wtot)
              top_idx = int(top * htot)
              right_idx = int(right * wtot)
              bottom_idx = int(bottom * htot)
              # print(left_idx,top_idx,right_idx,bottom_idx)
              # img = img[:, top_idx:bottom_idx, left_idx:right_idx]
              img = img.crop((left_idx, top_idx, right_idx, bottom_idx))
  
              bboxes[:, 0] = (bboxes[:, 0] - left) / w
              bboxes[:, 1] = (bboxes[:, 1] - top) / h
              bboxes[:, 2] = (bboxes[:, 2] - left) / w
              bboxes[:, 3] = (bboxes[:, 3] - top) / h
  
              htot = bottom_idx - top_idx
              wtot = right_idx - left_idx
              return img, (htot, wtot), bboxes, labels
  
imports: import torch
  import torchvision.transforms
  import torch.utils.data
  from PIL import Image
  import os
  import numpy
  import random
  import itertools
  import torch.nn.functional
  import json
  import time
  import bz2
  import pickle
  from math import sqrt
label_desc: Use image node_id 2 for calling the SSDCropping obj's underlying member method code with example usage: obj.__call__(img, img_size, bboxes, labels) and returns: img,  img_size,  bboxes,  labels, img,  htot,  wtot,  bboxes,  labels