code: def main():
      test_image_dir = "train_data/FUNSD/testing_data/images/"
      test_anno_dir = "train_data/FUNSD/testing_data/annotations/"
      test_output_dir = "train_data/FUNSD/test.json"
  
      fn_info_map = load_funsd_label(test_image_dir, test_anno_dir)
      with open(test_output_dir, "w") as fout:
          for fn in fn_info_map:
              fout.write(
                  fn
                  + ".png"
                  + "\t"
                  + json.dumps(fn_info_map[fn], ensure_ascii=False)
                  + "\n"
              )
  
      train_image_dir = "train_data/FUNSD/training_data/images/"
      train_anno_dir = "train_data/FUNSD/training_data/annotations/"
      train_output_dir = "train_data/FUNSD/train.json"
  
      fn_info_map = load_funsd_label(train_image_dir, train_anno_dir)
      with open(train_output_dir, "w") as fout:
          for fn in fn_info_map:
              fout.write(
                  fn
                  + ".png"
                  + "\t"
                  + json.dumps(fn_info_map[fn], ensure_ascii=False)
                  + "\n"
              )
      print("====ok====")
      return
  
file_path: PaddleOCR/ppstructure/kie/tools/trans_funsd_label.py
imports: import json
  import os
  import sys
  import cv2
  import numpy
  from copy import deepcopy
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types