class_docstr: Some kind of slow deformation I made up. Don't count on it.
class_docstr_tok: ["Some","kind","of","slow","deformation","I","made","up",".","Do","n't","count","on","it","."]
docstr: Args:
      anchors (list): list of center coordinates in range [0,1].
      shape(list or tuple): image shape in [h, w].
      sigma (float): sigma for Gaussian weight
      randrange (int): offset range. Defaults to shape[0] / 8
docstr_tok: ["Args",":","anchors","(","list",")",":","list","of","center","coordinates","in","range","[","0,1","]",".","shape","(","list","or","tuple",")",":","image","shape","in","[","h",",","w","]",".","sigma","(","float",")",":","sigma","for","Gaussian","weight","randrange","(","int",")",":","offset","range",".","Defaults","to","shape","[","0","]","\/","8"]
code: def __init__(self, anchors, shape, sigma=0.5, randrange=None):
      """
      Args:
          anchors (list): list of center coordinates in range [0,1].
          shape(list or tuple): image shape in [h, w].
          sigma (float): sigma for Gaussian weight
          randrange (int): offset range. Defaults to shape[0] / 8
      """
      logger.warn(
          "GaussianDeform is slow. Consider using it with 4 or more prefetching processes."
      )
      super(GaussianDeform, self).__init__()
      self.anchors = anchors
      self.K = len(self.anchors)
      self.shape = shape
      self.grid = np.mgrid[
          0 : self.shape[0], 0 : self.shape[1]
      ].transpose(1, 2, 0)
      self.grid = self.grid.astype("float32")  # HxWx2
  
      gm = GaussianMap(self.shape, sigma=sigma)
      self.gws = np.array(
          [gm.get_gaussian_weight(ank) for ank in self.anchors],
          dtype="float32",
      )  # KxHxW
      self.gws = self.gws.transpose(1, 2, 0)  # HxWxK
      if randrange is None:
          self.randrange = self.shape[0] / 8
      else:
          self.randrange = randrange
      self.sigma = sigma
  
file_path: tensorpack/tensorpack/dataflow/imgaug/deform.py
imports: import numpy
  from ...utils import logger
  from .base import ImageAugmentor
  from .transform import TransformFactory
label_desc: Use image node_id 1 to create a new GaussianDeform object from inherited base classes: ImageAugmentor with example: obj = GaussianDeform(anchors, shape, sigma, randrange)