class_docstr: A general geometric augmentation tool for text images in the CVPR 2020
  paper "Learn to Augment: Joint Data Augmentation and Network Optimization
  for Text Recognition". It applies distortion, stretching, and perspective
  transforms to an image.
  
  This implementation is adapted from
  https://github.com/RubanSeven/Text-Image-Augmentation-python/blob/master/augment.py  # noqa
  
  TODO: Split this transform into three transforms.
  
  Required Keys:
  
  - img
  
  Modified Keys:
  
  - img
  - img_shape
class_docstr_tok: ["A","general","geometric","augmentation","tool","for","text","images","in","the","CVPR","2020","paper","``","Learn","to","Augment",":","Joint","Data","Augmentation","and","Network","Optimization","for","Text","Recognition","''",".","It","applies","distortion",",","stretching",",","and","perspective","transforms","to","an","image",".","This","implementation","is","adapted","from","https",":","\/\/github.com\/RubanSeven\/Text-Image-Augmentation-python\/blob\/master\/augment.py","#","noqa","TODO",":","Split","this","transform","into","three","transforms",".","Required","Keys",":","-","img","Modified","Keys",":","-","img","-","img_shape"]
docstr: Call function to pad images.
  
  Args:
      results (dict): Result dict from loading pipeline.
  
  Returns:
      dict: Updated result dict.
docstr_tok: ["Call","function","to","pad","images",".","Args",":","results","(","dict",")",":","Result","dict","from","loading","pipeline",".","Returns",":","dict",":","Updated","result","dict","."]
code: def transform(self, results: Dict) -> Dict:
      """Call function to pad images.
  
      Args:
          results (dict): Result dict from loading pipeline.
  
      Returns:
          dict: Updated result dict.
      """
      h, w = results["img"].shape[:2]
      if h >= 20 and w >= 20:
          results["img"] = self.tia_distort(
              results["img"], random.randint(3, 6)
          )
          results["img"] = self.tia_stretch(
              results["img"], random.randint(3, 6)
          )
      h, w = results["img"].shape[:2]
      if h >= 5 and w >= 5:
          results["img"] = self.tia_perspective(results["img"])
      results["img_shape"] = results["img"].shape[:2]
      return results
  
imports: import math
  import random
  from typing import Dict, List, Optional, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import cache_randomness
  from mmocr.registry import TRANSFORMS
label_desc: Use image node_id 1 for calling the TextRecogGeneralAug obj's underlying member method code with example usage: obj.transform(results) and returns: results