diff --git a/doc/doc_ch/inference.md b/doc/doc_ch/inference.md index 4869eb2ce45cc86434ecbb0c29c6ed4fe90ab9e9..663533c492ab5dc0bd22cc79bd95c9d1d194d854 100644 --- a/doc/doc_ch/inference.md +++ b/doc/doc_ch/inference.md @@ -186,7 +186,7 @@ python3 tools/infer/predict_det.py --det_algorithm="EAST" --image_dir="./doc/img ``` 可视化文本检测结果默认保存到`./inference_results`文件夹里面,结果文件的名称前缀为'det_res'。结果示例如下: -![](../imgs_results/det_res_img_10_east.jpg) +(coming soon) **注意**:本代码库中,EAST后处理Locality-Aware NMS有python和c++两种版本,c++版速度明显快于python版。由于c++版本nms编译版本问题,只有python3.5环境下会调用c++版nms,其他情况将调用python版nms。 @@ -205,7 +205,7 @@ python3 tools/infer/predict_det.py --det_algorithm="SAST" --image_dir="./doc/img ``` 可视化文本检测结果默认保存到`./inference_results`文件夹里面,结果文件的名称前缀为'det_res'。结果示例如下: -![](../imgs_results/det_res_img_10_sast.jpg) +(coming soon) #### (2). 弯曲文本检测模型(Total-Text) 首先将SAST文本检测训练过程中保存的模型,转换成inference model。以基于Resnet50_vd骨干网络,在Total-Text英文数据集训练的模型为例([模型下载地址(coming soon)](link)),可以使用如下命令进行转换: @@ -221,7 +221,7 @@ python3 tools/infer/predict_det.py --det_algorithm="SAST" --image_dir="./doc/img ``` 可视化文本检测结果默认保存到`./inference_results`文件夹里面,结果文件的名称前缀为'det_res'。结果示例如下: -![](../imgs_results/det_res_img623_sast.jpg) +(coming soon) **注意**:本代码库中,SAST后处理Locality-Aware NMS有python和c++两种版本,c++版速度明显快于python版。由于c++版本nms编译版本问题,只有python3.5环境下会调用c++版nms,其他情况将调用python版nms。 @@ -245,8 +245,9 @@ python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/ch/word_4.jpg" 执行命令后,上面图像的预测结果(识别的文本和得分)会打印到屏幕上,示例如下: -Predicts of ./doc/imgs_words/ch/word_4.jpg:['实力活力', 0.89552695] - +```bash +Predicts of ./doc/imgs_words/ch/word_4.jpg:('实力活力', 0.98458153) +``` ### 2. 基于CTC损失的识别模型推理 @@ -281,7 +282,9 @@ python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words_en/word_336.png 执行命令后,上面图像的识别结果如下: -Predicts of ./doc/imgs_words_en/word_336.png:['super', 0.9999555] +```bash +Predicts of ./doc/imgs_words_en/word_336.png:('super', 0.9999073) +``` **注意**:由于上述模型是参考[DTRB](https://arxiv.org/abs/1904.01906)文本识别训练和评估流程,与超轻量级中文识别模型训练有两方面不同: @@ -313,9 +316,7 @@ python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/korean/1.jpg" - 执行命令后,上图的预测结果为: ``` text -2020-09-19 16:15:05,076-INFO: index: [205 206 38 39] -2020-09-19 16:15:05,077-INFO: word : 바탕으로 -2020-09-19 16:15:05,077-INFO: score: 0.9171358942985535 +Predicts of ./doc/imgs_words/korean/1.jpg:('바탕으로', 0.9948904) ``` @@ -378,4 +379,4 @@ python3 tools/infer/predict_system.py --image_dir="./doc/imgs_en/img_10.jpg" --d 执行命令后,识别结果图像如下: -![](../imgs_results/img_10.jpg) +(coming soon) diff --git a/doc/doc_en/inference_en.md b/doc/doc_en/inference_en.md index 12553c4cf3bc83f1f4503bfadf59fff9f7d8a8a7..411a733dd062cf347d7a2e5d5d067739bda36819 100644 --- a/doc/doc_en/inference_en.md +++ b/doc/doc_en/inference_en.md @@ -192,7 +192,7 @@ python3 tools/infer/predict_det.py --image_dir="./doc/imgs_en/img_10.jpg" --det_ The visualized text detection results are saved to the `./inference_results` folder by default, and the name of the result file is prefixed with 'det_res'. Examples of results are as follows: -![](../imgs_results/det_res_img_10_east.jpg) +(coming soon) **Note**: EAST post-processing locality aware NMS has two versions: Python and C++. The speed of C++ version is obviously faster than that of Python version. Due to the compilation version problem of NMS of C++ version, C++ version NMS will be called only in Python 3.5 environment, and python version NMS will be called in other cases. @@ -214,7 +214,7 @@ python3 tools/infer/predict_det.py --det_algorithm="SAST" --image_dir="./doc/img The visualized text detection results are saved to the `./inference_results` folder by default, and the name of the result file is prefixed with 'det_res'. Examples of results are as follows: -![](../imgs_results/det_res_img_10_sast.jpg) +(coming soon) #### (2). Curved text detection model (Total-Text) First, convert the model saved in the SAST text detection training process into an inference model. Taking the model based on the Resnet50_vd backbone network and trained on the Total-Text English dataset as an example ([model download link (coming soon)](https://paddleocr.bj.bcebos.com/SAST/sast_r50_vd_total_text.tar)), you can use the following command to convert: @@ -231,7 +231,7 @@ python3 tools/infer/predict_det.py --det_algorithm="SAST" --image_dir="./doc/img The visualized text detection results are saved to the `./inference_results` folder by default, and the name of the result file is prefixed with 'det_res'. Examples of results are as follows: -![](../imgs_results/det_res_img623_sast.jpg) +(coming soon) **Note**: SAST post-processing locality aware NMS has two versions: Python and C++. The speed of C++ version is obviously faster than that of Python version. Due to the compilation version problem of NMS of C++ version, C++ version NMS will be called only in Python 3.5 environment, and python version NMS will be called in other cases. @@ -254,8 +254,9 @@ python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/ch/word_4.jpg" After executing the command, the prediction results (recognized text and score) of the above image will be printed on the screen. -Predicts of ./doc/imgs_words/ch/word_4.jpg:['实力活力', 0.89552695] - +```bash +Predicts of ./doc/imgs_words/ch/word_4.jpg:('实力活力', 0.98458153) +``` ### 2. CTC-BASED TEXT RECOGNITION MODEL INFERENCE @@ -276,7 +277,6 @@ python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words_en/word_336.png ### 3. ATTENTION-BASED TEXT RECOGNITION MODEL INFERENCE -![](../imgs_words_en/word_336.png) The recognition model based on Attention loss is different from ctc, and additional recognition algorithm parameters need to be set --rec_algorithm="RARE" After executing the command, the recognition result of the above image is as follows: @@ -284,8 +284,13 @@ After executing the command, the recognition result of the above image is as fol python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words_en/word_336.png" --rec_model_dir="./inference/rare/" --rec_image_shape="3, 32, 100" --rec_char_type="en" --rec_algorithm="RARE" ``` -Predicts of ./doc/imgs_words_en/word_336.png:['super', 0.9999555] +![](../imgs_words_en/word_336.png) +After executing the command, the recognition result of the above image is as follows: + +```bash +Predicts of ./doc/imgs_words_en/word_336.png:('super', 0.9999073) +``` **Note**:Since the above model refers to [DTRB](https://arxiv.org/abs/1904.01906) text recognition training and evaluation process, it is different from the training of lightweight Chinese recognition model in two aspects: - The image resolution used in training is different: the image resolution used in training the above model is [3,32,100], while during our Chinese model training, in order to ensure the recognition effect of long text, the image resolution used in training is [3, 32, 320]. The default shape parameter of the inference stage is the image resolution used in training phase, that is [3, 32, 320]. Therefore, when running inference of the above English model here, you need to set the shape of the recognition image through the parameter `rec_image_shape`. @@ -318,9 +323,7 @@ python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/korean/1.jpg" - After executing the command, the prediction result of the above figure is: ``` text -2020-09-19 16:15:05,076-INFO: index: [205 206 38 39] -2020-09-19 16:15:05,077-INFO: word : 바탕으로 -2020-09-19 16:15:05,077-INFO: score: 0.9171358942985535 +Predicts of ./doc/imgs_words/korean/1.jpg:('바탕으로', 0.9948904) ``` @@ -381,4 +384,4 @@ python3 tools/infer/predict_system.py --image_dir="./doc/imgs_en/img_10.jpg" --d After executing the command, the recognition result image is as follows: -![](../imgs_results/img_10.jpg) +(coming soon) diff --git a/doc/imgs_results/2.jpg b/doc/imgs_results/2.jpg index 201ef9ee492702118cd1638ed8a0b832c1c6d9ed..99f7e63b02556506dadf8d838eee22534d21d82c 100644 Binary files a/doc/imgs_results/2.jpg and b/doc/imgs_results/2.jpg differ diff --git a/doc/imgs_results/det_res_2.jpg b/doc/imgs_results/det_res_2.jpg index aebcd8ccaca02db7ed4a09cd63ade422abc4735f..c0ae501a7aff7807f53b743745005653775b0d03 100644 Binary files a/doc/imgs_results/det_res_2.jpg and b/doc/imgs_results/det_res_2.jpg differ diff --git a/doc/imgs_results/det_res_img_10_db.jpg b/doc/imgs_results/det_res_img_10_db.jpg index bde1585cb50137ae1fd33ce7edfa59e7224ddc96..6af89f6bb32191c361c439c9d26e0239b5392fd9 100644 Binary files a/doc/imgs_results/det_res_img_10_db.jpg and b/doc/imgs_results/det_res_img_10_db.jpg differ