Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
b0635994
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看板
提交
b0635994
编写于
9月 19, 2020
作者:
M
MissPenguin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove det_mv3_db_v1.1.yml & add code annotation
上级
2cdf7a66
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
22 addition
and
55 deletion
+22
-55
configs/det/det_mv3_db.yml
configs/det/det_mv3_db.yml
+1
-0
configs/det/det_mv3_db_v1.1.yml
configs/det/det_mv3_db_v1.1.yml
+0
-55
tools/program.py
tools/program.py
+17
-0
tools/train.py
tools/train.py
+4
-0
未找到文件。
configs/det/det_mv3_db.yml
浏览文件 @
b0635994
...
@@ -24,6 +24,7 @@ Backbone:
...
@@ -24,6 +24,7 @@ Backbone:
function
:
ppocr.modeling.backbones.det_mobilenet_v3,MobileNetV3
function
:
ppocr.modeling.backbones.det_mobilenet_v3,MobileNetV3
scale
:
0.5
scale
:
0.5
model_name
:
large
model_name
:
large
disable_se
:
true
Head
:
Head
:
function
:
ppocr.modeling.heads.det_db_head,DBHead
function
:
ppocr.modeling.heads.det_db_head,DBHead
...
...
configs/det/det_mv3_db_v1.1.yml
已删除
100755 → 0
浏览文件 @
2cdf7a66
Global
:
algorithm
:
DB
use_gpu
:
true
epoch_num
:
1200
log_smooth_window
:
20
print_batch_step
:
2
save_model_dir
:
./output/det_db/
save_epoch_step
:
200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
[
4000
,
5000
]
train_batch_size_per_card
:
16
test_batch_size_per_card
:
16
image_shape
:
[
3
,
640
,
640
]
reader_yml
:
./configs/det/det_db_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/MobileNetV3_large_x0_5_pretrained/
checkpoints
:
save_res_path
:
./output/det_db/predicts_db.txt
save_inference_dir
:
Architecture
:
function
:
ppocr.modeling.architectures.det_model,DetModel
Backbone
:
function
:
ppocr.modeling.backbones.det_mobilenet_v3,MobileNetV3
scale
:
0.5
model_name
:
large
disable_se
:
true
Head
:
function
:
ppocr.modeling.heads.det_db_head,DBHead
model_name
:
large
k
:
50
inner_channels
:
96
out_channels
:
2
Loss
:
function
:
ppocr.modeling.losses.det_db_loss,DBLoss
balance_loss
:
true
main_loss_type
:
DiceLoss
alpha
:
5
beta
:
10
ohem_ratio
:
3
Optimizer
:
function
:
ppocr.optimizer,AdamDecay
base_lr
:
0.001
beta1
:
0.9
beta2
:
0.999
PostProcess
:
function
:
ppocr.postprocess.db_postprocess,DBPostProcess
thresh
:
0.3
box_thresh
:
0.6
max_candidates
:
1000
unclip_ratio
:
1.5
tools/program.py
浏览文件 @
b0635994
...
@@ -204,6 +204,15 @@ def build(config, main_prog, startup_prog, mode):
...
@@ -204,6 +204,15 @@ def build(config, main_prog, startup_prog, mode):
def
build_export
(
config
,
main_prog
,
startup_prog
):
def
build_export
(
config
,
main_prog
,
startup_prog
):
"""
"""
Build input and output for exporting a checkpoints model to an inference model
Args:
config(dict): config
main_prog(): main program
startup_prog(): startup program
Returns:
feeded_var_names(list[str]): var names of input for exported inference model
target_vars(list[Variable]): output vars for exported inference model
fetches_var_name: dict of checkpoints model outputs(included loss and measures)
"""
"""
with
fluid
.
program_guard
(
main_prog
,
startup_prog
):
with
fluid
.
program_guard
(
main_prog
,
startup_prog
):
with
fluid
.
unique_name
.
guard
():
with
fluid
.
unique_name
.
guard
():
...
@@ -246,6 +255,9 @@ def train_eval_det_run(config,
...
@@ -246,6 +255,9 @@ def train_eval_det_run(config,
train_info_dict
,
train_info_dict
,
eval_info_dict
,
eval_info_dict
,
is_pruning
=
False
):
is_pruning
=
False
):
'''
main program of evaluation for detection
'''
train_batch_id
=
0
train_batch_id
=
0
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
epoch_num
=
config
[
'Global'
][
'epoch_num'
]
epoch_num
=
config
[
'Global'
][
'epoch_num'
]
...
@@ -337,6 +349,9 @@ def train_eval_det_run(config,
...
@@ -337,6 +349,9 @@ def train_eval_det_run(config,
def
train_eval_rec_run
(
config
,
exe
,
train_info_dict
,
eval_info_dict
):
def
train_eval_rec_run
(
config
,
exe
,
train_info_dict
,
eval_info_dict
):
'''
main program of evaluation for recognition
'''
train_batch_id
=
0
train_batch_id
=
0
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
epoch_num
=
config
[
'Global'
][
'epoch_num'
]
epoch_num
=
config
[
'Global'
][
'epoch_num'
]
...
@@ -513,6 +528,7 @@ def train_eval_cls_run(config, exe, train_info_dict, eval_info_dict):
...
@@ -513,6 +528,7 @@ def train_eval_cls_run(config, exe, train_info_dict, eval_info_dict):
def
preprocess
():
def
preprocess
():
# load config from yml file
FLAGS
=
ArgsParser
().
parse_args
()
FLAGS
=
ArgsParser
().
parse_args
()
config
=
load_config
(
FLAGS
.
config
)
config
=
load_config
(
FLAGS
.
config
)
merge_config
(
FLAGS
.
opt
)
merge_config
(
FLAGS
.
opt
)
...
@@ -522,6 +538,7 @@ def preprocess():
...
@@ -522,6 +538,7 @@ def preprocess():
use_gpu
=
config
[
'Global'
][
'use_gpu'
]
use_gpu
=
config
[
'Global'
][
'use_gpu'
]
check_gpu
(
use_gpu
)
check_gpu
(
use_gpu
)
# check whether the set algorithm belongs to the supported algorithm list
alg
=
config
[
'Global'
][
'algorithm'
]
alg
=
config
[
'Global'
][
'algorithm'
]
assert
alg
in
[
assert
alg
in
[
'EAST'
,
'DB'
,
'SAST'
,
'Rosetta'
,
'CRNN'
,
'STARNet'
,
'RARE'
,
'SRN'
,
'CLS'
'EAST'
,
'DB'
,
'SAST'
,
'Rosetta'
,
'CRNN'
,
'STARNet'
,
'RARE'
,
'SRN'
,
'CLS'
...
...
tools/train.py
浏览文件 @
b0635994
...
@@ -46,6 +46,7 @@ from paddle.fluid.contrib.model_stat import summary
...
@@ -46,6 +46,7 @@ from paddle.fluid.contrib.model_stat import summary
def
main
():
def
main
():
# build train program
train_build_outputs
=
program
.
build
(
train_build_outputs
=
program
.
build
(
config
,
train_program
,
startup_program
,
mode
=
'train'
)
config
,
train_program
,
startup_program
,
mode
=
'train'
)
train_loader
=
train_build_outputs
[
0
]
train_loader
=
train_build_outputs
[
0
]
...
@@ -54,6 +55,7 @@ def main():
...
@@ -54,6 +55,7 @@ def main():
train_opt_loss_name
=
train_build_outputs
[
3
]
train_opt_loss_name
=
train_build_outputs
[
3
]
model_average
=
train_build_outputs
[
-
1
]
model_average
=
train_build_outputs
[
-
1
]
# build eval program
eval_program
=
fluid
.
Program
()
eval_program
=
fluid
.
Program
()
eval_build_outputs
=
program
.
build
(
eval_build_outputs
=
program
.
build
(
config
,
eval_program
,
startup_program
,
mode
=
'eval'
)
config
,
eval_program
,
startup_program
,
mode
=
'eval'
)
...
@@ -61,9 +63,11 @@ def main():
...
@@ -61,9 +63,11 @@ def main():
eval_fetch_varname_list
=
eval_build_outputs
[
2
]
eval_fetch_varname_list
=
eval_build_outputs
[
2
]
eval_program
=
eval_program
.
clone
(
for_test
=
True
)
eval_program
=
eval_program
.
clone
(
for_test
=
True
)
# initialize train reader
train_reader
=
reader_main
(
config
=
config
,
mode
=
"train"
)
train_reader
=
reader_main
(
config
=
config
,
mode
=
"train"
)
train_loader
.
set_sample_list_generator
(
train_reader
,
places
=
place
)
train_loader
.
set_sample_list_generator
(
train_reader
,
places
=
place
)
# initialize eval reader
eval_reader
=
reader_main
(
config
=
config
,
mode
=
"eval"
)
eval_reader
=
reader_main
(
config
=
config
,
mode
=
"eval"
)
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录