--- comments: true --- # Text Recognition Module Tutorial ## 1. Overview The text recognition module is the core part of the OCR (Optical Character Recognition) system, responsible for extracting text information from text regions in images. The performance of this module directly affects the accuracy and efficiency of the entire OCR system. The text recognition module usually receives the bounding boxes of text regions output by the text detection module as input, and then converts the text in the images into editable and searchable electronic text through complex image processing and deep learning algorithms. The accuracy of text recognition results is crucial for subsequent applications such as information extraction and data mining. ## 2. List of Supported Models
Model | Model Download Links | Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|
PP-OCRv5_server_rec | Inference Model/Pretrained Model | 86.38 | 8.46 / 2.36 | 31.21 / 31.21 | 81 | PP-OCRv5_rec is a new generation text recognition model. It is designed to efficiently and accurately support the recognition of Simplified Chinese, Traditional Chinese, English, Japanese, as well as complex text scenarios such as handwriting, vertical text, pinyin, and rare characters with a single model. While maintaining recognition performance, it also balances inference speed and model robustness, providing efficient and accurate technical support for document understanding in various scenarios. |
PP-OCRv5_mobile_rec | Inference Model/Pretrained Model | 81.29 | 5.43 / 1.46 | 21.20 / 5.32 | 16 | |
PP-OCRv4_server_rec_doc | Inference Model/Pretrained Model | 86.58 | 8.69 / 2.78 | 37.93 / 37.93 | 182 | PP-OCRv4_server_rec_doc is trained on a mixed dataset of more Chinese document data and PP-OCR training data, building upon PP-OCRv4_server_rec. It enhances the recognition capabilities for some Traditional Chinese characters, Japanese characters, and special symbols, supporting over 15,000 characters. In addition to improving document-related text recognition, it also enhances general text recognition capabilities. |
PP-OCRv4_mobile_rec | Inference Model/Pretrained Model | 78.74 | 5.26 / 1.12 | 17.48 / 3.61 | 10.5 | A lightweight recognition model of PP-OCRv4 with high inference efficiency, suitable for deployment on various hardware devices, including edge devices. |
PP-OCRv4_server_rec | Inference Model/Pretrained Model | 85.19 | 8.75 / 2.49 | 36.93 / 36.93 | 173 | The server-side model of PP-OCRv4, offering high inference accuracy and deployable on various servers. |
en_PP-OCRv4_mobile_rec | Inference Model/Pretrained Model | 70.39 | 4.81 / 1.23 | 17.20 / 4.18 | 7.5 | An ultra-lightweight English recognition model trained based on the PP-OCRv4 recognition model, supporting English and numeric character recognition. |
Model | Model Download Links | Chinese Recognition Avg Accuracy(%) | English Recognition Avg Accuracy(%) | Traditional Chinese Recognition Avg Accuracy(%) | Japanese Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|---|---|---|
PP-OCRv5_server_rec | Inference Model/Pretrained Model | 86.38 | 64.70 | 93.29 | 60.35 | 8.46 / 2.36 | 31.21 / 31.21 | 81 | PP-OCRv5_rec is a new generation text recognition model. It is designed to efficiently and accurately support the recognition of Simplified Chinese, Traditional Chinese, English, Japanese, as well as complex text scenarios such as handwriting, vertical text, pinyin, and rare characters with a single model. While maintaining recognition performance, it also balances inference speed and model robustness, providing efficient and accurate technical support for document understanding in various scenarios. |
PP-OCRv5_mobile_rec | Inference Model/Pretrained Model | 81.29 | 66.00 | 83.55 | 54.65 | 5.43 / 1.46 | 21.20 / 5.32 | 16 |
Model | Model Download Links | Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|
PP-OCRv4_server_rec_doc | Inference Model/Pretrained Model | 86.58 | 8.69 / 2.78 | 37.93 / 37.93 | 182 | PP-OCRv4_server_rec_doc is trained on a mixed dataset of more Chinese document data and PP-OCR training data, building upon PP-OCRv4_server_rec. It enhances the recognition capabilities for some Traditional Chinese characters, Japanese characters, and special symbols, supporting over 15,000 characters. In addition to improving document-related text recognition, it also enhances general text recognition capabilities. |
PP-OCRv4_mobile_rec | Inference Model/Pretrained Model | 78.74 | 5.26 / 1.12 | 17.48 / 3.61 | 10.5 | A lightweight recognition model of PP-OCRv4 with high inference efficiency, suitable for deployment on various hardware devices, including edge devices. |
PP-OCRv4_server_rec | Inference Model/Pretrained Model | 85.19 | 8.75 / 2.49 | 36.93 / 36.93 | 173 | The server-side model of PP-OCRv4, offering high inference accuracy and deployable on various servers. |
PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 72.96 | 3.89 / 1.16 | 8.72 / 3.56 | 10.3 | A lightweight recognition model of PP-OCRv3 with high inference efficiency, suitable for deployment on various hardware devices, including edge devices. |
Model | Model Download Links | Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|
ch_SVTRv2_rec | Inference Model/Pretrained Model | 68.81 | 10.38 / 8.31 | 66.52 / 30.83 | 80.5 | SVTRv2 is a server-side text recognition model developed by the OpenOCR team of the Vision and Learning Lab (FVL) at Fudan University. It won the first prize in the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task, with a 6% improvement in end-to-end recognition accuracy on Leaderboard A compared to PP-OCRv4. |
Model | Model Download Links | Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|
ch_RepSVTR_rec | Inference Model/Pretrained Model | 65.07 | 6.29 / 1.57 | 20.64 / 5.40 | 22.1 | RepSVTR is a mobile-side text recognition model based on SVTRv2. It won the first prize in the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition Task, with a 2.5% improvement in end-to-end recognition accuracy on Leaderboard B compared to PP-OCRv4, while maintaining similar inference speed. |
Model | Model Download Links | Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|
en_PP-OCRv4_mobile_rec | Inference Model/Pretrained Model | 70.39 | 4.81 / 1.23 | 17.20 / 4.18 | 7.5 | An ultra-lightweight English recognition model trained based on the PP-OCRv4 recognition model, supporting English and numeric character recognition. |
en_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 70.69 | 3.56 / 0.78 | 8.44 / 5.78 | 17.3 | An ultra-lightweight English recognition model trained based on the PP-OCRv3 recognition model, supporting English and numeric character recognition. |
Model | Model Download Links | Recognition Avg Accuracy(%) | GPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High-Performance Mode] |
Model Storage Size (MB) | Introduction |
---|---|---|---|---|---|---|
korean_PP-OCRv5_mobile_rec | Inference Model/Pre-trained Model | 88.0 | 5.43 / 1.46 | 21.20 / 5.32 | 14 | An ultra-lightweight Korean text recognition model trained based on the PP-OCRv5 recognition framework. Supports Korean, English and numeric text recognition. |
latin_PP-OCRv5_mobile_rec | Inference Model/Pre-trained Model | 84.7 | 5.43 / 1.46 | 21.20 / 5.32 | 14 | A Latin-script text recognition model trained based on the PP-OCRv5 recognition framework. Supports most Latin alphabet languages and numeric text recognition. |
eslav_PP-OCRv5_mobile_rec | Inference Model/Pre-trained Model | 81.6 | 5.43 / 1.46 | 21.20 / 5.32 | 14 | An East Slavic language recognition model trained based on the PP-OCRv5 recognition framework. Supports East Slavic languages, English and numeric text recognition. |
korean_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 60.21 | 3.73 / 0.98 | 8.76 / 2.91 | 9.6 | An ultra-lightweight Korean recognition model trained based on the PP-OCRv3 recognition model, supporting Korean and numeric character recognition. |
japan_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 45.69 | 3.86 / 1.01 | 8.62 / 2.92 | 9.8 | An ultra-lightweight Japanese recognition model trained based on the PP-OCRv3 recognition model, supporting Japanese and numeric character recognition. |
chinese_cht_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 82.06 | 3.90 / 1.16 | 9.24 / 3.18 | 10.8 | An ultra-lightweight Traditional Chinese recognition model trained based on the PP-OCRv3 recognition model, supporting Traditional Chinese and numeric character recognition. |
te_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 95.88 | 3.59 / 0.81 | 8.28 / 6.21 | 8.7 | An ultra-lightweight Telugu recognition model trained based on the PP-OCRv3 recognition model, supporting Telugu and numeric character recognition. |
ka_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 96.96 | 3.49 / 0.89 | 8.63 / 2.77 | 17.4 | An ultra-lightweight Kannada recognition model trained based on the PP-OCRv3 recognition model, supporting Kannada and numeric character recognition. |
ta_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 76.83 | 3.49 / 0.86 | 8.35 / 3.41 | 8.7 | An ultra-lightweight Tamil recognition model trained based on the PP-OCRv3 recognition model, supporting Tamil and numeric character recognition. |
latin_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 76.93 | 3.53 / 0.78 | 8.50 / 6.83 | 8.7 | An ultra-lightweight Latin recognition model trained based on the PP-OCRv3 recognition model, supporting Latin and numeric character recognition. |
arabic_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 73.55 | 3.60 / 0.83 | 8.44 / 4.69 | 17.3 | An ultra-lightweight Arabic alphabet recognition model trained based on the PP-OCRv3 recognition model, supporting Arabic alphabet and numeric character recognition. |
cyrillic_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 94.28 | 3.56 / 0.79 | 8.22 / 2.76 | 8.7 | An ultra-lightweight Cyrillic alphabet recognition model trained based on the PP-OCRv3 recognition model, supporting Cyrillic alphabet and numeric character recognition. |
devanagari_PP-OCRv3_mobile_rec | Inference Model/Pretrained Model | 96.44 | 3.60 / 0.78 | 6.95 / 2.87 | 8.7 | An ultra-lightweight Devanagari alphabet recognition model trained based on the PP-OCRv3 recognition model, supporting Devanagari alphabet and numeric character recognition. |
Mode | GPU Configuration | CPU Configuration | Acceleration Technology Combination |
---|---|---|---|
Normal Mode | FP32 Precision / No TRT Acceleration | FP32 Precision / 8 Threads | PaddleInference |
High-Performance Mode | Optimal combination of precision type and acceleration strategy | FP32 Precision / 8 Threads | Selection of the optimal backend (Paddle/OpenVINO/TRT, etc.) |
Parameter | Description | Type | Default |
---|---|---|---|
model_name |
If set to None , PP-OCRv5_server_rec is used. |
str|None |
None |
model_dir |
Model storage path. | str|None |
None |
device |
Device for inference. Examples: "cpu" , "gpu" , "npu" , "gpu:0" , "gpu:0,1" .If multiple devices are specified, inference will be performed in parallel. By default, GPU 0 is used; if unavailable, CPU is used. |
str|None |
None |
enable_hpi |
Whether to enable high performance inference. | bool |
False |
use_tensorrt |
Whether to enable the TensorRT subgraph engine of Paddle Inference. For Paddle with CUDA 11.8, the compatible TensorRT version is 8.x (x>=6), recommended 8.6.1.6. For Paddle with CUDA 12.6, the compatible TensorRT version is 10.x (x>=5), recommended 10.5.0.18. |
bool |
False |
precision |
Precision for TensorRT when using the Paddle Inference TensorRT subgraph engine. Options: fp32 , fp16 . |
str |
"fp32" |
enable_mkldnn |
Whether to enable MKL-DNN acceleration for inference. If MKL-DNN is unavailable or the model does not support it, acceleration will not be used even if this flag is set. | bool |
True |
mkldnn_cache_capacity |
MKL-DNN cache capacity. | int |
10 |
cpu_threads |
Number of threads to use for inference on CPUs. | int |
10 |
input_shape |
Input image size for the model in the format (C, H, W) . |
tuple|None |
None |
Parameter | Description | Type | Default |
---|---|---|---|
input |
Data to be predicted, supporting multiple input types, required.
|
Python Var|str|list |
|
batch_size |
Batch size, can be set to any positive integer. | int |
1 |
Method | Description | Parameter | Type | Description | Default |
---|---|---|---|---|---|
print() |
Print the result to the terminal | format_json |
bool |
Whether to format the output content using JSON indentation |
True |
indent |
int |
Specifies the indentation level to beautify the output JSON data, making it more readable. Only effective when format_json is True . |
4 | ||
ensure_ascii |
bool |
Controls whether to escape non-ASCII characters as Unicode . When set to True , all non-ASCII characters will be escaped; False retains the original characters. Only effective when format_json is True . |
False |
||
save_to_json() |
Save the result as a file in json format |
save_path |
str |
The file path to save the result. When it is a directory, the saved file name is consistent with the naming of the input file type. | None |
indent |
int |
Specifies the indentation level to beautify the output JSON data, making it more readable. Only effective when format_json is True . |
4 | ||
ensure_ascii |
bool |
Controls whether to escape non-ASCII characters as Unicode . When set to True , all non-ASCII characters will be escaped; False retains the original characters. Only effective when format_json is True . |
False |
||
save_to_img() |
Save the result as a file in image format | save_path |
str |
The file path to save the result. When it is a directory, the saved file name is consistent with the naming of the input file type. | None |
Attribute | Description |
---|---|
json |
Obtain the prediction result in json format |
img |
Obtain the visualized image in dict format |