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","."]
code: def forward(self, preds, labels):
      assert isinstance(preds, dict)
      preds = preds["levels"]
  
      p3_maps, p4_maps, p5_maps = labels[1:]
      assert (
          p3_maps[0].shape[0] == 4 * self.fourier_degree + 5
      ), "fourier degree not equal in FCEhead and FCEtarget"
  
      # to tensor
      gts = [p3_maps, p4_maps, p5_maps]
      for idx, maps in enumerate(gts):
          gts[idx] = paddle.to_tensor(np.stack(maps))
  
      losses = multi_apply(self.forward_single, preds, gts)
  
      loss_tr = paddle.to_tensor(0.0).astype("float32")
      loss_tcl = paddle.to_tensor(0.0).astype("float32")
      loss_reg_x = paddle.to_tensor(0.0).astype("float32")
      loss_reg_y = paddle.to_tensor(0.0).astype("float32")
      loss_all = paddle.to_tensor(0.0).astype("float32")
  
      for idx, loss in enumerate(losses):
          loss_all += sum(loss)
          if idx == 0:
              loss_tr += sum(loss)
          elif idx == 1:
              loss_tcl += sum(loss)
          elif idx == 2:
              loss_reg_x += sum(loss)
          else:
              loss_reg_y += sum(loss)
  
      results = dict(
          loss=loss_all,
          loss_text=loss_tr,
          loss_center=loss_tcl,
          loss_reg_x=loss_reg_x,
          loss_reg_y=loss_reg_y,
      )
      return results
  
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 2 for calling the FCELoss obj's underlying member method code with example usage: obj.forward(preds, labels) and returns: results