Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
38447673
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
38447673
编写于
10月 27, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add re export cmd in kie doc
上级
6f245230
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
78 addition
and
3 deletion
+78
-3
doc/doc_ch/kie.md
doc/doc_ch/kie.md
+39
-1
doc/doc_en/kie_en.md
doc/doc_en/kie_en.md
+39
-2
未找到文件。
doc/doc_ch/kie.md
浏览文件 @
38447673
...
@@ -438,7 +438,25 @@ inference/ser_vi_layoutxlm/
...
@@ -438,7 +438,25 @@ inference/ser_vi_layoutxlm/
└── inference.pdmodel # inference模型的模型结构文件
└── inference.pdmodel # inference模型的模型结构文件
```
```
RE任务的动转静过程适配中,敬请期待。
信息抽取模型中的RE任务转inference模型步骤如下:
```
bash
# -c 后面设置训练算法的yml配置文件
# -o 配置可选参数
# Architecture.Backbone.checkpoints 参数设置待转换的训练模型地址
# Global.save_inference_dir 参数设置转换的模型将保存的地址
python3 tools/export_model.py
-c
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml
-o
Architecture.Backbone.checkpoints
=
./output/re_vi_layoutxlm_xfund_zh/best_accuracy Global.save_inference_dir
=
./inference/re_vi_layoutxlm
```
转换成功后,在目录下有三个文件:
```
inference/re_vi_layoutxlm/
├── inference.pdiparams # inference模型的参数文件
├── inference.pdiparams.info # inference模型的参数信息,可忽略
└── inference.pdmodel # inference模型的模型结构文件
```
## 4.2 模型推理
## 4.2 模型推理
...
@@ -461,6 +479,26 @@ python3 kie/predict_kie_token_ser.py \
...
@@ -461,6 +479,26 @@ python3 kie/predict_kie_token_ser.py \
<img
src=
"../../ppstructure/docs/kie/result_ser/zh_val_42_ser.jpg"
width=
"800"
>
<img
src=
"../../ppstructure/docs/kie/result_ser/zh_val_42_ser.jpg"
width=
"800"
>
</div>
</div>
VI-LayoutXLM模型基于RE任务进行推理,可以执行如下命令:
```
bash
cd
ppstructure
python3 kie/predict_kie_token_ser_re.py
\
--kie_algorithm
=
LayoutXLM
\
--re_model_dir
=
../inference/re_vi_layoutxlm
\
--ser_model_dir
=
../inference/ser_vi_layoutxlm
\
--use_visual_backbone
=
False
\
--image_dir
=
./docs/kie/input/zh_val_42.jpg
\
--ser_dict_path
=
../train_data/XFUND/class_list_xfun.txt
\
--vis_font_path
=
../doc/fonts/simfang.ttf
\
--ocr_order_method
=
"tb-yx"
```
RE可视化结果默认保存到
`./output`
文件夹里面,结果示例如下:
<div
align=
"center"
>
<img
src=
"../../ppstructure/docs/kie/result_re/zh_val_42_re.jpg"
width=
"800"
>
</div>
# 5. FAQ
# 5. FAQ
...
...
doc/doc_en/kie_en.md
浏览文件 @
38447673
...
@@ -457,14 +457,31 @@ inference/ser_vi_layoutxlm/
...
@@ -457,14 +457,31 @@ inference/ser_vi_layoutxlm/
└── inference.pdmodel # The program file of recognition
└── inference.pdmodel # The program file of recognition
```
```
Export of RE model is also in adaptation
.
The RE model can be converted to the inference model using the following command
.
```
bash
# -c Set the training algorithm yml configuration file.
# -o Set optional parameters.
# Architecture.Backbone.checkpoints Set the training model address.
# Global.save_inference_dir Set the address where the converted model will be saved.
python3 tools/export_model.py
-c
configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml
-o
Architecture.Backbone.checkpoints
=
./output/re_vi_layoutxlm_xfund_zh/best_accuracy Global.save_inference_dir
=
./inference/re_vi_layoutxlm
```
After the conversion is successful, there are three files in the model save directory:
```
inference/re_vi_layoutxlm/
├── inference.pdiparams # The parameter file of recognition inference model
├── inference.pdiparams.info # The parameter information of recognition inference model, which can be ignored
└── inference.pdmodel # The program file of recognition
```
## 4.2 Model inference
## 4.2 Model inference
The VI layoutxlm model performs reasoning based on the ser task, and can execute the following commands:
The VI layoutxlm model performs reasoning based on the ser task, and can execute the following commands:
Using the following command to infer the VI-LayoutXLM model.
Using the following command to infer the VI-LayoutXLM
SER
model.
```
bash
```
bash
cd
ppstructure
cd
ppstructure
...
@@ -483,6 +500,26 @@ The visualized result will be saved in `./output`, which is shown as follows.
...
@@ -483,6 +500,26 @@ The visualized result will be saved in `./output`, which is shown as follows.
<img
src=
"../../ppstructure/docs/kie/result_ser/zh_val_42_ser.jpg"
width=
"800"
>
<img
src=
"../../ppstructure/docs/kie/result_ser/zh_val_42_ser.jpg"
width=
"800"
>
</div>
</div>
Using the following command to infer the VI-LayoutXLM RE model.
```
bash
cd
ppstructure
python3 kie/predict_kie_token_ser_re.py
\
--kie_algorithm
=
LayoutXLM
\
--re_model_dir
=
../inference/re_vi_layoutxlm
\
--ser_model_dir
=
../inference/ser_vi_layoutxlm
\
--use_visual_backbone
=
False
\
--image_dir
=
./docs/kie/input/zh_val_42.jpg
\
--ser_dict_path
=
../train_data/XFUND/class_list_xfun.txt
\
--vis_font_path
=
../doc/fonts/simfang.ttf
\
--ocr_order_method
=
"tb-yx"
```
The visualized result will be saved in
`./output`
, which is shown as follows.
<div
align=
"center"
>
<img
src=
"../../ppstructure/docs/kie/result_re/zh_val_42_re.jpg"
width=
"800"
>
</div>
# 5. FAQ
# 5. FAQ
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录