xuewenyuan / TGRNet

TGRNet: A Table Graph Reconstruction Network for Table Structure Recognition
Apache License 2.0
95 stars 21 forks source link

Testing model on ICDAR 2013 and 2019 #12

Open Kehindeajayi01 opened 2 years ago

Kehindeajayi01 commented 2 years ago

Hi, I am trying to run your model on the ICDAR 2013 and 2019 datasets but I was getting the error below:

Screen Shot 1400-12-17 at 13 35 38

It seems the path in the pickle files have been set to your directory. Please can you help out?

Thanks

xuewenyuan commented 2 years ago

for the path problem, pls ref this issue #11.

Kehindeajayi01 commented 2 years ago

for the path problem, pls ref this issue #11.

There are problem with the path in all the datasets but I was able to write a general script to replace all the path to the users path. If you need it, I can add it here.

Also, please, can you show me how to use your pretrained model to generate structures for new table images? I want to cite your paper for its generalization to new table images.

Thanks

lmmlzn commented 1 year ago

@Kehindeajayi01 please,I want the general script,thanks

Kehindeajayi01 commented 1 year ago

@Kehindeajayi01 please,I want the general script,thanks

@lmmlzn Please find the script below I wrote to rewrite all the path:

import ntpath import os import argparse

def get_args(): parser = argparse.ArgumentParser() parser.add_argument("--gt_dir", help = "path to the ground truth") parser.add_argument("--node_dir", help = "path to the graph node directory") parser.add_argument("--edge_dir", help = "path to the graph edge directory") parser.add_argument("--target_dir", help = "path to the target directory") parser.add_argument("--output", help = "path to save output") parser.add_argument("--filename", help = "name of file to re-write") args = parser.parse_args() return args

"""Note, you may need to create an empty folder for the graph edge directory as it is not included in the TGRNet ICDAR 2019 data""" def rewriteText(): args = get_args() gt_dir = args.gt_dir node_dir = args.node_dir edge_dir = args.edge_dir target_dir = args.target_dir output = args.output filename = args.filename lines = open(filename).readlines() new_fp = open(os.path.join(output, "result.txt"), 'w')

for line in lines:
    text = line.split()
    pkl = text[0]
    node = text[1]
    edge = text[2]
    target = text[3]
    pkl_path = os.path.join(gt_dir, ntpath.basename(pkl))
    node_path = os.path.join(node_dir, ntpath.basename(node))
    edge_path = os.path.join(edge_dir, ntpath.basename(edge))
    target_path = os.path.join(target_dir, ntpath.basename(target))
    correct_line = pkl_path + " " + node_path + " " + edge_path + " " + target_path 
    new_fp.write(correct_line)
    new_fp.write("\n")
new_fp.close()
YongZ-Lee commented 8 months ago

Hey, I realized that datasets doesn't have a folder for graph_edge, how did you fix it?