class_docstr: The class for implementing FCENet loss
  FCENet(CVPR2021): Fourier Contour Embedding for Arbitrary-shaped
      Text Detection
  
  [https://arxiv.org/abs/2104.10442]
  
  Args:
      fourier_degree (int) : The maximum Fourier transform degree k.
      num_sample (int) : The sampling points number of regression
          loss. If it is too small, fcenet tends to be overfitting.
      ohem_ratio (float): the negative/positive ratio in OHEM.
class_docstr_tok: ["The","class","for","implementing","FCENet","loss","FCENet","(","CVPR2021",")",":","Fourier","Contour","Embedding","for","Arbitrary-shaped","Text","Detection","[","https",":","\/\/arxiv.org\/abs\/2104.10442","]","Args",":","fourier_degree","(","int",")",":","The","maximum","Fourier","transform","degree","k.","num_sample","(","int",")",":","The","sampling","points","number","of","regression","loss",".","If","it","is","too","small",",","fcenet","tends","to","be","overfitting",".","ohem_ratio","(","float",")",":","the","negative\/positive","ratio","in","OHEM","."]
docstr: Transform Fourier coefficient maps to polygon maps.
  
  Args:
      real_maps (tensor): A map composed of the real parts of the
          Fourier coefficients, whose shape is (-1, 2k+1)
      imag_maps (tensor):A map composed of the imag parts of the
          Fourier coefficients, whose shape is (-1, 2k+1)
  
  Returns
      x_maps (tensor): A map composed of the x value of the polygon
          represented by n sample points (xn, yn), whose shape is (-1, n)
      y_maps (tensor): A map composed of the y value of the polygon
          represented by n sample points (xn, yn), whose shape is (-1, n)
docstr_tok: ["Transform","Fourier","coefficient","maps","to","polygon","maps",".","Args",":","real_maps","(","tensor",")",":","A","map","composed","of","the","real","parts","of","the","Fourier","coefficients",",","whose","shape","is","(","-1",",","2k+1",")","imag_maps","(","tensor",")",":","A","map","composed","of","the","imag","parts","of","the","Fourier","coefficients",",","whose","shape","is","(","-1",",","2k+1",")","Returns","x_maps","(","tensor",")",":","A","map","composed","of","the","x","value","of","the","polygon","represented","by","n","sample","points","(","xn",",","yn",")",",","whose","shape","is","(","-1",",","n",")","y_maps","(","tensor",")",":","A","map","composed","of","the","y","value","of","the","polygon","represented","by","n","sample","points","(","xn",",","yn",")",",","whose","shape","is","(","-1",",","n",")"]
code: def fourier2poly(self, real_maps, imag_maps):
      """Transform Fourier coefficient maps to polygon maps.
  
      Args:
          real_maps (tensor): A map composed of the real parts of the
              Fourier coefficients, whose shape is (-1, 2k+1)
          imag_maps (tensor):A map composed of the imag parts of the
              Fourier coefficients, whose shape is (-1, 2k+1)
  
      Returns
          x_maps (tensor): A map composed of the x value of the polygon
              represented by n sample points (xn, yn), whose shape is (-1, n)
          y_maps (tensor): A map composed of the y value of the polygon
              represented by n sample points (xn, yn), whose shape is (-1, n)
      """
  
      k_vect = paddle.arange(
          -self.fourier_degree, self.fourier_degree + 1, dtype="float32"
      ).reshape([-1, 1])
      i_vect = paddle.arange(
          0, self.num_sample, dtype="float32"
      ).reshape([1, -1])
  
      transform_matrix = (
          2 * np.pi / self.num_sample * paddle.matmul(k_vect, i_vect)
      )
  
      x1 = paddle.einsum(
          "ak, kn-> an", real_maps, paddle.cos(transform_matrix)
      )
      x2 = paddle.einsum(
          "ak, kn-> an", imag_maps, paddle.sin(transform_matrix)
      )
      y1 = paddle.einsum(
          "ak, kn-> an", real_maps, paddle.sin(transform_matrix)
      )
      y2 = paddle.einsum(
          "ak, kn-> an", imag_maps, paddle.cos(transform_matrix)
      )
  
      x_maps = x1 - x2
      y_maps = y1 + y2
  
      return x_maps, y_maps
  
file_path: PaddleOCR/ppocr/losses/det_fce_loss.py
imports: import numpy
  from paddle import nn
  import paddle
  import paddle.nn.functional
  from functools import partial
label_desc: Use image node_id 5 for calling the FCELoss obj's underlying member method code with example usage: obj.fourier2poly(real_maps, imag_maps) and returns: x_maps,  y_maps