Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
b2004fe5
P
PaddleOCR
项目概览
weixin_41840029
/
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看板
提交
b2004fe5
编写于
11月 09, 2020
作者:
W
WenmuZhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加resnet backbone
上级
4d775dc9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
17 addition
and
11 deletion
+17
-11
ppocr/modeling/backbones/det_resnet_vd.py
ppocr/modeling/backbones/det_resnet_vd.py
+8
-5
ppocr/modeling/backbones/rec_resnet_vd.py
ppocr/modeling/backbones/rec_resnet_vd.py
+9
-6
未找到文件。
ppocr/modeling/backbones/det_resnet_vd.py
浏览文件 @
b2004fe5
...
...
@@ -19,6 +19,7 @@ from __future__ import print_function
import
paddle
from
paddle
import
ParamAttr
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
__all__
=
[
"ResNet"
]
...
...
@@ -37,9 +38,9 @@ class ConvBNLayer(nn.Layer):
super
(
ConvBNLayer
,
self
).
__init__
()
self
.
is_vd_mode
=
is_vd_mode
self
.
_pool2d_avg
=
nn
.
AvgPool2
d
(
self
.
_pool2d_avg
=
nn
.
AvgPool2
D
(
kernel_size
=
2
,
stride
=
2
,
padding
=
0
,
ceil_mode
=
True
)
self
.
_conv
=
nn
.
Conv2
d
(
self
.
_conv
=
nn
.
Conv2
D
(
in_channels
=
in_channels
,
out_channels
=
out_channels
,
kernel_size
=
kernel_size
,
...
...
@@ -118,7 +119,8 @@ class BottleneckBlock(nn.Layer):
short
=
inputs
else
:
short
=
self
.
short
(
inputs
)
y
=
paddle
.
elementwise_add
(
x
=
short
,
y
=
conv2
,
act
=
'relu'
)
y
=
paddle
.
add
(
x
=
short
,
y
=
conv2
)
y
=
F
.
relu
(
y
)
return
y
...
...
@@ -165,7 +167,8 @@ class BasicBlock(nn.Layer):
short
=
inputs
else
:
short
=
self
.
short
(
inputs
)
y
=
paddle
.
elementwise_add
(
x
=
short
,
y
=
conv1
,
act
=
'relu'
)
y
=
paddle
.
add
(
x
=
short
,
y
=
conv1
)
y
=
F
.
relu
(
y
)
return
y
...
...
@@ -214,7 +217,7 @@ class ResNet(nn.Layer):
stride
=
1
,
act
=
'relu'
,
name
=
"conv1_3"
)
self
.
pool2d_max
=
nn
.
MaxPool2
d
(
kernel_size
=
3
,
stride
=
2
,
padding
=
1
)
self
.
pool2d_max
=
nn
.
MaxPool2
D
(
kernel_size
=
3
,
stride
=
2
,
padding
=
1
)
self
.
stages
=
[]
self
.
out_channels
=
[]
...
...
ppocr/modeling/backbones/rec_resnet_vd.py
浏览文件 @
b2004fe5
...
...
@@ -19,6 +19,7 @@ from __future__ import print_function
import
paddle
from
paddle
import
ParamAttr
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
__all__
=
[
"ResNet"
]
...
...
@@ -37,9 +38,9 @@ class ConvBNLayer(nn.Layer):
super
(
ConvBNLayer
,
self
).
__init__
()
self
.
is_vd_mode
=
is_vd_mode
self
.
_pool2d_avg
=
nn
.
AvgPool2
d
(
self
.
_pool2d_avg
=
nn
.
AvgPool2
D
(
kernel_size
=
stride
,
stride
=
stride
,
padding
=
0
,
ceil_mode
=
True
)
self
.
_conv
=
nn
.
Conv2
d
(
self
.
_conv
=
nn
.
Conv2
D
(
in_channels
=
in_channels
,
out_channels
=
out_channels
,
kernel_size
=
kernel_size
,
...
...
@@ -119,7 +120,8 @@ class BottleneckBlock(nn.Layer):
short
=
inputs
else
:
short
=
self
.
short
(
inputs
)
y
=
paddle
.
elementwise_add
(
x
=
short
,
y
=
conv2
,
act
=
'relu'
)
y
=
paddle
.
add
(
x
=
short
,
y
=
conv2
)
y
=
F
.
relu
(
y
)
return
y
...
...
@@ -166,7 +168,8 @@ class BasicBlock(nn.Layer):
short
=
inputs
else
:
short
=
self
.
short
(
inputs
)
y
=
paddle
.
elementwise_add
(
x
=
short
,
y
=
conv1
,
act
=
'relu'
)
y
=
paddle
.
add
(
x
=
short
,
y
=
conv1
)
y
=
F
.
relu
(
y
)
return
y
...
...
@@ -215,7 +218,7 @@ class ResNet(nn.Layer):
stride
=
1
,
act
=
'relu'
,
name
=
"conv1_3"
)
self
.
pool2d_max
=
nn
.
MaxPool2
d
(
kernel_size
=
3
,
stride
=
2
,
padding
=
1
)
self
.
pool2d_max
=
nn
.
MaxPool2
D
(
kernel_size
=
3
,
stride
=
2
,
padding
=
1
)
self
.
block_list
=
[]
if
layers
>=
50
:
...
...
@@ -270,7 +273,7 @@ class ResNet(nn.Layer):
shortcut
=
True
self
.
block_list
.
append
(
basic_block
)
self
.
out_channels
=
num_filters
[
block
]
self
.
out_pool
=
nn
.
MaxPool2
d
(
kernel_size
=
2
,
stride
=
2
,
padding
=
0
)
self
.
out_pool
=
nn
.
MaxPool2
D
(
kernel_size
=
2
,
stride
=
2
,
padding
=
0
)
def
forward
(
self
,
inputs
):
y
=
self
.
conv1_1
(
inputs
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录