class_docstr: DataHandler generate augmented batches used for training or validation.
  
  Args:
      lr_dir: directory containing the Low Res images.
      hr_dir: directory containing the High Res images.
      patch_size: integer, size of the patches extracted from LR images.
      scale: integer, upscaling factor.
      n_validation_samples: integer, size of the validation set. Only provided if the
          DataHandler is used to generate validation sets.
docstr: Returns a dictionary with keys ('lr', 'hr') containing training batches
  of Low Res and High Res image patches.
  
  Args:
      batch_size: integer.
      flatness: float in [0,1], is the patch "flatness" threshold.
          Determines what level of detail the patches need to meet. 0 means any patch is accepted.
docstr_tok: ["Returns","a","dictionary","with","keys","(","'lr","'",",","'hr","'",")","containing","training","batches","of","Low","Res","and","High","Res","image","patches",".","Args",":","batch_size",":","integer",".","flatness",":","float","in","[","0,1","]",",","is","the","patch","``","flatness","''","threshold",".","Determines","what","level","of","detail","the","patches","need","to","meet",".","0","means","any","patch","is","accepted","."]
code: def get_batch(self, batch_size, idx=None, flatness=0.0):
      """
      Returns a dictionary with keys ('lr', 'hr') containing training batches
      of Low Res and High Res image patches.
  
      Args:
          batch_size: integer.
          flatness: float in [0,1], is the patch "flatness" threshold.
              Determines what level of detail the patches need to meet. 0 means any patch is accepted.
      """
  
      if not idx:
          # randomly select one image. idx is given at validation time.
          idx = np.random.choice(range(len(self.img_list["hr"])))
      img = {}
      for res in ["lr", "hr"]:
          img_path = os.path.join(
              self.folders[res], self.img_list[res][idx]
          )
          img[res] = imageio.imread(img_path) / 255.0
      batch = self._crop_imgs(img, batch_size, flatness)
      transforms = np.random.randint(0, 3, (batch_size, 2))
      batch["lr"] = self._transform_batch(batch["lr"], transforms)
      batch["hr"] = self._transform_batch(batch["hr"], transforms)
  
      return batch
  
file_path: image-super-resolution/ISR/utils/datahandler.py
imports: import os
  import imageio
  import numpy
  from ISR.utils.logger import get_logger
label_desc: Use image node_id 9 for calling the DataHandler obj's underlying member method code with example usage: obj.get_batch(batch_size, idx, flatness) and returns: batch