code: def ohem_single(self, score, gt_text, training_mask, ohem_ratio=3):
      pos_num = int(
          paddle.sum((gt_text > 0.5).astype("float32"))
      ) - int(
          paddle.sum(
              paddle.logical_and(
                  (gt_text > 0.5), (training_mask <= 0.5)
              ).astype("float32")
          )
      )
  
      if pos_num == 0:
          selected_mask = training_mask
          selected_mask = selected_mask.reshape(
              [1, selected_mask.shape[0], selected_mask.shape[1]]
          ).astype("float32")
          return selected_mask
  
      neg_num = int(paddle.sum((gt_text <= 0.5).astype("float32")))
      neg_num = int(min(pos_num * ohem_ratio, neg_num))
  
      if neg_num == 0:
          selected_mask = training_mask
          selected_mask = selected_mask.reshape(
              [1, selected_mask.shape[0], selected_mask.shape[1]]
          ).astype("float32")
          return selected_mask
  
      neg_score = paddle.masked_select(score, gt_text <= 0.5)
      neg_score_sorted = paddle.sort(-neg_score)
      threshold = -neg_score_sorted[neg_num - 1]
  
      selected_mask = paddle.logical_and(
          paddle.logical_or((score >= threshold), (gt_text > 0.5)),
          (training_mask > 0.5),
      )
      selected_mask = selected_mask.reshape(
          [1, selected_mask.shape[0], selected_mask.shape[1]]
      ).astype("float32")
      return selected_mask
  
file_path: PaddleOCR/ppocr/losses/det_pse_loss.py
imports: import paddle
  from paddle import nn
  from paddle.nn import functional
  import numpy
  from ppocr.utils.iou import iou
label_desc: Use image node_id 4 for calling the PSELoss obj's underlying member method code with example usage: obj.ohem_single(score, gt_text, training_mask, ohem_ratio) and returns: selected_mask, selected_mask, selected_mask