Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱学习的小尤
PaddleOCR
提交
94cce909
P
PaddleOCR
项目概览
爱学习的小尤
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
94cce909
编写于
12月 10, 2020
作者:
M
MissPenguin
提交者:
GitHub
12月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1339 from WenmuZhou/py_inference_doc
[Dygraph] add py inference doc
上级
836839bb
2ed027a9
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
141 addition
and
178 deletion
+141
-178
configs/cls/cls_mv3.yml
configs/cls/cls_mv3.yml
+0
-1
deploy/cpp_infer/src/ocr_cls.cpp
deploy/cpp_infer/src/ocr_cls.cpp
+2
-1
deploy/cpp_infer/src/ocr_det.cpp
deploy/cpp_infer/src/ocr_det.cpp
+2
-1
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+3
-2
doc/doc_ch/angle_class.md
doc/doc_ch/angle_class.md
+2
-2
doc/doc_ch/inference.md
doc/doc_ch/inference.md
+63
-78
doc/doc_en/angle_class_en.md
doc/doc_en/angle_class_en.md
+2
-2
doc/doc_en/inference_en.md
doc/doc_en/inference_en.md
+59
-76
tools/export_model.py
tools/export_model.py
+5
-12
tools/infer/utility.py
tools/infer/utility.py
+2
-2
train.sh
train.sh
+1
-1
未找到文件。
configs/cls/cls_mv3.yml
浏览文件 @
94cce909
...
...
@@ -8,7 +8,6 @@ Global:
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
[
0
,
1000
]
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
True
pretrained_model
:
checkpoints
:
...
...
deploy/cpp_infer/src/ocr_cls.cpp
浏览文件 @
94cce909
...
...
@@ -81,7 +81,8 @@ cv::Mat Classifier::Run(cv::Mat &img) {
void
Classifier
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
AnalysisConfig
config
;
config
.
SetModel
(
model_dir
+
".pdmodel"
,
model_dir
+
".pdiparams"
);
config
.
SetModel
(
model_dir
+
"/inference.pdmodel"
,
model_dir
+
"/inference.pdiparams"
);
if
(
this
->
use_gpu_
)
{
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
...
...
deploy/cpp_infer/src/ocr_det.cpp
浏览文件 @
94cce909
...
...
@@ -18,7 +18,8 @@ namespace PaddleOCR {
void
DBDetector
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
AnalysisConfig
config
;
config
.
SetModel
(
model_dir
+
".pdmodel"
,
model_dir
+
".pdiparams"
);
config
.
SetModel
(
model_dir
+
"/inference.pdmodel"
,
model_dir
+
"/inference.pdiparams"
);
if
(
this
->
use_gpu_
)
{
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
...
...
deploy/cpp_infer/src/ocr_rec.cpp
浏览文件 @
94cce909
...
...
@@ -103,7 +103,8 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
void
CRNNRecognizer
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
AnalysisConfig
config
;
config
.
SetModel
(
model_dir
+
".pdmodel"
,
model_dir
+
".pdiparams"
);
config
.
SetModel
(
model_dir
+
"/inference.pdmodel"
,
model_dir
+
"/inference.pdiparams"
);
if
(
this
->
use_gpu_
)
{
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
...
...
@@ -186,4 +187,4 @@ cv::Mat CRNNRecognizer::GetRotateCropImage(const cv::Mat &srcimage,
}
}
}
// namespace PaddleOCR
}
// namespace PaddleOCR
\ No newline at end of file
doc/doc_ch/angle_class.md
浏览文件 @
94cce909
...
...
@@ -62,9 +62,9 @@ PaddleOCR提供了训练脚本、评估脚本和预测脚本。
*如果您安装的是cpu版本,请将配置文件中的 `use_gpu` 字段修改为false*
```
# GPU训练 支持单卡,多卡训练,通过
selected_
gpus指定卡号
# GPU训练 支持单卡,多卡训练,通过gpus指定卡号
# 启动训练,下面的命令已经写入train.sh文件中,只需修改文件里的配置文件路径即可
python3 -m paddle.distributed.launch --
selected_
gpus '0,1,2,3,4,5,6,7' tools/train.py -c configs/cls/cls_mv3.yml
python3 -m paddle.distributed.launch --gpus '0,1,2,3,4,5,6,7' tools/train.py -c configs/cls/cls_mv3.yml
```
-
数据增强
...
...
doc/doc_ch/inference.md
浏览文件 @
94cce909
此差异已折叠。
点击以展开。
doc/doc_en/angle_class_en.md
浏览文件 @
94cce909
...
...
@@ -65,9 +65,9 @@ Start training:
```
# Set PYTHONPATH path
export PYTHONPATH=$PYTHONPATH:.
# GPU training Support single card and multi-card training, specify the card number through
selected_
gpus
# GPU training Support single card and multi-card training, specify the card number through gpus
# Start training, the following command has been written into the train.sh file, just modify the configuration file path in the file
python3 -m paddle.distributed.launch --
selected_
gpus '0,1,2,3,4,5,6,7' tools/train.py -c configs/cls/cls_mv3.yml
python3 -m paddle.distributed.launch --gpus '0,1,2,3,4,5,6,7' tools/train.py -c configs/cls/cls_mv3.yml
```
-
Data Augmentation
...
...
doc/doc_en/inference_en.md
浏览文件 @
94cce909
此差异已折叠。
点击以展开。
tools/export_model.py
浏览文件 @
94cce909
...
...
@@ -28,21 +28,15 @@ from ppocr.modeling.architectures import build_model
from
ppocr.postprocess
import
build_post_process
from
ppocr.utils.save_load
import
init_model
from
ppocr.utils.logging
import
get_logger
from
tools.program
import
load_config
def
parse_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-c"
,
"--config"
,
help
=
"configuration file to use"
)
parser
.
add_argument
(
"-o"
,
"--output_path"
,
type
=
str
,
default
=
'./output/infer/'
)
return
parser
.
parse_args
()
from
tools.program
import
load_config
,
merge_config
,
ArgsParser
def
main
():
FLAGS
=
parse_args
()
FLAGS
=
ArgsParser
().
parse_args
()
config
=
load_config
(
FLAGS
.
config
)
merge_config
(
FLAGS
.
opt
)
logger
=
get_logger
()
print
(
config
)
# build post process
post_process_class
=
build_post_process
(
config
[
'PostProcess'
],
...
...
@@ -57,8 +51,7 @@ def main():
init_model
(
config
,
model
,
logger
)
model
.
eval
()
save_path
=
'{}/{}/inference'
.
format
(
FLAGS
.
output_path
,
config
[
'Architecture'
][
'model_type'
])
save_path
=
'{}/inference'
.
format
(
config
[
'Global'
][
'save_inference_dir'
])
infer_shape
=
[
3
,
32
,
100
]
if
config
[
'Architecture'
][
'model_type'
]
!=
"det"
else
[
3
,
640
,
640
]
model
=
to_static
(
...
...
tools/infer/utility.py
浏览文件 @
94cce909
...
...
@@ -100,8 +100,8 @@ def create_predictor(args, mode, logger):
if
model_dir
is
None
:
logger
.
info
(
"not find {} model file path {}"
.
format
(
mode
,
model_dir
))
sys
.
exit
(
0
)
model_file_path
=
model_dir
+
".pdmodel"
params_file_path
=
model_dir
+
".pdiparams"
model_file_path
=
model_dir
+
"
/inference
.pdmodel"
params_file_path
=
model_dir
+
"
/inference
.pdiparams"
if
not
os
.
path
.
exists
(
model_file_path
):
logger
.
info
(
"not find model file path {}"
.
format
(
model_file_path
))
sys
.
exit
(
0
)
...
...
train.sh
浏览文件 @
94cce909
python3
-m
paddle.distributed.launch
--selected_gpus
'0,1,2,3,4,5,6,7'
tools/train.py
-c
configs/rec/rec_mv3_none_bilstm_ctc.yml
\ No newline at end of file
python3
-m
paddle.distributed.launch
--gpus
'0,1,2,3,4,5,6,7'
tools/train.py
-c
configs/rec/rec_mv3_none_bilstm_ctc.yml
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录