PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Apache License 2.0
38.99k stars 7.32k forks source link

text detection and recognizer for PaddleOCR KIE for RE #11996

Closed piarosebelledelapaz closed 3 weeks ago

piarosebelledelapaz commented 3 weeks ago

i did an inference using the pretrained model for paddleOCR KIE for relation extraction, but i noticed that it is not detecting all the objects in the image, and the text being recognized is also not accurate.

if i finetune the model for RE using my own dataset, would this also increase the accuracy for text detection and recognition or just determining the relationship between two words?

i already finetuned the object detection model and text recognition model of PaddleOCR using my custom dataset, would the fine-tuned weights be useful in a way for training the RE model?

UserWangZz commented 3 weeks ago

Fine tuning the RE model cannot improve the accuracy of text detection and recognition, but it will enhance the ability to determine text relationships. If you have made minor adjustments to the custom data, you can replace the official OCR model during the inference phase. The specific command to run is as follows:

python3 ./tools/infer_kie_token_ser_re.py \ -c configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml \ -o Architecture.Backbone.checkpoints=./pretrained_model/re_vi_layoutxlm_xfund_pretrained/best_accuracy \ Global.infer_img=./train_data/XFUND/zh_val/image/zh_val_42.jpg \ Global.kie_det_model_dir=path/to/your/det_model \ Global.kie_rec_model_dir=path/to/your/rec_model \ -c_ser configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml \ -o_ser Architecture.Backbone.checkpoints=./pretrained_model/ser_vi_layoutxlm_xfund_pretrained/best_accuracy

For more specific steps, please refer to the documentation: https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppstructure/kie/README_ch.md

piarosebelledelapaz commented 3 weeks ago

oh okay, i will try it. thank you so much for the quick feedback!