docstr: Generate local graphs and graph convolutional network input data.
  
  Args:
      preds (tensor): The predicted maps.
      feat_maps (tensor): The feature maps to extract content feature of
          text components.
  
  Returns:
      none_flag (bool): The flag showing whether the number of proposed
          text components is 0.
      local_graphs_node_feats (tensor): The features of nodes in local
          graphs.
      adjacent_matrices (tensor): The adjacent matrices.
      pivots_knn_inds (tensor): The k-nearest neighbor indices in
          local graphs.
      pivots_local_graphs (tensor): The indices of nodes in local
          graphs.
      text_comps (ndarray): The predicted text components.
docstr_tok: ["Generate","local","graphs","and","graph","convolutional","network","input","data",".","Args",":","preds","(","tensor",")",":","The","predicted","maps",".","feat_maps","(","tensor",")",":","The","feature","maps","to","extract","content","feature","of","text","components",".","Returns",":","none_flag","(","bool",")",":","The","flag","showing","whether","the","number","of","proposed","text","components","is","0.","local_graphs_node_feats","(","tensor",")",":","The","features","of","nodes","in","local","graphs",".","adjacent_matrices","(","tensor",")",":","The","adjacent","matrices",".","pivots_knn_inds","(","tensor",")",":","The","k-nearest","neighbor","indices","in","local","graphs",".","pivots_local_graphs","(","tensor",")",":","The","indices","of","nodes","in","local","graphs",".","text_comps","(","ndarray",")",":","The","predicted","text","components","."]
code: def __call__(self, preds, feat_maps):
      """Generate local graphs and graph convolutional network input data.
  
      Args:
          preds (tensor): The predicted maps.
          feat_maps (tensor): The feature maps to extract content feature of
              text components.
  
      Returns:
          none_flag (bool): The flag showing whether the number of proposed
              text components is 0.
          local_graphs_node_feats (tensor): The features of nodes in local
              graphs.
          adjacent_matrices (tensor): The adjacent matrices.
          pivots_knn_inds (tensor): The k-nearest neighbor indices in
              local graphs.
          pivots_local_graphs (tensor): The indices of nodes in local
              graphs.
          text_comps (ndarray): The predicted text components.
      """
      if preds.ndim == 4:
          assert preds.shape[0] == 1
          preds = paddle.squeeze(preds)
      pred_text_region = F.sigmoid(preds[0]).numpy()
      pred_center_region = F.sigmoid(preds[1]).numpy()
      pred_sin_map = preds[2].numpy()
      pred_cos_map = preds[3].numpy()
      pred_top_height_map = preds[4].numpy()
      pred_bot_height_map = preds[5].numpy()
  
      comp_attribs, text_comps = self.propose_comps_and_attribs(
          pred_text_region,
          pred_center_region,
          pred_top_height_map,
          pred_bot_height_map,
          pred_sin_map,
          pred_cos_map,
      )
  
      if comp_attribs is None or len(comp_attribs) < 2:
          none_flag = True
          return none_flag, (0, 0, 0, 0, 0)
  
      comp_centers = comp_attribs[:, 0:2]
      distance_matrix = euclidean_distance_matrix(
          comp_centers, comp_centers
      )
  
      geo_feats = feature_embedding(
          comp_attribs, self.node_geo_feat_dim
      )
      geo_feats = paddle.to_tensor(geo_feats)
  
      batch_id = np.zeros((comp_attribs.shape[0], 1), dtype=np.float32)
      comp_attribs = comp_attribs.astype(np.float32)
      angle = np.arccos(comp_attribs[:, -2]) * np.sign(
          comp_attribs[:, -1]
      )
      angle = angle.reshape((-1, 1))
      rotated_rois = np.hstack([batch_id, comp_attribs[:, :-2], angle])
      rois = paddle.to_tensor(rotated_rois)
  
      content_feats = self.pooling(feat_maps, rois)
      content_feats = content_feats.reshape(
          [content_feats.shape[0], -1]
      )
      node_feats = paddle.concat([content_feats, geo_feats], axis=-1)
  
      sorted_dist_inds = np.argsort(distance_matrix, axis=1)
      (
          local_graphs_node_feat,
          adjacent_matrices,
          pivots_knn_inds,
          pivots_local_graphs,
      ) = self.generate_local_graphs(sorted_dist_inds, node_feats)
  
      none_flag = False
      return none_flag, (
          local_graphs_node_feat,
          adjacent_matrices,
          pivots_knn_inds,
          pivots_local_graphs,
          text_comps,
      )
  
file_path: PaddleOCR/ppocr/modeling/heads/proposal_local_graph.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import cv2
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from lanms import merge_quadrangle_n9
  from ppocr.ext_op import RoIAlignRotated
  from .local_graph import euclidean_distance_matrix, feature_embedding, normalize_adjacent_matrix
label_desc: Use image node_id 5 for calling the ProposalLocalGraphs obj's underlying member method code with example usage: obj.__call__(preds, feat_maps) and returns: none_flag,  local_graphs_node_feat,  adjacent_matrices,  pivots_knn_inds,  pivots_local_graphs,  text_comps, none_flag,  int,  int,  int,  int,  int