class_docstr: Take a random crop from the image.
  
  First the image or crop size may need to be adjusted if the incoming image
  is too small...
  
  If the image is smaller than the crop, then:
       the image is padded up to the size of the crop
       unless 'nopad', in which case the crop size is shrunk to fit the image
  
  A random crop is taken such that the crop fits within the image.
  
  
  if cfg.DATASET.TRANSLATION_AUG_FIX is set, we insure that there's always
  translation randomness of at least that value around the image.
  
  if image < crop_size:
      # slide crop within image, random offset
  else:
      # slide image within crop
class_docstr_tok: ["Take","a","random","crop","from","the","image",".","First","the","image","or","crop","size","may","need","to","be","adjusted","if","the","incoming","image","is","too","small","...","If","the","image","is","smaller","than","the","crop",",","then",":","the","image","is","padded","up","to","the","size","of","the","crop","unless","'nopad","'",",","in","which","case","the","crop","size","is","shrunk","to","fit","the","image","A","random","crop","is","taken","such","that","the","crop","fits","within","the","image",".","if","cfg.DATASET.TRANSLATION_AUG_FIX","is","set",",","we","insure","that","there","'s","always","translation","randomness","of","at","least","that","value","around","the","image",".","if","image","<","crop_size",":","#","slide","crop","within","image",",","random","offset","else",":","#","slide","image","within","crop"]
code: def __init__(self, crop_size):
      args = get_args()
      self.size = crop_size
      self.cat_max_ratio = 0.75
      self.ignore_index = args.ignore_index
      self.pad_color = (0, 0, 0)
  
imports: import random
  import os
  import math
  import mmcv
  import torch
  import numpy
  import torchvision.transforms
  from torchvision import datasets
  from torch.utils.data import Dataset
  from megatron import print_rank_0
  from megatron import get_args
  from PIL import Image, ImageOps, ImageEnhance
  import torchvision.transforms
label_desc: Use image node_id 1 to create a new RandomCrop object from inherited base classes: object with example: obj = RandomCrop(crop_size)