diff --git a/README.md b/README.md index eb34698d10d6de2f277fae4d87be446c01878110..6504423f245a0ad3e8552c624cc3ba0d7bc6db8f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ PaddleOCR supports both dynamic graph and static graph programming paradigm - Static graph: develop branch **Recent updates** +- 2021.4.8 release end-to-end text recognition algorithm [PGNet](https://www.aaai.org/AAAI21Papers/AAAI-2885.WangP.pdf) which is published in AAAI 2021. Find tutorial [here](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/doc/doc_en/pgnet_en.md);release multi language recognition [models](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/doc/doc_en/multi_languages_en.md), support more than 80 languages recognition; especically, the performance of [English recognition model](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/doc/doc_en/models_list_en.md#English) is Optimized. - 2021.1.21 update more than 25+ multilingual recognition models [models list](./doc/doc_en/models_list_en.md), including:English, Chinese, German, French, Japanese,Spanish,Portuguese Russia Arabic and so on. Models for more languages will continue to be updated [Develop Plan](https://github.com/PaddlePaddle/PaddleOCR/issues/1048). - 2020.12.15 update Data synthesis tool, i.e., [Style-Text](./StyleText/README.md),easy to synthesize a large number of images which are similar to the target scene image. - 2020.11.25 Update a new data annotation tool, i.e., [PPOCRLabel](./PPOCRLabel/README.md), which is helpful to improve the labeling efficiency. Moreover, the labeling results can be used in training of the PP-OCR system directly. diff --git a/deploy/hubserving/ocr_det/params.py b/deploy/hubserving/ocr_det/params.py index bc75cc404e43e0a6e9242c2684d615b4575e5d8f..ec0c447f447009a40fc2138cc33988e13c7f4243 100755 --- a/deploy/hubserving/ocr_det/params.py +++ b/deploy/hubserving/ocr_det/params.py @@ -24,11 +24,6 @@ def read_params(): cfg.use_dilation = False cfg.det_db_score_mode = "fast" - # #EAST parmas - # cfg.det_east_score_thresh = 0.8 - # cfg.det_east_cover_thresh = 0.1 - # cfg.det_east_nms_thresh = 0.2 - cfg.use_pdserving = False cfg.use_tensorrt = False diff --git a/deploy/slim/prune/README.md b/deploy/slim/prune/README.md index d9675c5a3cfc281a3a2af69b364bd528597096d7..e4407455b162019938b10a791948048bc4d5d97b 100644 --- a/deploy/slim/prune/README.md +++ b/deploy/slim/prune/README.md @@ -49,14 +49,14 @@ python3 setup.py install 进入PaddleOCR根目录,通过以下命令对模型进行敏感度分析训练: ```bash -python3.7 deploy/slim/prune/sensitivity_anal.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrain_weights="your trained model" +python3.7 deploy/slim/prune/sensitivity_anal.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrained_model="your trained model" ``` ### 4. 导出模型、预测部署 在得到裁剪训练保存的模型后,我们可以将其导出为inference_model: ```bash -pytho3.7 deploy/slim/prune/export_prune_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrain_weights=./output/det_db/best_accuracy Global.save_inference_dir=inference_model +pytho3.7 deploy/slim/prune/export_prune_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrained_model=./output/det_db/best_accuracy Global.save_inference_dir=inference_model ``` inference model的预测和部署参考: diff --git a/deploy/slim/prune/README_en.md b/deploy/slim/prune/README_en.md index 70cfd580b30dde2070e27cd3512f54f222acfaed..c2bb9d537e808d132d35571407e1ed9081970f87 100644 --- a/deploy/slim/prune/README_en.md +++ b/deploy/slim/prune/README_en.md @@ -54,7 +54,7 @@ Enter the PaddleOCR root directory,perform sensitivity analysis on the model w ```bash -python3.7 deploy/slim/prune/sensitivity_anal.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrain_weights="your trained model" +python3.7 deploy/slim/prune/sensitivity_anal.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrained_model="your trained model" ``` @@ -63,7 +63,7 @@ python3.7 deploy/slim/prune/sensitivity_anal.py -c configs/det/ch_ppocr_v2.0/ch_ We can export the pruned model as inference_model for deployment: ```bash -python deploy/slim/prune/export_prune_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrain_weights=./output/det_db/best_accuracy Global.test_batch_size_per_card=1 Global.save_inference_dir=inference_model +python deploy/slim/prune/export_prune_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrained_model=./output/det_db/best_accuracy Global.save_inference_dir=inference_model ``` Reference for prediction and deployment of inference model: diff --git a/deploy/slim/quantization/README.md b/deploy/slim/quantization/README.md index 4ac3f7c3016c9ef53724ad6f7745507cef3580a8..41ed3ef5d755c53898180f6fc24b6beb777811ed 100644 --- a/deploy/slim/quantization/README.md +++ b/deploy/slim/quantization/README.md @@ -37,12 +37,12 @@ PaddleOCR提供了一系列训练好的[模型](../../../doc/doc_ch/models_list. 量化训练的代码位于slim/quantization/quant.py 中,比如训练检测模型,训练指令如下: ```bash -python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrain_weights='your trained model' Global.save_model_dir=./output/quant_model +python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model='your trained model' Global.save_model_dir=./output/quant_model # 比如下载提供的训练模型 wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar tar -xf ch_ppocr_mobile_v2.0_det_train.tar -python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrain_weights=./ch_ppocr_mobile_v2.0_det_train/best_accuracy Global.save_inference_dir=./output/quant_inference_model +python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./ch_ppocr_mobile_v2.0_det_train/best_accuracy Global.save_inference_dir=./output/quant_inference_model ``` 如果要训练识别模型的量化,修改配置文件和加载的模型参数即可。 diff --git a/deploy/slim/quantization/README_en.md b/deploy/slim/quantization/README_en.md index 36407a2bb58ee3a36afc211ca7a8f0d786d1714f..231cdb6488b758b0678573133de59f6f22b21cc6 100644 --- a/deploy/slim/quantization/README_en.md +++ b/deploy/slim/quantization/README_en.md @@ -43,13 +43,12 @@ After the quantization strategy is defined, the model can be quantified. The code for quantization training is located in `slim/quantization/quant.py`. For example, to train a detection model, the training instructions are as follows: ```bash -python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrain_weights='your trained model' Global.save_model_dir=./output/quant_model +python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model='your trained model' Global.save_model_dir=./output/quant_model # download provided model wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar tar -xf ch_ppocr_mobile_v2.0_det_train.tar -python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrain_weights=./ch_ppocr_mobile_v2.0_det_train/best_accuracy Global.save_model_dir=./output/quant_model - +python deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./ch_ppocr_mobile_v2.0_det_train/best_accuracy Global.save_model_dir=./output/quant_model ``` diff --git a/doc/doc_ch/multi_languages.md b/doc/doc_ch/multi_languages.md index 1bebdb58fa025d5b6891fd1579285b5db956a2d4..43e47dc9b097b738af9f259059431338b5ef416f 100644 --- a/doc/doc_ch/multi_languages.md +++ b/doc/doc_ch/multi_languages.md @@ -118,7 +118,7 @@ paddleocr --image_dir doc/imgs_words_en/word_308.png --det false --lang=en * 检测预测 ``` -paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --rec false +paddleocr --image_dir doc/imgs/11.jpg --rec false ``` 结果是一个list,每个item只包含文本框 @@ -142,7 +142,7 @@ from paddleocr import PaddleOCR, draw_ocr # 同样也是通过修改 lang 参数切换语种 ocr = PaddleOCR(lang="korean") # 首次执行会自动下载模型文件 -img_path = 'doc/imgs/korean_1.jpg ' +img_path = 'doc/imgs/korean_1.jpg' result = ocr.ocr(img_path) # 可通过参数控制单独执行识别、检测 # result = ocr.ocr(img_path, det=False) 只执行识别 @@ -157,7 +157,7 @@ image = Image.open(img_path).convert('RGB') boxes = [line[0] for line in result] txts = [line[1][0] for line in result] scores = [line[1][1] for line in result] -im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/korean.ttf') +im_show = draw_ocr(image, boxes, txts, scores, font_path='doc/fonts/korean.ttf') im_show = Image.fromarray(im_show) im_show.save('result.jpg') ``` diff --git a/doc/joinus.PNG b/doc/joinus.PNG index 60b7f5662688c200b4dc4f1732aa9980b4654974..63e2a61770c90eb0601125a6f5fedde45ad49132 100644 Binary files a/doc/joinus.PNG and b/doc/joinus.PNG differ diff --git a/tools/infer/predict_det.py b/tools/infer/predict_det.py index 59bb49f90abb198933b91f222febad7a416018e8..11e78a566582d5bbfadef611dbdd401ff2041bc7 100755 --- a/tools/infer/predict_det.py +++ b/tools/infer/predict_det.py @@ -65,7 +65,9 @@ class TextDetector(object): postprocess_params["max_candidates"] = 1000 postprocess_params["unclip_ratio"] = args.det_db_unclip_ratio postprocess_params["use_dilation"] = args.use_dilation - postprocess_params["score_mode"] = args.det_db_score_mode + if hasattr(args, "det_db_score_mode"): + postprocess_params["score_mode"] = args.det_db_score_mode + elif self.det_algorithm == "EAST": postprocess_params['name'] = 'EASTPostProcess' postprocess_params["score_thresh"] = args.det_east_score_thresh