Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
9123f5da
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9123f5da
编写于
5月 12, 2020
作者:
littletomatodonkey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix cspnet
上级
7ad89bc1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
18 deletion
+26
-18
ppcls/modeling/architectures/__init__.py
ppcls/modeling/architectures/__init__.py
+1
-1
ppcls/modeling/architectures/csp_resnet.py
ppcls/modeling/architectures/csp_resnet.py
+25
-17
未找到文件。
ppcls/modeling/architectures/__init__.py
浏览文件 @
9123f5da
...
...
@@ -46,4 +46,4 @@ from .resnet_acnet import ResNet18_ACNet, ResNet34_ACNet, ResNet50_ACNet, ResNet
# distillation model
from
.distillation_models
import
ResNet50_vd_distill_MobileNetV3_large_x1_0
,
ResNeXt101_32x16d_wsl_distill_ResNet50_vd
from
.csp_resnet
import
CSP
Net
Net50
from
.csp_resnet
import
CSP
Res
Net50
ppcls/modeling/architectures/csp_resnet.py
浏览文件 @
9123f5da
...
...
@@ -22,10 +22,10 @@ import paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.param_attr
import
ParamAttr
__all__
=
[
"CSP
Net
Net50"
,
]
__all__
=
[
"CSP
Res
Net50"
,
]
class
CSP
Net
Net
():
class
CSP
Res
Net
():
def
__init__
(
self
,
layers
=
50
):
self
.
layers
=
layers
...
...
@@ -39,7 +39,7 @@ class CSPNetNet():
if
layers
==
18
:
depth
=
[
2
,
2
,
2
,
2
]
elif
layers
==
34
or
layers
==
50
:
depth
=
[
3
,
3
,
5
,
3
]
depth
=
[
3
,
3
,
5
,
2
]
elif
layers
==
101
:
depth
=
[
3
,
4
,
23
,
3
]
elif
layers
==
152
:
...
...
@@ -51,14 +51,14 @@ class CSPNetNet():
num_filters
=
64
,
filter_size
=
7
,
stride
=
2
,
act
=
'
relu
'
,
act
=
'
leaky
'
,
name
=
"conv1"
,
data_format
=
data_format
)
conv
=
fluid
.
layers
.
pool2d
(
input
=
conv
,
pool_size
=
3
,
pool_size
=
2
,
pool_stride
=
2
,
pool_padding
=
1
,
pool_padding
=
0
,
pool_type
=
'max'
,
data_format
=
data_format
)
...
...
@@ -68,7 +68,7 @@ class CSPNetNet():
if
block
!=
0
:
conv
=
self
.
conv_bn_layer
(
input
=
conv
,
num_filters
=
num_filters
[
block
]
*
2
,
num_filters
=
num_filters
[
block
],
filter_size
=
3
,
stride
=
2
,
act
=
"leaky_relu"
,
...
...
@@ -76,15 +76,19 @@ class CSPNetNet():
data_format
=
data_format
)
# layer warp
# left = conv
# right = conv
left
,
right
=
fluid
.
layers
.
split
(
conv
,
num_or_sections
=
[
conv
.
shape
[
1
]
//
2
,
conv
.
shape
[
1
]
//
2
],
dim
=
1
)
# left, right = fluid.layers.split(
# conv,
# num_or_sections=[conv.shape[1]//2, conv.shape[1]//2],
# dim=1)
left
=
conv
right
=
conv
if
block
==
0
:
ch
=
num_filters
[
block
]
else
:
ch
=
num_filters
[
block
]
*
2
right
=
self
.
conv_bn_layer
(
input
=
right
,
num_filters
=
num_filters
[
block
]
*
4
,
num_filters
=
ch
,
filter_size
=
1
,
act
=
"leaky_relu"
,
name
=
conv_name
+
"_right_first_route"
,
...
...
@@ -159,7 +163,7 @@ class CSPNetNet():
stride
=
stride
,
padding
=
(
filter_size
-
1
)
//
2
,
groups
=
groups
,
act
=
act
,
act
=
None
,
param_attr
=
ParamAttr
(
name
=
name
+
"_weights"
),
bias_attr
=
False
,
name
=
name
+
'.conv2d.output.1'
,
...
...
@@ -178,6 +182,10 @@ class CSPNetNet():
moving_mean_name
=
bn_name
+
'_mean'
,
moving_variance_name
=
bn_name
+
'_variance'
,
data_layout
=
data_format
)
if
act
==
"relu"
:
bn
=
fluid
.
layers
.
relu
(
bn
)
elif
act
==
"leaky_relu"
:
bn
=
fluid
.
layers
.
leaky_relu
(
bn
)
return
bn
def
shortcut
(
self
,
input
,
ch_out
,
stride
,
is_first
,
name
,
data_format
):
...
...
@@ -228,6 +236,6 @@ class CSPNetNet():
return
ret
def
CSP
Net
Net50
():
model
=
CSP
Net
Net
(
layers
=
50
)
def
CSP
Res
Net50
():
model
=
CSP
Res
Net
(
layers
=
50
)
return
model
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录