Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
d3b609ee
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看板
提交
d3b609ee
编写于
12月 15, 2020
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change DBHead output to dict
上级
57e6edd9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
7 deletion
+10
-7
ppocr/losses/det_db_loss.py
ppocr/losses/det_db_loss.py
+1
-0
ppocr/modeling/heads/det_db_head.py
ppocr/modeling/heads/det_db_head.py
+2
-2
ppocr/postprocess/db_postprocess.py
ppocr/postprocess/db_postprocess.py
+4
-2
tools/infer/predict_det.py
tools/infer/predict_det.py
+3
-3
未找到文件。
ppocr/losses/det_db_loss.py
浏览文件 @
d3b609ee
...
...
@@ -47,6 +47,7 @@ class DBLoss(nn.Layer):
negative_ratio
=
ohem_ratio
)
def
forward
(
self
,
predicts
,
labels
):
predicts
=
predicts
[
'maps'
]
label_threshold_map
,
label_threshold_mask
,
label_shrink_map
,
label_shrink_mask
=
labels
[
1
:]
shrink_maps
=
predicts
[:,
0
,
:,
:]
...
...
ppocr/modeling/heads/det_db_head.py
浏览文件 @
d3b609ee
...
...
@@ -120,9 +120,9 @@ class DBHead(nn.Layer):
def
forward
(
self
,
x
):
shrink_maps
=
self
.
binarize
(
x
)
if
not
self
.
training
:
return
shrink_maps
return
{
'maps'
:
shrink_maps
}
threshold_maps
=
self
.
thresh
(
x
)
binary_maps
=
self
.
step_function
(
shrink_maps
,
threshold_maps
)
y
=
paddle
.
concat
([
shrink_maps
,
threshold_maps
,
binary_maps
],
axis
=
1
)
return
y
return
{
'maps'
:
y
}
ppocr/postprocess/db_postprocess.py
浏览文件 @
d3b609ee
...
...
@@ -40,7 +40,8 @@ class DBPostProcess(object):
self
.
max_candidates
=
max_candidates
self
.
unclip_ratio
=
unclip_ratio
self
.
min_size
=
3
self
.
dilation_kernel
=
None
if
not
use_dilation
else
np
.
array
([[
1
,
1
],
[
1
,
1
]])
self
.
dilation_kernel
=
None
if
not
use_dilation
else
np
.
array
(
[[
1
,
1
],
[
1
,
1
]])
def
boxes_from_bitmap
(
self
,
pred
,
_bitmap
,
dest_width
,
dest_height
):
'''
...
...
@@ -132,7 +133,8 @@ class DBPostProcess(object):
cv2
.
fillPoly
(
mask
,
box
.
reshape
(
1
,
-
1
,
2
).
astype
(
np
.
int32
),
1
)
return
cv2
.
mean
(
bitmap
[
ymin
:
ymax
+
1
,
xmin
:
xmax
+
1
],
mask
)[
0
]
def
__call__
(
self
,
pred
,
shape_list
):
def
__call__
(
self
,
outs_dict
,
shape_list
):
pred
=
outs_dict
[
'maps'
]
if
isinstance
(
pred
,
paddle
.
Tensor
):
pred
=
pred
.
numpy
()
pred
=
pred
[:,
0
,
:,
:]
...
...
tools/infer/predict_det.py
浏览文件 @
d3b609ee
...
...
@@ -65,12 +65,12 @@ class TextDetector(object):
postprocess_params
[
"unclip_ratio"
]
=
args
.
det_db_unclip_ratio
postprocess_params
[
"use_dilation"
]
=
True
elif
self
.
det_algorithm
==
"EAST"
:
postprocess_params
[
'name'
]
=
'EASTPostProcess'
postprocess_params
[
'name'
]
=
'EASTPostProcess'
postprocess_params
[
"score_thresh"
]
=
args
.
det_east_score_thresh
postprocess_params
[
"cover_thresh"
]
=
args
.
det_east_cover_thresh
postprocess_params
[
"nms_thresh"
]
=
args
.
det_east_nms_thresh
elif
self
.
det_algorithm
==
"SAST"
:
postprocess_params
[
'name'
]
=
'SASTPostProcess'
postprocess_params
[
'name'
]
=
'SASTPostProcess'
postprocess_params
[
"score_thresh"
]
=
args
.
det_sast_score_thresh
postprocess_params
[
"nms_thresh"
]
=
args
.
det_sast_nms_thresh
self
.
det_sast_polygon
=
args
.
det_sast_polygon
...
...
@@ -178,7 +178,7 @@ class TextDetector(object):
preds
[
'f_tco'
]
=
outputs
[
2
]
preds
[
'f_tvo'
]
=
outputs
[
3
]
else
:
preds
=
outputs
[
0
]
preds
[
'maps'
]
=
outputs
[
0
]
post_result
=
self
.
postprocess_op
(
preds
,
shape_list
)
dt_boxes
=
post_result
[
0
][
'points'
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录