doc-analysis / TableBank

TableBank: A Benchmark Dataset for Table Detection and Recognition
Apache License 2.0
988 stars 139 forks source link

Why results bad for table structure recognition? #12

Open MuruganR96 opened 4 years ago

MuruganR96 commented 4 years ago

i tried here table image text extraction using tablebank pretrained model (Table structure recognition).

Results here,

python drive/My\ Drive/OpenNMT-py/translate.py -data_type img -model drive/My\ Drive/Pretrained_Word_Embeddings/detectron_table_detection/model.pt -src_dir drive/My\ Drive/datasets/table_dataset_sample/ \
 -src src-test.txt -output pred.txt -max_length 150 -beam_size 5 -gpu 0 -verbose
[2019-08-21 05:40:53,223 INFO] Translating shard 0.
/usr/local/lib/python3.6/dist-packages/torchtext/data/field.py:359: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  var = torch.tensor(arr, dtype=self.dtype, device=device)

SENT 1: None
PRED 1: <tabular> <tbody> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdn> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdn> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdn> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdn> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdn> </tr> <tr> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdy> <tdn> </tr> </tbody> </tabular>
PRED SCORE: -1.2848
PRED AVG SCORE: -0.0111, PRED PPL: 1.0111

Please if am i wrong, correct me.:)

liminghao1630 commented 4 years ago

it seems that u didn't specify the ground truth file in the command.

MuruganR96 commented 4 years ago

didn't specify the ground truth file in the command

what it means @liminghao1630 sir. Please can you me some additional information about this?

liminghao1630 commented 4 years ago

@MuruganR96 --tgt, -tgt True target sequence (optional)

--report_bleu, -report_bleu Report bleu score after translation, call tools/multi-bleu.perl on command line

You can use -tgt argument to specify ground truth file for translate.py and -report_bleu to get the BLEU score of your prediction.

xuyuhui666 commented 4 years ago

-tgt argument need be created ,but how to create,can u show me about this

xuyuhui666 commented 4 years ago

@liminghao1630 it seems that the reason of bad results for table structure recognition is not specifying -tgt argument or -report_bleu. but he use the wrong data,he maybe use the origin data for detecting table to recognize table

liminghao1630 commented 4 years ago

@xuyuhui666 I think u need to organize a test set and list their file name in a text file specified in the -src tag and list their ground truth in a text file specified in the -tgt tag. One image corresponds one .txt file should have same line number. Hope it helpful.

xuyuhui666 commented 4 years ago

@liminghao1630 Thanks for your repay,I have pass your pre-train model to translate my table data ,the result is not bad,but i train my model according to the official manual,my model is about 142M,not your 52M,the translate results bad by my model.pt my first step :python python preprocess.py -data_type img -src_dir data/im2text/Recognition_data/images/ -train_src data/im2text/Recognition_data/src_train.txt -train_tgt data/im2text/Recognition_data/tgt_train.txt -valid_src data/im2text/Recognition_data/src_val.txt -valid_tgt data/im2text/Recognition_data/tgt_val.txt -save_data data/demo -shard_size 14000

my question:(1)how you save model,to make your model.pt 52M (2)why my first step of preprocess.py not sucess

kbrajwani commented 3 years ago

Hey can you provide steps how to use table structure recognition pretrained model.

kbrajwani commented 3 years ago

@xuyuhui666 hey can you help me out to get results. i am not getting the text inside table. this is my colab notebook https://colab.research.google.com/drive/1xeOQ5IUpwjDmCU6orwHd2hP3coOaau1t?usp=sharing

i didn't use the -tgt.