Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
e3f171a3
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看板
提交
e3f171a3
编写于
5月 13, 2020
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix det inference bug and optimize save path
上级
ab8fd7d9
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
57 addition
and
30 deletion
+57
-30
configs/det/det_db_mv3.yml
configs/det/det_db_mv3.yml
+2
-2
configs/det/det_db_r50_vd.yml
configs/det/det_db_r50_vd.yml
+5
-3
configs/det/det_east_mv3.yml
configs/det/det_east_mv3.yml
+4
-2
configs/det/det_east_r50_vd.yml
configs/det/det_east_r50_vd.yml
+5
-3
configs/rec/rec_mv3_none_bilstm_ctc.yml
configs/rec/rec_mv3_none_bilstm_ctc.yml
+4
-2
configs/rec/rec_mv3_none_none_ctc.yml
configs/rec/rec_mv3_none_none_ctc.yml
+4
-2
configs/rec/rec_mv3_tps_bilstm_attn.yml
configs/rec/rec_mv3_tps_bilstm_attn.yml
+4
-2
configs/rec/rec_mv3_tps_bilstm_ctc.yml
configs/rec/rec_mv3_tps_bilstm_ctc.yml
+5
-2
configs/rec/rec_r34_vd_none_bilstm_ctc.yml
configs/rec/rec_r34_vd_none_bilstm_ctc.yml
+4
-2
configs/rec/rec_r34_vd_none_none_ctc.yml
configs/rec/rec_r34_vd_none_none_ctc.yml
+4
-2
configs/rec/rec_r34_vd_tps_bilstm_attn.yml
configs/rec/rec_r34_vd_tps_bilstm_attn.yml
+4
-2
configs/rec/rec_r34_vd_tps_bilstm_ctc.yml
configs/rec/rec_r34_vd_tps_bilstm_ctc.yml
+3
-1
ppocr/modeling/heads/det_db_head.py
ppocr/modeling/heads/det_db_head.py
+1
-1
ppocr/postprocess/db_postprocess.py
ppocr/postprocess/db_postprocess.py
+1
-0
tools/infer/predict_det.py
tools/infer/predict_det.py
+5
-4
tools/program.py
tools/program.py
+2
-0
未找到文件。
configs/det/det_db_mv3.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
1200
epoch_num
:
1200
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
2
print_batch_step
:
2
save_model_dir
:
output
save_model_dir
:
./output/det_db/
save_epoch_step
:
200
save_epoch_step
:
200
eval_batch_step
:
5000
eval_batch_step
:
5000
train_batch_size_per_card
:
16
train_batch_size_per_card
:
16
...
@@ -13,7 +13,7 @@ Global:
...
@@ -13,7 +13,7 @@ Global:
reader_yml
:
./configs/det/det_db_icdar15_reader.yml
reader_yml
:
./configs/det/det_db_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/MobileNetV3_pretrained/MobileNetV3_large_x0_5_pretrained/
pretrain_weights
:
./pretrain_models/MobileNetV3_pretrained/MobileNetV3_large_x0_5_pretrained/
checkpoints
:
checkpoints
:
save_res_path
:
./output/predicts_db.txt
save_res_path
:
./output/
det_db/
predicts_db.txt
save_inference_dir
:
save_inference_dir
:
Architecture
:
Architecture
:
...
...
configs/det/det_db_r50_vd.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
1200
epoch_num
:
1200
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
2
print_batch_step
:
2
save_model_dir
:
output
save_model_dir
:
./output/det_db/
save_epoch_step
:
200
save_epoch_step
:
200
eval_batch_step
:
5000
eval_batch_step
:
5000
train_batch_size_per_card
:
8
train_batch_size_per_card
:
8
...
@@ -12,7 +12,9 @@ Global:
...
@@ -12,7 +12,9 @@ Global:
image_shape
:
[
3
,
640
,
640
]
image_shape
:
[
3
,
640
,
640
]
reader_yml
:
./configs/det/det_db_icdar15_reader.yml
reader_yml
:
./configs/det/det_db_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/ResNet50_vd_pretrained/
pretrain_weights
:
./pretrain_models/ResNet50_vd_pretrained/
save_res_path
:
./output/predicts_db.txt
save_res_path
:
./output/det_db/predicts_db.txt
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.det_model,DetModel
function
:
ppocr.modeling.architectures.det_model,DetModel
...
...
configs/det/det_east_mv3.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
100000
epoch_num
:
100000
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
5
print_batch_step
:
5
save_model_dir
:
output
save_model_dir
:
./output/det_east/
save_epoch_step
:
200
save_epoch_step
:
200
eval_batch_step
:
5000
eval_batch_step
:
5000
train_batch_size_per_card
:
16
train_batch_size_per_card
:
16
...
@@ -12,7 +12,9 @@ Global:
...
@@ -12,7 +12,9 @@ Global:
image_shape
:
[
3
,
512
,
512
]
image_shape
:
[
3
,
512
,
512
]
reader_yml
:
./configs/det/det_east_icdar15_reader.yml
reader_yml
:
./configs/det/det_east_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/MobileNetV3_pretrained/MobileNetV3_large_x0_5_pretrained/
pretrain_weights
:
./pretrain_models/MobileNetV3_pretrained/MobileNetV3_large_x0_5_pretrained/
save_res_path
:
./output/predicts_east.txt
checkpoints
:
save_res_path
:
./output/det_east/predicts_east.txt
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.det_model,DetModel
function
:
ppocr.modeling.architectures.det_model,DetModel
...
...
configs/det/det_east_r50_vd.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
100000
epoch_num
:
100000
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
5
print_batch_step
:
5
save_model_dir
:
output
save_model_dir
:
./output/det_east/
save_epoch_step
:
200
save_epoch_step
:
200
eval_batch_step
:
5000
eval_batch_step
:
5000
train_batch_size_per_card
:
8
train_batch_size_per_card
:
8
...
@@ -12,7 +12,9 @@ Global:
...
@@ -12,7 +12,9 @@ Global:
image_shape
:
[
3
,
512
,
512
]
image_shape
:
[
3
,
512
,
512
]
reader_yml
:
./configs/det/det_east_icdar15_reader.yml
reader_yml
:
./configs/det/det_east_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/ResNet50_vd_pretrained/
pretrain_weights
:
./pretrain_models/ResNet50_vd_pretrained/
save_res_path
:
./output/predicts_east.txt
save_res_path
:
./output/det_east/predicts_east.txt
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.det_model,DetModel
function
:
ppocr.modeling.architectures.det_model,DetModel
...
...
configs/rec/rec_mv3_none_bilstm_ctc.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_mv3_none_none_ctc.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_mv3_tps_bilstm_attn.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
attention
loss_type
:
attention
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_mv3_tps_bilstm_ctc.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,9 @@ Global:
...
@@ -15,6 +15,9 @@ Global:
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_r34_vd_none_bilstm_ctc.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_r34_vd_none_none_ctc.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_r34_vd_tps_bilstm_attn.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
attention
loss_type
:
attention
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
configs/rec/rec_r34_vd_tps_bilstm_ctc.yml
浏览文件 @
e3f171a3
...
@@ -4,7 +4,7 @@ Global:
...
@@ -4,7 +4,7 @@ Global:
epoch_num
:
72
epoch_num
:
72
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output
save_model_dir
:
output
/rec
save_epoch_step
:
3
save_epoch_step
:
3
eval_batch_step
:
2000
eval_batch_step
:
2000
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
...
@@ -15,6 +15,8 @@ Global:
...
@@ -15,6 +15,8 @@ Global:
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
reader_yml
:
./configs/rec/rec_benchmark_reader.yml
pretrain_weights
:
pretrain_weights
:
checkpoints
:
save_inference_dir
:
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
ppocr/modeling/heads/det_db_head.py
浏览文件 @
e3f171a3
...
@@ -196,7 +196,7 @@ class DBHead(object):
...
@@ -196,7 +196,7 @@ class DBHead(object):
fuse
=
fluid
.
layers
.
concat
(
input
=
[
p5
,
p4
,
p3
,
p2
],
axis
=
1
)
fuse
=
fluid
.
layers
.
concat
(
input
=
[
p5
,
p4
,
p3
,
p2
],
axis
=
1
)
shrink_maps
=
self
.
binarize
(
fuse
)
shrink_maps
=
self
.
binarize
(
fuse
)
if
mode
!=
"train"
:
if
mode
!=
"train"
:
return
shrink_maps
return
{
"maps"
,
shrink_maps
}
threshold_maps
=
self
.
thresh
(
fuse
)
threshold_maps
=
self
.
thresh
(
fuse
)
binary_maps
=
self
.
step_function
(
shrink_maps
,
threshold_maps
)
binary_maps
=
self
.
step_function
(
shrink_maps
,
threshold_maps
)
y
=
fluid
.
layers
.
concat
(
y
=
fluid
.
layers
.
concat
(
...
...
ppocr/postprocess/db_postprocess.py
浏览文件 @
e3f171a3
...
@@ -128,6 +128,7 @@ class DBPostProcess(object):
...
@@ -128,6 +128,7 @@ class DBPostProcess(object):
def
__call__
(
self
,
outs_dict
,
ratio_list
):
def
__call__
(
self
,
outs_dict
,
ratio_list
):
pred
=
outs_dict
[
'maps'
]
pred
=
outs_dict
[
'maps'
]
pred
=
pred
[:,
0
,
:,
:]
pred
=
pred
[:,
0
,
:,
:]
segmentation
=
pred
>
self
.
thresh
segmentation
=
pred
>
self
.
thresh
...
...
tools/infer/predict_det.py
浏览文件 @
e3f171a3
...
@@ -24,6 +24,7 @@ import copy
...
@@ -24,6 +24,7 @@ import copy
import
numpy
as
np
import
numpy
as
np
import
math
import
math
import
time
import
time
import
sys
class
TextDetector
(
object
):
class
TextDetector
(
object
):
...
@@ -52,10 +53,10 @@ class TextDetector(object):
...
@@ -52,10 +53,10 @@ class TextDetector(object):
utility
.
create_predictor
(
args
,
mode
=
"det"
)
utility
.
create_predictor
(
args
,
mode
=
"det"
)
def
order_points_clockwise
(
self
,
pts
):
def
order_points_clockwise
(
self
,
pts
):
#######
"""
## https://github.com/jrosebr1/imutils/blob/master/imutils/perspective.py
reference from: https://github.com/jrosebr1/imutils/blob/master/imutils/perspective.py
########
# sort the points based on their x-coordinates
# sort the points based on their x-coordinates
"""
xSorted
=
pts
[
np
.
argsort
(
pts
[:,
0
]),
:]
xSorted
=
pts
[
np
.
argsort
(
pts
[:,
0
]),
:]
# grab the left-most and right-most points from the sorted
# grab the left-most and right-most points from the sorted
...
@@ -141,7 +142,7 @@ class TextDetector(object):
...
@@ -141,7 +142,7 @@ class TextDetector(object):
outs_dict
[
'f_score'
]
=
outputs
[
0
]
outs_dict
[
'f_score'
]
=
outputs
[
0
]
outs_dict
[
'f_geo'
]
=
outputs
[
1
]
outs_dict
[
'f_geo'
]
=
outputs
[
1
]
else
:
else
:
outs_dict
[
'maps'
]
=
[
outputs
[
0
]
]
outs_dict
[
'maps'
]
=
outputs
[
0
]
dt_boxes_list
=
self
.
postprocess_op
(
outs_dict
,
[
ratio_list
])
dt_boxes_list
=
self
.
postprocess_op
(
outs_dict
,
[
ratio_list
])
dt_boxes
=
dt_boxes_list
[
0
]
dt_boxes
=
dt_boxes_list
[
0
]
dt_boxes
=
self
.
filter_tag_det_res
(
dt_boxes
,
ori_im
.
shape
)
dt_boxes
=
self
.
filter_tag_det_res
(
dt_boxes
,
ori_im
.
shape
)
...
...
tools/program.py
浏览文件 @
e3f171a3
...
@@ -219,6 +219,8 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict):
...
@@ -219,6 +219,8 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict):
eval_batch_step
=
config
[
'Global'
][
'eval_batch_step'
]
eval_batch_step
=
config
[
'Global'
][
'eval_batch_step'
]
save_epoch_step
=
config
[
'Global'
][
'save_epoch_step'
]
save_epoch_step
=
config
[
'Global'
][
'save_epoch_step'
]
save_model_dir
=
config
[
'Global'
][
'save_model_dir'
]
save_model_dir
=
config
[
'Global'
][
'save_model_dir'
]
if
not
os
.
path
.
exists
(
save_model_dir
):
os
.
makedirs
(
save_model_dir
)
train_stats
=
TrainingStats
(
log_smooth_window
,
train_stats
=
TrainingStats
(
log_smooth_window
,
train_info_dict
[
'fetch_name_list'
])
train_info_dict
[
'fetch_name_list'
])
best_eval_hmean
=
-
1
best_eval_hmean
=
-
1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录