class_docstr: Propose text components and generate local graphs for GCN to classify
  the k-nearest neighbors of a pivot in `DRRG: Deep Relational Reasoning
  Graph Network for Arbitrary Shape Text Detection.
  
  <https://arxiv.org/abs/2003.07493>`_.
  
  This code was partially adapted from https://github.com/GXYM/DRRG licensed
  under the MIT license.
  
  Args:
      k_at_hops (tuple(int)): The number of i-hop neighbors, i = 1, 2.
      num_adjacent_linkages (int): The number of linkages when constructing
          adjacent matrix.
      node_geo_feat_len (int): The length of embedded geometric feature
          vector of a text component.
      pooling_scale (float): The spatial scale of rotated RoI-Align.
      pooling_output_size (tuple(int)): The output size of rotated RoI-Align.
      nms_thr (float): The locality-aware NMS threshold for text components.
      min_width (float): The minimum width of text components.
      max_width (float): The maximum width of text components.
      comp_shrink_ratio (float): The shrink ratio of text components.
      comp_w_h_ratio (float): The width to height ratio of text components.
      comp_score_thr (float): The score threshold of text component.
      text_region_thr (float): The threshold for text region probability map.
      center_region_thr (float): The threshold for text center region
          probability map.
      center_region_area_thr (int): The threshold for filtering small-sized
          text center region.
docstr: Propose text components.
  
  Args:
      score_map (ndarray): The score map for NMS.
      top_height_map (ndarray): The predicted text height map from each
          pixel in text center region to top sideline.
      bot_height_map (ndarray): The predicted text height map from each
          pixel in text center region to bottom sideline.
      sin_map (ndarray): The predicted sin(theta) map.
      cos_map (ndarray): The predicted cos(theta) map.
      comp_score_thr (float): The score threshold of text component.
      min_width (float): The minimum width of text components.
      max_width (float): The maximum width of text components.
      comp_shrink_ratio (float): The shrink ratio of text components.
      comp_w_h_ratio (float): The width to height ratio of text
          components.
  
  Returns:
      ndarray: The text components.
docstr_tok: ["Propose","text","components",".","Args",":","score_map","(","ndarray",")",":","The","score","map","for","NMS",".","top_height_map","(","ndarray",")",":","The","predicted","text","height","map","from","each","pixel","in","text","center","region","to","top","sideline",".","bot_height_map","(","ndarray",")",":","The","predicted","text","height","map","from","each","pixel","in","text","center","region","to","bottom","sideline",".","sin_map","(","ndarray",")",":","The","predicted","sin","(","theta",")","map",".","cos_map","(","ndarray",")",":","The","predicted","cos","(","theta",")","map",".","comp_score_thr","(","float",")",":","The","score","threshold","of","text","component",".","min_width","(","float",")",":","The","minimum","width","of","text","components",".","max_width","(","float",")",":","The","maximum","width","of","text","components",".","comp_shrink_ratio","(","float",")",":","The","shrink","ratio","of","text","components",".","comp_w_h_ratio","(","float",")",":","The","width","to","height","ratio","of","text","components",".","Returns",":","ndarray",":","The","text","components","."]
code: def propose_comps(
      self,
      score_map: ndarray,
      top_height_map: ndarray,
      bot_height_map: ndarray,
      sin_map: ndarray,
      cos_map: ndarray,
      comp_score_thr: float,
      min_width: float,
      max_width: float,
      comp_shrink_ratio: float,
      comp_w_h_ratio: float,
  ) -> ndarray:
      """Propose text components.
  
      Args:
          score_map (ndarray): The score map for NMS.
          top_height_map (ndarray): The predicted text height map from each
              pixel in text center region to top sideline.
          bot_height_map (ndarray): The predicted text height map from each
              pixel in text center region to bottom sideline.
          sin_map (ndarray): The predicted sin(theta) map.
          cos_map (ndarray): The predicted cos(theta) map.
          comp_score_thr (float): The score threshold of text component.
          min_width (float): The minimum width of text components.
          max_width (float): The maximum width of text components.
          comp_shrink_ratio (float): The shrink ratio of text components.
          comp_w_h_ratio (float): The width to height ratio of text
              components.
  
      Returns:
          ndarray: The text components.
      """
  
      comp_centers = np.argwhere(score_map > comp_score_thr)
      comp_centers = comp_centers[np.argsort(comp_centers[:, 0])]
      y = comp_centers[:, 0]
      x = comp_centers[:, 1]
  
      top_height = (
          top_height_map[y, x].reshape((-1, 1)) * comp_shrink_ratio
      )
      bot_height = (
          bot_height_map[y, x].reshape((-1, 1)) * comp_shrink_ratio
      )
      sin = sin_map[y, x].reshape((-1, 1))
      cos = cos_map[y, x].reshape((-1, 1))
  
      top_mid_pts = comp_centers + np.hstack(
          [top_height * sin, top_height * cos]
      )
      bot_mid_pts = comp_centers - np.hstack(
          [bot_height * sin, bot_height * cos]
      )
  
      width = (top_height + bot_height) * comp_w_h_ratio
      width = np.clip(width, min_width, max_width)
      r = width / 2
  
      tl = top_mid_pts[:, ::-1] - np.hstack([-r * sin, r * cos])
      tr = top_mid_pts[:, ::-1] + np.hstack([-r * sin, r * cos])
      br = bot_mid_pts[:, ::-1] + np.hstack([-r * sin, r * cos])
      bl = bot_mid_pts[:, ::-1] - np.hstack([-r * sin, r * cos])
      text_comps = np.hstack([tl, tr, br, bl]).astype(np.float32)
  
      score = score_map[y, x].reshape((-1, 1))
      text_comps = np.hstack([text_comps, score])
  
      return text_comps
  
imports: from typing import Dict, List, Optional, Sequence, Tuple, Union
  import cv2
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.ops import RoIAlignRotated
  from mmengine.model import BaseModule
  from numpy import ndarray
  from torch import Tensor
  from torch.nn import init
  from mmocr.models.textdet.heads import BaseTextDetHead
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from mmocr.utils import fill_hole
label_desc: Use image node_id 2 for calling the ProposalLocalGraphs obj's underlying member method code with example usage: obj.propose_comps(score_map, top_height_map, bot_height_map, sin_map, cos_map, comp_score_thr, min_width, max_width, comp_shrink_ratio, comp_w_h_ratio) and returns: text_comps