Model | Download Links | -Accuracy(%) | -GPU Inference Time (ms) [Standard / High-Performance] |
-CPU Inference Time (ms) [Standard / High-Performance] |
-Model Size (MB) | +Model | Download Link | +Recognition Avg Accuracy(%) | +GPU Inference Time (ms) [Standard Mode / High Performance Mode] |
+CPU Inference Time (ms) [Standard Mode / High Performance Mode] |
+Model Size (M) | Description |
---|---|---|---|---|---|---|---|---|---|---|---|---|
65.07 | 5.93 / 1.62 | 20.73 / 7.32 | -70 | -RepSVTR, a mobile-optimized version of SVTRv2, won first prize in the PaddleOCR Challenge, improving accuracy by 2.5% over PP-OCRv4 with comparable speed. | +22.1 M | +RepSVTR is a mobile text recognition model based on SVTRv2. It won first prize in the PaddleOCR Algorithm Model Challenge - Task 1: OCR End-to-End Recognition, improving end-to-end recognition accuracy by 2.5% compared to PP-OCRv4 on List B while maintaining comparable inference speed. |
Model | Download Links | -Accuracy(%) | -GPU Inference Time (ms) [Standard / High-Performance] |
-CPU Inference Time (ms) [Standard / High-Performance] |
-Model Size (MB) | +Model | Download Link | +Recognition Avg Accuracy(%) | +GPU Inference Time (ms) [Standard Mode / High Performance Mode] |
+CPU Inference Time (ms) [Standard Mode / High Performance Mode] |
+Model Size (M) | Description |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Python Var|str|list |
-- | |||||||||||
save_path |
-Path to save inference results. If None , results are not saved locally. |
-str |
-- | |||||||||
doc_orientation_classify_model_name |
-Name of the document orientation classification model. If None , the default pipeline model is used. |
-str |
-None |
-|||||||||
doc_orientation_classify_model_dir |
-Directory path of the document orientation classification model. If None , the official model is downloaded. |
-str |
-None |
-|||||||||
doc_unwarping_model_name |
-Name of the text image correction model. If None , the default pipeline model is used. |
-str |
-None |
-|||||||||
doc_unwarping_model_dir |
-Directory path of the text image correction model. If None , the official model is downloaded. |
-str |
-None |
-|||||||||
text_detection_model_name |
-Name of the text detection model. If None , the default pipeline model is used. |
-str |
-None |
-|||||||||
text_detection_model_dir |
-Directory path of the text detection model. If None , the official model is downloaded. |
-str |
-None |
-|||||||||
text_line_orientation_model_name |
-Name of the text line orientation model. If None , the default pipeline model is used. |
-str |
-None |
-|||||||||
text_line_orientation_model_dir |
-Directory path of the text line orientation model. If None , the official model is downloaded. |
-str |
-None |
-|||||||||
text_line_orientation_batch_size |
-Batch size for the text line orientation model. If None , defaults to 1 . |
-int |
-None |
-|||||||||
text_recognition_model_name |
-Name of the text recognition model. If None , the default pipeline model is used. |
-str |
-None |
-|||||||||
text_recognition_model_dir |
-Directory path of the text recognition model. If None , the official model is downloaded. |
-str |
-None |
-|||||||||
text_recognition_batch_size |
-Batch size for the text recognition model. If None , defaults to 1 . |
-int |
-None |
-|||||||||
use_doc_orientation_classify |
-Whether to enable document orientation classification. If None , defaults to pipeline initialization value (True ). |
-bool |
-None |
-|||||||||
use_doc_unwarping |
-Whether to enable text image correction. If None , defaults to pipeline initialization value (True ). |
-bool |
-None |
-|||||||||
use_textline_orientation |
-Whether to enable text line orientation classification. If None , defaults to pipeline initialization value (True ). |
-bool |
-None |
-|||||||||
text_det_limit_side_len |
-Maximum side length limit for text detection.
-
|
-int |
-None |
-|||||||||
text_det_limit_type |
-Side length limit type for text detection.
-
|
-str |
-None |
-|||||||||
text_det_thresh |
-Pixel threshold for text detection. Pixels with scores > this threshold are considered text.
-
|
-float |
-None |
-|||||||||
text_det_box_thresh |
-Box threshold for text detection. Detected regions with average scores > this threshold are retained.
-
|
-float |
-None |
-|||||||||
text_det_unclip_ratio |
-Expansion ratio for text detection. Larger values expand text regions more.
-
|
-float |
-None |
-|||||||||
text_det_input_shape |
-Input shape for text detection. | -tuple |
-None |
-|||||||||
text_rec_score_thresh |
-Score threshold for text recognition. Results with scores > this threshold are retained.
-
|
-float |
-None |
-|||||||||
text_rec_input_shape |
-Input shape for text recognition. | -tuple |
-None |
-|||||||||
lang |
-Specifies the OCR model language.
-
|
-str |
-None |
-|||||||||
ocr_version |
-OCR model version.
-
|
-str |
-None |
-|||||||||
device |
-Device for inference. Supports:
-
|
-str |
-None |
-|||||||||
enable_hpi |
-Whether to enable high-performance inference. | -bool |
-False |
-|||||||||
use_tensorrt |
-Whether to use TensorRT for acceleration. | -bool |
-False |
-|||||||||
min_subgraph_size |
-Minimum subgraph size for model optimization. | -int |
-3 |
-|||||||||
precision |
-Computation precision (e.g., fp32 , fp16 ). |
-str |
-fp32 |
-|||||||||
enable_mkldnn |
-Whether to enable MKL-DNN acceleration. If None , enabled by default. |
-bool |
-None |
-|||||||||
cpu_threads |
-Number of CPU threads for inference. | -int |
-8 |
-
paddlex_config |
-Path to PaddleX pipeline configuration file. | +Parameter | +Parameter Description | +Parameter Type | +Default Value | +
---|---|---|---|---|---|
input |
+Data to be predicted, supporting multiple input types (required).
+
|
+Python Var|str|list |
++ | ||
save_path |
+Path to save inference result files. If set to None , inference results will not be saved locally. |
str |
None |
doc_orientation_classify_model_name
None
, the production line default model will be used.str
None
doc_orientation_classify_model_dir
None
, the official model will be downloaded.str
None
doc_unwarping_model_name
None
, the production line default model will be used.str
None
doc_unwarping_model_dir
None
, the official model will be downloaded.str
None
text_detection_model_name
None
, the production line default model will be used.str
None
text_detection_model_dir
None
, the official model will be downloaded.str
None
text_line_orientation_model_name
None
, the production line default model will be used.str
None
text_line_orientation_model_dir
None
, the official model will be downloaded.str
None
text_line_orientation_batch_size
None
, the default batch size will be 1
.int
None
text_recognition_model_name
None
, the production line default model will be used.str
None
text_recognition_model_dir
None
, the official model will be downloaded.str
None
text_recognition_batch_size
None
, the default batch size will be 1
.int
None
use_doc_orientation_classify
None
, the production line's initialized value for this parameter (initialized to True
) will be used.bool
None
use_doc_unwarping
None
, the production line's initialized value for this parameter (initialized to True
) will be used.bool
None
use_textline_orientation
None
, the production line's initialized value for this parameter (initialized to True
) will be used.bool
None
text_det_limit_side_len
0
; None
, the production line's initialized value for this parameter (initialized to 960
) will be used; int
None
text_det_limit_type
min
and max
. min
means ensuring the shortest side of the image is not smaller than det_limit_side_len
, and max
means ensuring the longest side of the image is not larger than limit_side_len
None
, the production line's initialized value for this parameter (initialized to max
) will be used; str
None
text_det_thresh
0
+None
, the production line's initialized value for this parameter (0.3
) will be usedfloat
None
text_det_box_thresh
0
+None
, the production line's initialized value for this parameter (0.6
) will be usedfloat
None
text_det_unclip_ratio
0
+None
, the production line's initialized value for this parameter (2.0
) will be usedfloat
None
text_det_input_shape
tuple
None
text_rec_score_thresh
0
+None
, the production line's initialized value for this parameter (0.0
, i.e., no threshold) will be usedfloat
None
text_rec_input_shape
tuple
None
lang
None
, ch
will be used by default; str
None
ocr_version
PP-OCRv5
series models;
+PP-OCRv4
series models;
+PP-OCRv3
series models;
+None
, PP-OCRv5
series models will be used by default; str
None
det_model_dir
text_detection_model_dir
instead. Directory path of the text detection model. If set to None, the official model will be downloaded.str
None
det_limit_side_len
text_det_limit_side_len
instead. Maximum side length limit for text detection.int
None
det_limit_type
text_det_limit_type
instead. Type of side length limit for text detection.
+min
and max
. min
means ensuring the shortest side of the image is not smaller than det_limit_side_len
, and max
means ensuring the longest side of the image is not larger than limit_side_len
None
, the production line's initialized value for this parameter (initialized to max
) will be used; str
None
det_db_thresh
text_det_thresh
instead. Pixel threshold for text detection. In the output probability map, pixels with scores higher than this threshold will be considered text pixels.
+0
+None
, the production line's initialized value for this parameter (0.3
) will be usedfloat
None
det_db_box_thresh
text_det_box_thresh
instead. Text detection box threshold. If the average score of all pixels within the detected result boundary is higher than this threshold, the result will be considered a text region.
+0
+None
, the production line's initialized value for this parameter (0.6
) will be usedfloat
None
det_db_unclip_ratio
text_det_unclip_ratio
instead. Text detection expansion coefficient. This method is used to expand the text region—the larger the value, the larger the expanded area.
+0
+None
, the production line's initialized value for this parameter (2.0
) will be usedfloat
None
rec_model_dir
text_recognition_model_dir
instead. Directory path of the text recognition model. If set to None
, the official model will be downloaded.str
None
rec_batch_num
text_recognition_batch_size
instead. Batch size for the text recognition model. If set to None
, the default batch size will be 1
.int
None
use_angle_cls
use_textline_orientation
instead. Whether to use the text line orientation function. If set to None
, the production line's initialized value for this parameter (initialized to True
) will be used.bool
None
cls_model_dir
text_line_orientation_model_dir
instead. Directory path of the text line orientation model. If set to None
, the official model will be downloaded.str
None
cls_batch_num
text_line_orientation_batch_size
instead. Batch size for the text line orientation model. If set to None
, the default batch size will be 1
.int
None
device
cpu
indicates using CPU for inference;gpu:0
indicates using the 1st GPU for inference;npu:0
indicates using the 1st NPU for inference;xpu:0
indicates using the 1st XPU for inference;mlu:0
indicates using the 1st MLU for inference;dcu:0
indicates using the 1st DCU for inference;None
, the production line's initialized value for this parameter will be used. During initialization, the local GPU device 0 will be preferred; if unavailable, the CPU device will be used;str
None
enable_hpi
bool
False
use_tensorrt
bool
False
min_subgraph_size
int
3
precision
str
fp32
enable_mkldnn
None
, it will be enabled by default.
+bool
None
cpu_threads
int
8
paddlex_config
str
None
PaddleOCR()
. Parameter details:PaddleOCR()
, with specific parameter descriptions as follows:Parameter | -Description | -Type | -Default | -||||||
---|---|---|---|---|---|---|---|---|---|
doc_orientation_classify_model_name |
-Name of the document orientation model. If None , uses the default pipeline model. |
-str |
-None |
-||||||
doc_orientation_classify_model_dir |
-Directory path of the document orientation model. If None , downloads the official model. |
-str |
-None |
-||||||
doc_unwarping_model_name |
-Name of the text image correction model. If None , uses the default pipeline model. |
-str |
-None |
-||||||
doc_unwarping_model_dir |
-Directory path of the text image correction model. If None , downloads the official model. |
-str |
-None |
-||||||
text_detection_model_name |
-Name of the text detection model. If None , uses the default pipeline model. |
-str |
-None |
-||||||
text_detection_model_dir |
-Directory path of the text detection model. If None , downloads the official model. |
-str |
-None |
-||||||
text_line_orientation_model_name |
-Name of the text line orientation model. If None , uses the default pipeline model. |
-str |
-None |
-||||||
text_line_orientation_model_dir |
-Directory path of the text line orientation model. If None , downloads the official model. |
-str |
-None |
-||||||
text_line_orientation_batch_size |
-Batch size for the text line orientation model. If None , defaults to 1 . |
-int |
-None |
-||||||
text_recognition_model_name |
-Name of the text recognition model. If None , uses the default pipeline model. |
-str |
-None |
-||||||
text_recognition_model_dir |
-Directory path of the text recognition model. If None , downloads the official model. |
-str |
-None |
-||||||
text_recognition_batch_size |
-Batch size for the text recognition model. If None , defaults to 1 . |
-int |
-None |
-||||||
use_doc_orientation_classify |
-Whether to enable document orientation classification. If None , defaults to pipeline initialization (True ). |
-bool |
-None |
-||||||
use_doc_unwarping |
-Whether to enable text image correction. If None , defaults to pipeline initialization (True ). |
-bool |
-None |
-||||||
use_textline_orientation |
-Whether to enable text line orientation classification. If None , defaults to pipeline initialization (True ). |
-bool |
-None |
-||||||
text_det_limit_side_len |
-Maximum side length limit for text detection.
-
|
-int |
-None |
-||||||
text_det_limit_type |
-Side length limit type for text detection.
-
|
-str |
-None |
-||||||
text_det_thresh |
-Pixel threshold for text detection. Pixels with scores > this threshold are considered text.
-
|
-float |
-None |
-||||||
text_det_box_thresh |
-Box threshold for text detection. Detected regions with average scores > this threshold are retained.
-
|
-float |
-None |
-||||||
text_det_unclip_ratio |
-Expansion ratio for text detection. Larger values expand text regions more.
-
|
-float |
-None |
-||||||
text_det_input_shape |
-Input shape for text detection. | -tuple |
-None |
-||||||
text_rec_score_thresh |
-Score threshold for text recognition. Results with scores > this threshold are retained.
-
|
-float |
-None |
-||||||
text_rec_input_shape |
-Input shape for text recognition. | -tuple |
-None |
-||||||
lang |
-Specifies the OCR model language.
-
|
-str |
-None |
-||||||
ocr_version |
-OCR model version.
-
|
-str |
-None |
-||||||
device |
-Device for inference. Supports:
-
|
-str |
-None |
-||||||
enable_hpi |
-Whether to enable high-performance inference. | -bool |
-False |
-||||||
use_tensorrt |
-Whether to use TensorRT for acceleration. | -bool |
-False |
-||||||
min_subgraph_size |
-Minimum subgraph size for model optimization. | -int |
-3 |
-||||||
precision |
-Computation precision (e.g., fp32 , fp16 ). |
-str |
-fp32 |
-||||||
enable_mkldnn |
-Whether to enable MKL-DNN acceleration. If None , enabled by default. |
-bool |
-None |
-||||||
cpu_threads |
-Number of CPU threads for inference. | -int |
-8 |
-
Parameter | +Parameter Description | +Parameter Type | +Default Value | +||
---|---|---|---|---|---|
paddlex_config |
-Path to PaddleX pipeline configuration file. | +doc_orientation_classify_model_name |
+Name of the document orientation classification model. If set to None , the production line's default model will be used. |
str |
None |
predict()
method for inference. Alternatively, predict_iter()
returns a generator for memory-efficient batch processing. Parameters:Parameter | -Description | -Type | -Default | -|
---|---|---|---|---|
input |
-Input data (required). Supports:
-
|
-Python Var|str|list |
-- | |
device |
-Same as initialization. | -str |
-None |
-|
use_doc_orientation_classify |
-Whether to enable document orientation classification during inference. | -bool |
-None |
-|
use_doc_unwarping |
-Whether to enable text image correction during inference. | -bool |
-None |
-use_textline_orientation |
-Whether to enable text line orientation classification during inference. | -bool |
-None |
-
-text_det_limit_side_len |
-Same as initialization. | -int |
-None |
-
-text_det_limit_type |
-Same as initialization. | -str |
-None |
-
-text_det_thresh |
-Same as initialization. | -float |
-None |
-
-text_det_box_thresh |
-Same as initialization. | -float |
-None |
-
-text_det_unclip_ratio |
-Same as initialization. | -float |
-None |
-
+
doc_orientation_classify_model_dir |
+Directory path of the document orientation classification model. If set to None , the official model will be downloaded. |
+str |
+None |
+|
doc_unwarping_model_name |
+Name of the text image unwarping model. If set to None , the production line's default model will be used. |
+str |
+None |
+|
doc_unwarping_model_dir |
+Directory path of the text image unwarping model. If set to None , the official model will be downloaded. |
+str |
+None |
+|
text_detection_model_name |
+Name of the text detection model. If set to None , the production line's default model will be used. |
+str |
+None |
+|
text_detection_model_dir |
+Directory path of the text detection model. If set to None , the official model will be downloaded. |
+str |
+None |
+|
text_line_orientation_model_name |
+Name of the text line orientation model. If set to None , the production line's default model will be used. |
+str |
+None |
+|
text_line_orientation_model_dir |
+Directory path of the text line orientation model. If set to None , the official model will be downloaded. |
+str |
+None |
+|
text_line_orientation_batch_size |
+Batch size for the text line orientation model. If set to None , the default batch size will be 1 . |
+int |
+None |
+|
text_recognition_model_name |
+Name of the text recognition model. If set to None , the production line's default model will be used. |
+str |
+None |
+|
text_recognition_model_dir |
+Directory path of the text recognition model. If set to None , the official model will be downloaded. |
+str |
+None |
+|
text_recognition_batch_size |
+Batch size for the text recognition model. If set to None , the default batch size will be 1 . |
+int |
+None |
+|
use_doc_orientation_classify |
+Whether to use the document orientation classification function. If set to None , the production line's initialized value for this parameter (initialized to True ) will be used. |
+bool |
+None |
+|
use_doc_unwarping |
+Whether to use the text image unwarping function. If set to None , the production line's initialized value for this parameter (initialized to True ) will be used. |
+bool |
+None |
+|
use_textline_orientation |
+Whether to use the text line orientation function. If set to None , the production line's initialized value for this parameter (initialized to True ) will be used. |
+bool |
+None |
+|
text_det_limit_side_len |
+Maximum side length limit for text detection.
+
|
+int |
+None |
+|
text_det_limit_type |
+Type of side length limit for text detection.
+
|
+str |
+None |
+|
text_det_thresh |
+Pixel threshold for text detection. Pixels with scores higher than this threshold in the output probability map will be considered text pixels.
+
|
+float |
+None |
+|
text_det_box_thresh |
+Box threshold for text detection. A detection result will be considered a text region if the average score of all pixels within the bounding box is higher than this threshold.
+
|
+float |
+None |
+|
text_det_unclip_ratio |
+Dilation coefficient for text detection. This method is used to dilate the text region, and the larger this value, the larger the dilated area.
+
|
+float |
+None |
+|
text_det_input_shape |
+Input shape for text detection. | +tuple |
+None |
+|
text_rec_score_thresh |
-Same as initialization. | +Recognition score threshold for text. Text results with scores higher than this threshold will be retained.
+
|
+float |
+None |
+
text_rec_input_shape |
+Input shape for text recognition. | +tuple |
+None |
+|
lang |
+OCR model language to use.
+
|
+str |
+None |
+|
ocr_version |
+OCR version.
+
|
+str |
+None |
+|
device |
+Device for inference. Supports specifying a specific card number.
+
|
+str |
+None |
+|
enable_hpi |
+Whether to enable high-performance inference. | +bool |
+False |
+|
use_tensorrt |
+Whether to use TensorRT for inference acceleration. | +bool |
+False |
+|
min_subgraph_size |
+Minimum subgraph size for optimizing subgraph computation. | +int |
+3 |
+|
precision |
+Computational precision, such as fp32, fp16. | +str |
+fp32 |
+|
enable_mkldnn |
+Whether to enable the MKL-DNN acceleration library. If set to None , it will be enabled by default. |
+bool |
+None |
+|
cpu_threads |
+Number of threads used for CPU inference. | +int |
+8 |
+|
paddlex_config |
+Path to the PaddleX production line configuration file. | +str |
+None |
+
predict()
method of the OCR production line object for inference prediction, which returns a results list. Additionally, the production line provides the predict_iter()
method. Both methods are completely consistent in parameter acceptance and result return, except that predict_iter()
returns a generator
, which can process and obtain prediction results incrementally, suitable for handling large datasets or scenarios where memory saving is desired. You can choose to use either of these two methods according to actual needs. The following are the parameters and descriptions of the predict()
method:Parameter | +Parameter Description | +Parameter Type | +Default Value | +
---|---|---|---|
input |
+Data to be predicted, supporting multiple input types, required.
+
|
+Python Var|str|list |
++ |
device |
+The same as the parameter during instantiation. | +str |
+None |
+
use_doc_orientation_classify |
+Whether to use the document orientation classification module during inference. | +bool |
+None |
+
use_doc_unwarping |
+Whether to use the text image unwarping module during inference. | +bool |
+None |
+use_textline_orientation |
+Whether to use the text line orientation classification module during inference. | +bool |
+None |
+
+text_det_limit_side_len |
+The same as the parameter during instantiation. | +int |
+None |
+
+text_det_limit_type |
+The same as the parameter during instantiation. | +str |
+None |
+
+text_det_thresh |
+The same as the parameter during instantiation. | +float |
+None |
+
+text_det_box_thresh |
+The same as the parameter during instantiation. | +float |
+None |
+
+text_det_unclip_ratio |
+The same as the parameter during instantiation. | +float |
+None |
+
+text_rec_score_thresh |
+The same as the parameter during instantiation. | float |
None |
json
files:json
file:Method | -Description | +Method Description | Parameter | -Type | -Explanation | -Default | +Parameter Type | +Parameter Description | +Default Value |
---|---|---|---|---|---|---|---|---|---|
print() |
-Print results to terminal | +Print the results to the terminal | format_json |
bool |
-Whether to format output with JSON indentation |
+Whether to format the output content with JSON indentation |
True |
||
indent |
int |
-Indentation level for prettifying JSON output (only when format_json=True ) |
+Specify the indentation level to beautify the output JSON data and make it more readable, only valid when format_json is True |
4 | |||||
ensure_ascii |
bool |
-Whether to escape non-ASCII characters to Unicode (only when format_json=True ) |
+Control 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 valid when format_json is True |
False |
|||||
save_to_json() |
-Save results as JSON file | +Save the results as a json-formatted file | save_path |
str |
-Output file path (uses input filename when directory specified) | -None | +File path to save. When it is a directory, the saved file name will be consistent with the input file type name | +No default | |
indent |
int |
-Indentation level for prettifying JSON output (only when format_json=True ) |
+Specify the indentation level to beautify the output JSON data and make it more readable, only valid when format_json is True |
4 | |||||
ensure_ascii |
bool |
-Whether to escape non-ASCII characters (only when format_json=True ) |
+Control 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 valid when format_json is True |
False |
|||||
save_to_img() |
-Save results as image file | +Save the results as an image-formatted file | save_path |
str |
-Output path (supports directory or file path) | -None | +File path to save, supporting directory or file path | +No default |
print()
method outputs results to terminal with the following structure:
+- Calling the `print()` method will print the results to the terminal. The content printed to the terminal is explained as follows:
- - input_path
: (str)
Input image path
+ - `input_path`: `(str)` Input path of the image to be predicted
- - page_index
: (Union[int, None])
PDF page number (if input is PDF), otherwise None
+ - `page_index`: `(Union[int, None])` If the input is a PDF file, it indicates which page of the PDF it is; otherwise, it is `None`
- - model_settings
: (Dict[str, bool])
Pipeline configuration
- - use_doc_preprocessor
: (bool)
Whether document preprocessing is enabled
- - use_textline_orientation
: (bool)
Whether text line orientation classification is enabled
+ - `model_settings`: `(Dict[str, bool])` Model parameters configured for the production line
- - doc_preprocessor_res
: (Dict[str, Union[str, Dict[str, bool], int]])
Document preprocessing results (only when use_doc_preprocessor=True
)
- - input_path
: (Union[str, None])
Preprocessor input path (None
for numpy.ndarray
input)
- - model_settings
: (Dict)
Preprocessor configuration
- - use_doc_orientation_classify
: (bool)
Whether document orientation classification is enabled
- - use_doc_unwarping
: (bool)
Whether text image correction is enabled
- - angle
: (int)
Document orientation prediction (0-3 for 0°,90°,180°,270°; -1 if disabled)
+ - `use_doc_preprocessor`: `(bool)` Control whether to enable the document preprocessing sub-production line
+ - `use_textline_orientation`: `(bool)` Control whether to enable the text line orientation classification function
- - dt_polys
: (List[numpy.ndarray])
Text detection polygons (4 vertices per box, shape=(4,2), dtype=int16)
+ - `doc_preprocessor_res`: `(Dict[str, Union[str, Dict[str, bool], int]])` Output results of the document preprocessing sub-production line. Only exists when `use_doc_preprocessor=True`
+ - `input_path`: `(Union[str, None])` Image path accepted by the image preprocessing sub-production line. When the input is `numpy.ndarray`, it is saved as `None`
+ - `model_settings`: `(Dict)` Model configuration parameters of the preprocessing sub-production line
+ - `use_doc_orientation_classify`: `(bool)` Control whether to enable document orientation classification
+ - `use_doc_unwarping`: `(bool)` Control whether to enable text image unwarping
+ - `angle`: `(int)` Prediction result of document orientation classification. When enabled, the values are [0,1,2,3], corresponding to [0°,90°,180°,270°]; when disabled, it is -1
- - dt_scores
: (List[float])
Text detection confidence scores
+ - `dt_polys`: `(List[numpy.ndarray])` List of text detection polygon boxes. Each detection box is represented by a numpy array of 4 vertex coordinates, with the array shape being (4, 2) and the data type being int16
- - text_det_params
: (Dict[str, Dict[str, int, float]])
Text detection parameters
- - limit_side_len
: (int)
Image side length limit
- - limit_type
: (str)
Length limit handling method
- - thresh
: (float)
Text pixel classification threshold
- - box_thresh
: (float)
Detection box confidence threshold
- - unclip_ratio
: (float)
Text region expansion ratio
- - text_type
: (str)
Fixed as "general"
+ - `dt_scores`: `(List[float])` List of confidence scores for text detection boxes
- - textline_orientation_angles
: (List[int])
Text line orientation predictions (actual angles when enabled, [-1,-1,-1] when disabled)
+ - `text_det_params`: `(Dict[str, Dict[str, int, float]])` Configuration parameters for the text detection module
+ - `limit_side_len`: `(int)` Side length limit value during image preprocessing
+ - `limit_type`: `(str)` Processing method for side length limits
+ - `thresh`: `(float)` Confidence threshold for text pixel classification
+ - `box_thresh`: `(float)` Confidence threshold for text detection boxes
+ - `unclip_ratio`: `(float)` Dilation coefficient for text detection boxes
+ - `text_type`: `(str)` Type of text detection, currently fixed as "general"
- - text_rec_score_thresh
: (float)
Text recognition score threshold
+ - `textline_orientation_angles`: `(List[int])` Prediction results of text line orientation classification. When enabled, actual angle values are returned (e.g., [0,0,1]); when disabled, [-1,-1,-1] is returned
- - rec_texts
: (List[str])
Recognized texts (filtered by text_rec_score_thresh
)
+ - `text_rec_score_thresh`: `(float)` Filtering threshold for text recognition results
- - rec_scores
: (List[float])
Recognition confidence scores (filtered)
+ - `rec_texts`: `(List[str])` List of text recognition results, containing only texts with confidence scores exceeding `text_rec_score_thresh`
- - rec_polys
: (List[numpy.ndarray])
Filtered detection polygons (same format as dt_polys
)
+ - `rec_scores`: `(List[float])` List of text recognition confidence scores, filtered by `text_rec_score_thresh`
- - rec_boxes
: (numpy.ndarray)
Rectangular bounding boxes (shape=(n,4), dtype=int16) with [x_min, y_min, x_max, y_max] coordinates
+ - `rec_polys`: `(List[numpy.ndarray])` List of text detection boxes filtered by confidence, in the same format as `dt_polys`
-- save_to_json()
saves results to specified save_path
:
- - Directory: saves as save_path/{your_img_basename}_res.json
- - File: saves directly to specified path
- - Note: Converts numpy.array
to lists since JSON doesn't support numpy arrays
+ - `rec_boxes`: `(numpy.ndarray)` Array of rectangular bounding boxes for detection boxes, with shape (n, 4) and dtype int16. Each row represents the [x_min, y_min, x_max, y_max] coordinates of a rectangular box, where (x_min, y_min) is the top-left coordinate and (x_max, y_max) is the bottom-right coordinate
-- save_to_img()
saves visualization results:
- - Directory: saves as save_path/{your_img_basename}_ocr_res_img.{your_img_extension}
- - File: saves directly (not recommended for multiple images to avoid overwriting)
+- Calling the `save_to_json()` method will save the above content to the specified `save_path`. If a directory is specified, the save path will be `save_path/{your_img_basename}_res.json`. If a file is specified, it will be saved directly to that file. Since json files do not support saving numpy arrays, `numpy.array` types will be converted to list form.
+- Calling the `save_to_img()` method will save the visualization results to the specified `save_path`. If a directory is specified, the save path will be `save_path/{your_img_basename}_ocr_res_img.{your_img_extension}`. If a file is specified, it will be saved directly to that file. (The production line usually generates many result images, so it is not recommended to directly specify a specific file path, as multiple images will be overwritten, leaving only the last one.)
-* Additionally, results with visualizations and predictions can be obtained through the following attributes:
+* Additionally, you can also obtain the visualized image with results and prediction results through attributes, as follows:
Attribute | -Description | +Attribute Description |
---|---|---|
json |
-Retrieves prediction results in json format |
+Get the prediction results in json format |
img |
-Retrieves visualized images in dict format |
+Get the visualized image in dict format |
enable_mkldnn |
-是否启用 MKL-DNN 加速库。如果设置为None , 将默认启用。
- |
+是否启用 MKL-DNN 加速库。如果设置为None , 将默认启用。 |
bool |
None |