class_docstr: Post-processing methods for ABCNet.
  
  Args:
      num_classes (int): Number of classes.
      use_sigmoid_cls (bool): Whether to use sigmoid for classification.
      strides (tuple): Strides of each feature map.
      norm_by_strides (bool): Whether to normalize the regression targets by
          the strides.
      bbox_coder (dict): Config dict for bbox coder.
      text_repr_type (str): Text representation type, 'poly' or 'quad'.
      with_bezier (bool): Whether to use bezier curve for text detection.
      train_cfg (dict): Config dict for training.
      test_cfg (dict): Config dict for testing.
class_docstr_tok: ["Post-processing","methods","for","ABCNet",".","Args",":","num_classes","(","int",")",":","Number","of","classes",".","use_sigmoid_cls","(","bool",")",":","Whether","to","use","sigmoid","for","classification",".","strides","(","tuple",")",":","Strides","of","each","feature","map",".","norm_by_strides","(","bool",")",":","Whether","to","normalize","the","regression","targets","by","the","strides",".","bbox_coder","(","dict",")",":","Config","dict","for","bbox","coder",".","text_repr_type","(","str",")",":","Text","representation","type",",","'poly","'","or","'quad","'",".","with_bezier","(","bool",")",":","Whether","to","use","bezier","curve","for","text","detection",".","train_cfg","(","dict",")",":","Config","dict","for","training",".","test_cfg","(","dict",")",":","Config","dict","for","testing","."]
docstr: Get text instance predictions of one image.
docstr_tok: ["Get","text","instance","predictions","of","one","image","."]
code: def get_text_instances(
      self,
      pred_results,
      data_sample,
      nms_pre=-1,
      score_thr=0,
      max_per_img=100,
      nms=dict(type="nms", iou_threshold=0.5),
  ):
      """Get text instance predictions of one image."""
      pred_instances = InstanceData()
  
      (
          mlvl_bboxes,
          mlvl_scores,
          mlvl_labels,
          mlvl_score_factors,
          mlvl_beziers,
      ) = multi_apply(
          self._get_preds_single_level,
          *pred_results,
          self.strides,
          img_shape=data_sample.get("img_shape"),
          nms_pre=nms_pre,
          score_thr=score_thr,
      )
  
      mlvl_bboxes = torch.cat(mlvl_bboxes)
      mlvl_scores = torch.cat(mlvl_scores)
      mlvl_labels = torch.cat(mlvl_labels)
      if self.with_bezier:
          mlvl_beziers = torch.cat(mlvl_beziers)
  
      if mlvl_score_factors is not None:
          mlvl_score_factors = torch.cat(mlvl_score_factors)
          mlvl_scores = mlvl_scores * mlvl_score_factors
          mlvl_scores = torch.sqrt(mlvl_scores)
  
      if mlvl_bboxes.numel() == 0:
          pred_instances.bboxes = mlvl_bboxes.detach().cpu().numpy()
          pred_instances.scores = mlvl_scores.detach().cpu().numpy()
          pred_instances.labels = mlvl_labels.detach().cpu().numpy()
          if self.with_bezier:
              pred_instances.beziers = mlvl_beziers.detach().reshape(
                  -1, 16
              )
          pred_instances.polygons = []
          data_sample.pred_instances = pred_instances
          return data_sample
      det_bboxes, keep_idxs = batched_nms(
          mlvl_bboxes, mlvl_scores, mlvl_labels, nms
      )
      det_bboxes, scores = np.split(det_bboxes, [-1], axis=1)
      pred_instances.bboxes = (
          det_bboxes[:max_per_img].detach().cpu().numpy()
      )
      pred_instances.scores = (
          scores[:max_per_img].detach().cpu().numpy().squeeze(-1)
      )
      pred_instances.labels = (
          mlvl_labels[keep_idxs][:max_per_img].detach().cpu().numpy()
      )
      if self.with_bezier:
          pred_instances.beziers = (
              mlvl_beziers[keep_idxs][:max_per_img]
              .detach()
              .reshape(-1, 16)
          )
      data_sample.pred_instances = pred_instances
      return data_sample
  
file_path: mmocr/projects/ABCNet/abcnet/model/abcnet_det_postprocessor.py
imports: from functools import partial
  from typing import List
  import numpy
  import torch
  from mmcv.ops import batched_nms
  from mmdet.models.task_modules.prior_generators import MlvlPointGenerator
  from mmdet.models.utils import filter_scores_and_topk, multi_apply, select_single_mlvl
  from mmengine.structures import InstanceData
  from mmocr.models.textdet.postprocessors.base import BaseTextDetPostProcessor
  from mmocr.registry import MODELS, TASK_UTILS
label_desc: Use image node_id 3 for calling the ABCNetDetPostprocessor obj's underlying member method code with example usage: obj.get_text_instances(pred_results, data_sample, nms_pre, score_thr, max_per_img, nms) and returns: data_sample, data_sample