diff --git a/doc/doc_ch/inference_ppocr.md b/doc/doc_ch/inference_ppocr.md index 472c0003f963d6f65fa2d0babbf6b9c7d0ec9b80..622ac995d37ce290ee51af06164b0c2aef8b5a14 100644 --- a/doc/doc_ch/inference_ppocr.md +++ b/doc/doc_ch/inference_ppocr.md @@ -7,7 +7,8 @@ - [1. 文本检测模型推理](#1-文本检测模型推理) - [2. 文本识别模型推理](#2-文本识别模型推理) - [2.1 超轻量中文识别模型推理](#21-超轻量中文识别模型推理) - - [2.2 多语言模型的推理](#22-多语言模型的推理) + - [2.2 英文识别模型推理](#22-英文识别模型推理) + - [2.3 多语言模型的推理](#23-多语言模型的推理) - [3. 方向分类模型推理](#3-方向分类模型推理) - [4. 文本检测、方向分类和文字识别串联推理](#4-文本检测方向分类和文字识别串联推理) @@ -78,9 +79,29 @@ 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.9956803321838379) ``` + + +### 2.2 英文识别模型推理 + +英文识别模型推理,可以执行如下命令, 注意修改字典路径: + +``` +# 下载英文数字识别模型: +wget https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar +tar xf en_PP-OCRv3_det_infer.tar +python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/en/word_1.png" --rec_model_dir="./en_PP-OCRv3_det_infer/" --rec_char_dict_path="ppocr/utils/en_dict.txt" +``` + +![](../imgs_words/en/word_1.png) + +执行命令后,上图的预测结果为: + +``` +Predicts of ./doc/imgs_words/en/word_1.png: ('JOINT', 0.998160719871521) +``` -### 2.2 多语言模型的推理 +### 2.3 多语言模型的推理 如果您需要预测的是其他语言模型,可以在[此链接](./models_list.md#%E5%A4%9A%E8%AF%AD%E8%A8%80%E8%AF%86%E5%88%AB%E6%A8%A1%E5%9E%8B)中找到对应语言的inference模型,在使用inference模型预测时,需要通过`--rec_char_dict_path`指定使用的字典路径, 同时为了得到正确的可视化结果,需要通过 `--vis_font_path` 指定可视化的字体路径,`doc/fonts/` 路径下有默认提供的小语种字体,例如韩文识别: ``` diff --git a/doc/doc_en/inference_ppocr_en.md b/doc/doc_en/inference_ppocr_en.md index 935f92f5144f582630a45edcc886b609ecdc82da..0f57b0ba6b226c19ecb1e0b60afdfa34302b8e78 100755 --- a/doc/doc_en/inference_ppocr_en.md +++ b/doc/doc_en/inference_ppocr_en.md @@ -8,7 +8,8 @@ This article introduces the use of the Python inference engine for the PP-OCR mo - [Text Detection Model Inference](#text-detection-model-inference) - [Text Recognition Model Inference](#text-recognition-model-inference) - [1. Lightweight Chinese Recognition Model Inference](#1-lightweight-chinese-recognition-model-inference) - - [2. Multilingual Model Inference](#2-multilingual-model-inference) + - [2. English Recognition Model Inference](#2-english-recognition-model-inference) + - [3. Multilingual Model Inference](#3-multilingual-model-inference) - [Angle Classification Model Inference](#angle-classification-model-inference) - [Text Detection Angle Classification and Recognition Inference Concatenation](#text-detection-angle-classification-and-recognition-inference-concatenation) @@ -76,10 +77,31 @@ After executing the command, the prediction results (recognized text and score) ```bash Predicts of ./doc/imgs_words_en/word_10.png:('PAIN', 0.988671) ``` + +### 2. English Recognition Model Inference - +For English recognition model inference, you can execute the following commands,you need to specify the dictionary path used by `--rec_char_dict_path`: -### 2. Multilingual Model Inference +``` +# download en model: +wget https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar +tar xf en_PP-OCRv3_det_infer.tar +python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/en/word_1.png" --rec_model_dir="./en_PP-OCRv3_det_infer/" --rec_char_dict_path="ppocr/utils/en_dict.txt" +``` + +![](../imgs_words/en/word_1.png) + + +After executing the command, the prediction result of the above figure is: + +``` +Predicts of ./doc/imgs_words/en/word_1.png: ('JOINT', 0.998160719871521) +``` + + + + +### 3. Multilingual Model Inference If you need to predict [other language models](./models_list_en.md#Multilingual), when using inference model prediction, you need to specify the dictionary path used by `--rec_char_dict_path`. At the same time, in order to get the correct visualization results, You need to specify the visual font path through `--vis_font_path`. There are small language fonts provided by default under the `doc/fonts` path, such as Korean recognition: