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.
      negative_ratio (float or int): Maximum ratio of negative
          samples to positive ones in OHEM. Defaults to 3.
      resample_step (float): The step size for resampling the text center
          line (TCL). It's better not to exceed half of the minimum width.
      center_region_shrink_ratio (float): The shrink ratio of text center
          region.
      level_size_divisors (tuple(int)): The downsample ratio on each level.
      level_proportion_range (tuple(tuple(int))): The range of text sizes
          assigned to each level.
      loss_tr (dict) : The loss config used to calculate the text region
          loss. Defaults to dict(type='MaskedBalancedBCELoss').
      loss_tcl (dict) : The loss config used to calculate the text center
          line loss. Defaults to dict(type='MaskedBCELoss').
      loss_reg_x (dict) : The loss config used to calculate the regression
          loss on x axis. Defaults to dict(type='MaskedSmoothL1Loss').
      loss_reg_y (dict) : The loss config used to calculate the regression
          loss on y axis. Defaults to dict(type='MaskedSmoothL1Loss').
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",".","negative_ratio","(","float","or","int",")",":","Maximum","ratio","of","negative","samples","to","positive","ones","in","OHEM",".","Defaults","to","3.","resample_step","(","float",")",":","The","step","size","for","resampling","the","text","center","line","(","TCL",")",".","It","'s","better","not","to","exceed","half","of","the","minimum","width",".","center_region_shrink_ratio","(","float",")",":","The","shrink","ratio","of","text","center","region",".","level_size_divisors","(","tuple","(","int",")",")",":","The","downsample","ratio","on","each","level",".","level_proportion_range","(","tuple","(","tuple","(","int",")",")",")",":","The","range","of","text","sizes","assigned","to","each","level",".","loss_tr","(","dict",")",":","The","loss","config","used","to","calculate","the","text","region","loss",".","Defaults","to","dict","(","type='MaskedBalancedBCELoss","'",")",".","loss_tcl","(","dict",")",":","The","loss","config","used","to","calculate","the","text","center","line","loss",".","Defaults","to","dict","(","type='MaskedBCELoss","'",")",".","loss_reg_x","(","dict",")",":","The","loss","config","used","to","calculate","the","regression","loss","on","x","axis",".","Defaults","to","dict","(","type='MaskedSmoothL1Loss","'",")",".","loss_reg_y","(","dict",")",":","The","loss","config","used","to","calculate","the","regression","loss","on","y","axis",".","Defaults","to","dict","(","type='MaskedSmoothL1Loss","'",")","."]
docstr: Calculate Fourier signature from input polygon.
  
  Args:
        polygon (list[ndarray]): The input polygon.
        fourier_degree (int): The maximum Fourier degree K.
  Returns:
        ndarray: An array shaped (2k+1, 2) containing
            real part and image part of 2k+1 Fourier coefficients.
docstr_tok: ["Calculate","Fourier","signature","from","input","polygon",".","Args",":","polygon","(","list","[","ndarray","]",")",":","The","input","polygon",".","fourier_degree","(","int",")",":","The","maximum","Fourier","degree","K.","Returns",":","ndarray",":","An","array","shaped","(","2k+1",",","2",")","containing","real","part","and","image","part","of","2k+1","Fourier","coefficients","."]
code: def _cal_fourier_signature(
      self, polygon: ArrayLike, fourier_degree: int
  ) -> np.ndarray:
      """Calculate Fourier signature from input polygon.
  
      Args:
            polygon (list[ndarray]): The input polygon.
            fourier_degree (int): The maximum Fourier degree K.
      Returns:
            ndarray: An array shaped (2k+1, 2) containing
                real part and image part of 2k+1 Fourier coefficients.
      """
      resampled_polygon = self._resample_polygon(polygon)
      resampled_polygon = self._normalize_polygon(resampled_polygon)
  
      fourier_coeff = self._poly2fourier(
          resampled_polygon, fourier_degree
      )
      fourier_coeff = self._clockwise(fourier_coeff, fourier_degree)
  
      real_part = np.real(fourier_coeff).reshape((-1, 1))
      image_part = np.imag(fourier_coeff).reshape((-1, 1))
      fourier_signature = np.hstack([real_part, image_part])
  
      return fourier_signature
  
imports: from typing import Dict, List, Optional, Sequence, Tuple, Union
  import cv2
  import numpy
  import torch
  from mmdet.models.utils import multi_apply
  from numpy.fft import fft
  from numpy.linalg import norm
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from mmocr.utils.typing_utils import ArrayLike
  from .textsnake_module_loss import TextSnakeModuleLoss
label_desc: Use image node_id 9 for calling the FCEModuleLoss obj's underlying member method code with example usage: obj._cal_fourier_signature(polygon, fourier_degree) and returns: fourier_signature