paddleocr - inference model used

PP-OCR series model comparison

PaddleOCR/ppocr_introduction.md at release/2.6 · PaddlePaddle/PaddleOCR · GitHub

(1) PP-OCR: Two-stage OCR system, in which DB is selected as the text detection algorithm, CRNN is selected as the text recognition algorithm , and a text orientation classifier is added between the detection and recognition modules .

(2) PP-OCRv2: Based on PP-OCR key optimization in five aspects, the detection model adopts CML collaborative mutual learning knowledge distillation strategy and CopyPaste data augmentation strategy; the recognition model adopts LCNet lightweight backbone network and UDML improved knowledge distillation strategy And the Enhanced CTC loss loss function improvement (as shown in the red box above), has further achieved significant improvements in inference speed and prediction effect.

(3) PP-OCRv3: Upgraded in 9 aspects based on PP-OCRv2.

Model download addresses and configuration files for each version

PaddleOCR/models_list.md at release/2.6 · PaddlePaddle/PaddleOCR · GitHub

ch_ppocr_server_v2.0_det:

Training model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar

Inference model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_infer.tar

ch_ppocr_mobile_v2.0_det:

Training model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar

Inference model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar

ch_ppocr_server_v2.0_rec:

Training model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_train.tar

Inference model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar

ch_ppocr_mobile_v2.0_rec:

Training model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_train.tar

Inference model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar

ch_ppocr_mobile_v2.0_cls:

https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_train.tar pre-training model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_train.tar

Inference model: https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar

PP-OCR inference model uses

详见:PaddleOCR/quickstart.md at static · PaddlePaddle/PaddleOCR · GitHub

git clone https://github.com/PaddlePaddle/PaddleOCR.git

Create a new inference folder, put the downloaded inference model in and unzip it:

(1) Test the effect of the det reasoning model:

python tools/infer/predict_det.py --image_dir doc/imgs/00111002.jpg --det_model_dir inference/ch_ppocr_server_v2.0_det_infer

Results are stored under inference_results: det_res_00111002.jpg and det_results.txt

 (2) Test the effect of the cls reasoning model:

python tools/infer/predict_cls.py --image_dir doc/imgs_words/ch/word_4.jpg --cls_model_dir inference/ch_ppocr_mobile_v2.0_cls_infer

 Result: Predicts of doc/imgs_words/ch/word_4.jpg:['0', 0.9999982]

The first is the angle, the second is the confidence

(3) Test the effect of the rec reasoning model:

python tools/infer/predict_rec.py --image_dir doc/imgs_words/ch/word_4.jpg --rec_model_dir inference/ch_ppocr_server_v2.0_rec_infer

 ppocr INFO: Predicts of doc/imgs_words/ch/word_4.jpg:('handed in from live tool', 0.2635100483894348)

The first is the literal result, the second is the confidence

(4) combined

python tools/infer/predict_system.py  --image_dir doc/imgs/00111002.jpg \
                                      --det_model_dir inference/ch_ppocr_server_v2.0_det_infer/ \
                                      --rec_model_dir inference/ch_ppocr_server_v2.0_rec_infer/ \
                                      --cls_model_dir inference/ch_ppocr_mobile_v2.0_cls_infer/ \
                                      --use_angle_cls True \
                                      --use_space_char True

Results are stored under inference_results: 00111002.jpg and system_results.txt

PP-OCRv3 improvement points:

PaddleOCR/PP-OCRv3_introduction.md at release/2.6 · PaddlePaddle/PaddleOCR · GitHub

PP-OCRv3 detection model training steps reference:

PaddleOCR/PP-OCRv3_det_train.md at release/2.6 · PaddlePaddle/PaddleOCR · GitHub

Guess you like

Origin blog.csdn.net/qq_39066502/article/details/131007946