From 97b454b884903e7daefb3352abcc368e9c0d8a95 Mon Sep 17 00:00:00 2001 From: Zhang Zelun <33217105+BluebirdStory@users.noreply.github.com> Date: Mon, 19 May 2025 22:57:10 +0800 Subject: [PATCH] add docs for text_image_unwarping (#15177) --- .../module_usage/text_image_unwarping.en.md | 288 ++++++++++++++++++ .../module_usage/text_image_unwarping.md | 2 + 2 files changed, 290 insertions(+) create mode 100644 docs/version3.x/module_usage/text_image_unwarping.en.md diff --git a/docs/version3.x/module_usage/text_image_unwarping.en.md b/docs/version3.x/module_usage/text_image_unwarping.en.md new file mode 100644 index 0000000000..3e5e5c3544 --- /dev/null +++ b/docs/version3.x/module_usage/text_image_unwarping.en.md @@ -0,0 +1,288 @@ +--- + +comments: true + +--- + +# Text Image Rectification Module Usage Tutorial + +## 1. Overview + +The primary purpose of text image rectification is to perform geometric transformations on images to correct distortions, inclinations, perspective deformations, etc., in the document images for more accurate subsequent text recognition. + +## 2. Supported Model List + +
| Model | Model Download Link | +CER | +Model Storage Size (M) | +Description | +
|---|---|---|---|---|
| UVDoc | Inference Model/Training Model | +0.179 | +30.3 M | +High-accuracy text image rectification model | +
| Mode | +GPU Configuration | +CPU Configuration | +Acceleration Technology Combination | +
|---|---|---|---|
| Regular Mode | +FP32 Precision / No TRT Acceleration | +FP32 Precision / 8 Threads | +PaddleInference | +
| High-Performance Mode | +Choose the optimal combination of prior precision type and acceleration strategy | +FP32 Precision / 8 Threads | +Choose the optimal prior backend (Paddle/OpenVINO/TRT, etc.) | +
+
+The relevant methods, parameters, etc., are described as follows:
+
+* `TextImageUnwarping` instantiates the image rectification model (taking `UVDoc` as an example here), with specific explanations as follows:
+| Parameter | +Description | +Type | +Options | +Default Value | +
|---|---|---|---|---|
model_name |
+Model Name | +str |
+All model names supported by PaddleX | +None | +
model_dir |
+Model Storage Path | +str |
+None | +None | +
device |
+Model Inference Device | +str |
+Supports specifying specific GPU card numbers, such as “gpu:0”, specific hardware card numbers, such as “npu:0”, CPU as “cpu”. | +gpu:0 |
+
use_hpip |
+Whether to enable high-performance inference plugin | +bool |
+None | +False |
+
hpi_config |
+High-Performance Inference Configuration | +dict | None |
+None | +None |
+
| Parameter | +Description | +Type | +Options | +Default Value | +
|---|---|---|---|---|
input |
+Data to be predicted, supports multiple input types | +Python Var/str/dict/list |
+
+
|
+None | +
batch_size |
+Batch Size | +int |
+Any integer | +1 | +
| Method | +Description | +Parameter | +Type | +Parameter Description | +Default Value | +
|---|---|---|---|---|---|
print() |
+Print result to 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, effective only when format_json is True |
+4 | +||
ensure_ascii |
+bool |
+Controls whether to escape non-ASCII characters into Unicode. When set to True, all non-ASCII characters will be escaped; False will retain the original characters, effective only when format_json is True |
+False |
+||
save_to_json() |
+Save the result as a json format file | +save_path |
+str |
+The path to save the file. When specified as a directory, the saved file is named consistent with the input file type. | +None | +
indent |
+int |
+Specifies the indentation level to beautify the output JSON data, making it more readable, effective only when format_json is True |
+4 | +||
ensure_ascii |
+bool |
+Controls whether to escape non-ASCII characters into Unicode. When set to True, all non-ASCII characters will be escaped; False will retain the original characters, effective only when format_json is True |
+False |
+||
save_to_img() |
+Save the result as an image format file | +save_path |
+str |
+The path to save the file. When specified as a directory, the saved file is named consistent with the input file type. | +None | +
| Attribute | +Description | +
|---|---|
json |
+Get the prediction result in json format |
+
img |
+Get the visualized image in dict format |
+