class_docstr: Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1]
  Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021.
class_docstr_tok: ["Sturture-Preserving","Transformation","(","SPT",")","as","Equa",".","(","2",")","in","Ref",".","[","1","]","Ref",":","[","1","]","SPIN",":","Structure-Preserving","Inner","Offset","Network","for","Scene","Text","Recognition",".","AAAI-2021","."]
docstr: Args:
      k (int): the complexity of transformation intensities (by default set to 6 as the paper)
  
  Returns:
      List: the normalized intensity of each pixel in [0,1], denoted as eta [1x(2K+1)]
docstr_tok: ["Args",":","k","(","int",")",":","the","complexity","of","transformation","intensities","(","by","default","set","to","6","as","the","paper",")","Returns",":","List",":","the","normalized","intensity","of","each","pixel","in","[","0,1","]",",","denoted","as","\beta","[","1x","(","2K+1",")","]"]
code: def cal_K(self, k=5):
      """
  
      Args:
          k (int): the complexity of transformation intensities (by default set to 6 as the paper)
  
      Returns:
          List: the normalized intensity of each pixel in [0,1], denoted as \beta [1x(2K+1)]
  
      """
      from math import log
  
      x = []
      if k != 0:
          for i in range(1, k + 1):
              lower = round(
                  log(1 - (0.5 / (k + 1)) * i)
                  / log((0.5 / (k + 1)) * i),
                  2,
              )
              upper = round(1 / lower, 2)
              x.append(lower)
              x.append(upper)
      x.append(1.00)
      return x
  
file_path: PaddleOCR/ppocr/modeling/transforms/gaspin_transformer.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import nn, ParamAttr
  from paddle.nn import functional
  import numpy
  import functools
  from .tps import GridGenerator
label_desc: Use image node_id 2 for calling the SP_TransformerNetwork obj's underlying member method code with example usage: obj.cal_K(k) and returns: x