从收据中提取信息并预测文本区域

2024-06-16 10:08:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要使用图卷积网络从收据中提取信息,并预测每个文本区域对应的内容(TVA、价格…)。 但是,我需要一个图形建模器来演示本文

你能帮我个忙吗

作为输入,我有json文件(还有xml文件),它们描述了图像文本的注释。 我尝试了以下代码:

def run_graph_modeler(normalized_dir, target_dir):
  print("Running graph modeler")

  img_files, word_files, _ = \
  get_normalized_filepaths(normalized_dir)

  for img_file, word_file in zip(img_files, word_files):
      # reads normalized data for one image
      img, word_areas, _ = load_normalized_example(img_file, word_file)

      # computes graph adj matrix for one image
      lines = line_formation(word_areas)
      width, height = cv_size(img)
      graph = graph_modeling(lines, word_areas, width, height)
      adj_matrix = form_adjacency_matrix(graph)

      # saves node features and graph
      save_graph(target_dir, img_file, graph, adj_matrix)

Tags: 文件文本targetimgfordirfilesmatrix