code: def dice_ohnm_loss(self, pred, gt, m):
      pos_index = (gt == 1) * (m == 1)
      neg_index = (gt == 0) * (m == 1)
      pos_num = pos_index.float().sum().item()
      neg_num = neg_index.float().sum().item()
      if pos_num == 0 or neg_num < pos_num * 3.0:
          return self.dice_loss(pred, gt, m)
      else:
          neg_num = int(pos_num * 3)
          pos_pred = pred[pos_index]
          neg_pred = pred[neg_index]
          neg_sort, _ = torch.sort(neg_pred, descending=True)
          sampled_neg_pred = neg_sort[:neg_num]
          pos_gt = pos_pred.clone()
          pos_gt.data.fill_(1.0)
          pos_gt = pos_gt.detach()
          neg_gt = sampled_neg_pred.clone()
          neg_gt.data.fill_(0)
          neg_gt = neg_gt.detach()
          tpred = torch.cat((pos_pred, sampled_neg_pred))
          tgt = torch.cat((pos_gt, neg_gt))
          intersection = torch.sum(tpred * tgt)
          union = torch.sum(tpred) + torch.sum(gt) + self.eps
          loss = 1 - 2.0 * intersection / union
      return loss
  
file_path: EasyOCR/easyocr/DBNet/decoders/pss_loss.py
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the PSS_Loss obj's underlying member method code with example usage: obj.dice_ohnm_loss(pred, gt, m) and returns: loss, self