Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
7ad0fe5e
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
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看板
未验证
提交
7ad0fe5e
编写于
10月 28, 2020
作者:
D
dyning
提交者:
GitHub
10月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1043 from tink2123/srn_ann
polish srn anno
上级
22d07492
fa12cf0b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
32 addition
and
0 deletion
+32
-0
ppocr/modeling/heads/rec_srn_all_head.py
ppocr/modeling/heads/rec_srn_all_head.py
+32
-0
未找到文件。
ppocr/modeling/heads/rec_srn_all_head.py
浏览文件 @
7ad0fe5e
...
@@ -28,6 +28,13 @@ gradient_clip = 10
...
@@ -28,6 +28,13 @@ gradient_clip = 10
class
SRNPredict
(
object
):
class
SRNPredict
(
object
):
"""
SRN:
see arxiv: https://arxiv.org/abs/2003.12294
args:
params(dict): the super parameters for network build
"""
def
__init__
(
self
,
params
):
def
__init__
(
self
,
params
):
super
(
SRNPredict
,
self
).
__init__
()
super
(
SRNPredict
,
self
).
__init__
()
self
.
char_num
=
params
[
'char_num'
]
self
.
char_num
=
params
[
'char_num'
]
...
@@ -39,7 +46,15 @@ class SRNPredict(object):
...
@@ -39,7 +46,15 @@ class SRNPredict(object):
self
.
hidden_dims
=
params
[
'hidden_dims'
]
self
.
hidden_dims
=
params
[
'hidden_dims'
]
def
pvam
(
self
,
inputs
,
others
):
def
pvam
(
self
,
inputs
,
others
):
"""
Parallel visual attention module model
args:
inputs(variable): Feature map extracted from backbone network
others(list): Other location information variables
return: pvam_features
"""
b
,
c
,
h
,
w
=
inputs
.
shape
b
,
c
,
h
,
w
=
inputs
.
shape
conv_features
=
fluid
.
layers
.
reshape
(
x
=
inputs
,
shape
=
[
-
1
,
c
,
h
*
w
])
conv_features
=
fluid
.
layers
.
reshape
(
x
=
inputs
,
shape
=
[
-
1
,
c
,
h
*
w
])
conv_features
=
fluid
.
layers
.
transpose
(
x
=
conv_features
,
perm
=
[
0
,
2
,
1
])
conv_features
=
fluid
.
layers
.
transpose
(
x
=
conv_features
,
perm
=
[
0
,
2
,
1
])
...
@@ -98,6 +113,15 @@ class SRNPredict(object):
...
@@ -98,6 +113,15 @@ class SRNPredict(object):
return
pvam_features
return
pvam_features
def
gsrm
(
self
,
pvam_features
,
others
):
def
gsrm
(
self
,
pvam_features
,
others
):
"""
Global Semantic Reasonging Module
args:
pvam_features(variable): Feature map extracted from pvam
others(list): Other location information variables
return: gsrm_features, word_out, gsrm_out
"""
#===== GSRM Visual-to-semantic embedding block =====
#===== GSRM Visual-to-semantic embedding block =====
b
,
t
,
c
=
pvam_features
.
shape
b
,
t
,
c
=
pvam_features
.
shape
...
@@ -190,7 +214,15 @@ class SRNPredict(object):
...
@@ -190,7 +214,15 @@ class SRNPredict(object):
return
gsrm_features
,
word_out
,
gsrm_out
return
gsrm_features
,
word_out
,
gsrm_out
def
vsfd
(
self
,
pvam_features
,
gsrm_features
):
def
vsfd
(
self
,
pvam_features
,
gsrm_features
):
"""
Visual-Semantic Fusion Decoder Module
args:
pvam_features(variable): Feature map extracted from pvam
gsrm_features(list): Feature map extracted from gsrm
return: fc_out
"""
#===== Visual-Semantic Fusion Decoder Module =====
#===== Visual-Semantic Fusion Decoder Module =====
b
,
t
,
c1
=
pvam_features
.
shape
b
,
t
,
c1
=
pvam_features
.
shape
b
,
t
,
c2
=
gsrm_features
.
shape
b
,
t
,
c2
=
gsrm_features
.
shape
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录