class_docstr: Merge text components and construct boundaries of text instances.
  
  Args:
      link_thr (float): The edge score threshold. Defaults to 0.8.
      edge_len_thr (int or float): The edge length threshold. Defaults to 50.
      rescale_fields (list[str]): The bbox/polygon field names to
          be rescaled. If None, no rescaling will be performed. Defaults to
          [polygons'].
docstr: Get text instance predictions of one image.
  
  Args:
      pred_result (tuple(ndarray, ndarray, ndarray)): Prediction results
          edge, score and text_comps. Each of shape
          :math:`(N_{edges}, 2)`, :math:`(N_{edges},)` and
          :math:`(M, 9)`, respectively.
      data_sample (TextDetDataSample): Datasample of an image.
  
  Returns:
      TextDetDataSample: The original dataSample with predictions filled
      in. Polygons and results are saved in
      ``TextDetDataSample.pred_instances.polygons``. The confidence
      scores are saved in ``TextDetDataSample.pred_instances.scores``.
docstr_tok: ["Get","text","instance","predictions","of","one","image",".","Args",":","pred_result","(","tuple","(","ndarray",",","ndarray",",","ndarray",")",")",":","Prediction","results","edge",",","score","and","text_comps",".","Each","of","shape",":","math",":","`","(","N_","{","edges","}",",","2",")","`",",",":","math",":","`","(","N_","{","edges","}",",",")","`","and",":","math",":","`","(","M",",","9",")","`",",","respectively",".","data_sample","(","TextDetDataSample",")",":","Datasample","of","an","image",".","Returns",":","TextDetDataSample",":","The","original","dataSample","with","predictions","filled","in",".","Polygons","and","results","are","saved","in","``","TextDetDataSample.pred_instances.polygons","``",".","The","confidence","scores","are","saved","in","``","TextDetDataSample.pred_instances.scores","``","."]
code: def get_text_instances(
      self,
      pred_results: Tuple[ndarray, ndarray, ndarray],
      data_sample: TextDetDataSample,
  ) -> TextDetDataSample:
      """Get text instance predictions of one image.
  
      Args:
          pred_result (tuple(ndarray, ndarray, ndarray)): Prediction results
              edge, score and text_comps. Each of shape
              :math:`(N_{edges}, 2)`, :math:`(N_{edges},)` and
              :math:`(M, 9)`, respectively.
          data_sample (TextDetDataSample): Datasample of an image.
  
      Returns:
          TextDetDataSample: The original dataSample with predictions filled
          in. Polygons and results are saved in
          ``TextDetDataSample.pred_instances.polygons``. The confidence
          scores are saved in ``TextDetDataSample.pred_instances.scores``.
      """
  
      data_sample.pred_instances = InstanceData()
      polys = []
      scores = []
  
      pred_edges, pred_scores, text_comps = pred_results
  
      if pred_edges is not None:
          assert len(pred_edges) == len(pred_scores)
          assert text_comps.ndim == 2
          assert text_comps.shape[1] == 9
  
          vertices, score_dict = self._graph_propagation(
              pred_edges, pred_scores, text_comps
          )
          clusters = self._connected_components(vertices, score_dict)
          pred_labels = self._clusters2labels(
              clusters, text_comps.shape[0]
          )
          text_comps, pred_labels = self._remove_single(
              text_comps, pred_labels
          )
          polys, scores = self._comps2polys(text_comps, pred_labels)
  
      data_sample.pred_instances.polygons = polys
      data_sample.pred_instances.scores = torch.FloatTensor(scores)
  
      return data_sample
  
imports: import functools
  import operator
  from typing import Dict, List, Tuple, Union
  import cv2
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from numpy import ndarray
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from .base import BaseTextDetPostProcessor
label_desc: Use image node_id 2 for calling the DRRGPostprocessor obj's underlying member method code with example usage: obj.get_text_instances(pred_results, data_sample) and returns: data_sample