Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
9ab8639c
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看板
提交
9ab8639c
编写于
5月 25, 2021
作者:
W
weishengyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove transition
上级
b38b0f38
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
21 addition
and
47 deletion
+21
-47
ppcls/arch/backbone/legendary_models/hrnet.py
ppcls/arch/backbone/legendary_models/hrnet.py
+21
-47
未找到文件。
ppcls/arch/backbone/legendary_models/hrnet.py
浏览文件 @
9ab8639c
...
@@ -94,47 +94,6 @@ class Layer1(TheseusLayer):
...
@@ -94,47 +94,6 @@ class Layer1(TheseusLayer):
return
y
return
y
class
TransitionLayer
(
TheseusLayer
):
def
__init__
(
self
,
in_channels
,
out_channels
,
name
=
None
):
super
(
TransitionLayer
,
self
).
__init__
()
num_in
=
len
(
in_channels
)
num_out
=
len
(
out_channels
)
out
=
[]
self
.
conv_bn_func_list
=
[]
for
i
in
range
(
num_out
):
residual
=
None
if
i
<
num_in
:
if
in_channels
[
i
]
!=
out_channels
[
i
]:
residual
=
self
.
add_sublayer
(
"transition_{}_layer_{}"
.
format
(
name
,
i
+
1
),
ConvBNLayer
(
num_channels
=
in_channels
[
i
],
num_filters
=
out_channels
[
i
],
filter_size
=
3
))
else
:
residual
=
self
.
add_sublayer
(
"transition_{}_layer_{}"
.
format
(
name
,
i
+
1
),
ConvBNLayer
(
num_channels
=
in_channels
[
-
1
],
num_filters
=
out_channels
[
i
],
filter_size
=
3
,
stride
=
2
))
self
.
conv_bn_func_list
.
append
(
residual
)
def
forward
(
self
,
x
,
res_dict
=
None
):
outs
=
[]
for
idx
,
conv_bn_func
in
enumerate
(
self
.
conv_bn_func_list
):
if
conv_bn_func
is
None
:
outs
.
append
(
x
[
idx
])
else
:
if
idx
<
len
(
x
):
outs
.
append
(
conv_bn_func
(
x
[
idx
]))
else
:
outs
.
append
(
conv_bn_func
(
x
[
-
1
]))
return
outs
class
Branches
(
TheseusLayer
):
class
Branches
(
TheseusLayer
):
def
__init__
(
self
,
def
__init__
(
self
,
block_num
,
block_num
,
...
@@ -537,8 +496,16 @@ class HRNet(TheseusLayer):
...
@@ -537,8 +496,16 @@ class HRNet(TheseusLayer):
self
.
la1
=
Layer1
(
num_channels
=
64
,
has_se
=
has_se
,
name
=
"layer2"
)
self
.
la1
=
Layer1
(
num_channels
=
64
,
has_se
=
has_se
,
name
=
"layer2"
)
self
.
tr1
=
TransitionLayer
(
self
.
tr1_1
=
BasicBlock
(
in_channels
=
[
256
],
out_channels
=
channels_2
,
name
=
"tr1"
)
num_channels
=
256
,
num_filters
=
width
,
has_se
=
has_se
,
name
=
"tr1_1"
)
self
.
tr1_2
=
BasicBlock
(
num_channels
=
width
,
num_filters
=
width
*
2
,
has_se
=
has_se
,
name
=
"tr1_2"
)
self
.
st2
=
Stage
(
self
.
st2
=
Stage
(
num_channels
=
channels_2
,
num_channels
=
channels_2
,
...
@@ -547,8 +514,11 @@ class HRNet(TheseusLayer):
...
@@ -547,8 +514,11 @@ class HRNet(TheseusLayer):
has_se
=
self
.
has_se
,
has_se
=
self
.
has_se
,
name
=
"st2"
)
name
=
"st2"
)
self
.
tr2
=
TransitionLayer
(
self
.
tr2
=
BasicBlock
(
in_channels
=
channels_2
,
out_channels
=
channels_3
,
name
=
"tr2"
)
num_channels
=
width
*
2
,
num_filters
=
width
*
4
,
has_se
=
has_se
,
name
=
"tr2"
)
self
.
st3
=
Stage
(
self
.
st3
=
Stage
(
num_channels
=
channels_3
,
num_channels
=
channels_3
,
num_modules
=
num_modules_3
,
num_modules
=
num_modules_3
,
...
@@ -556,8 +526,12 @@ class HRNet(TheseusLayer):
...
@@ -556,8 +526,12 @@ class HRNet(TheseusLayer):
has_se
=
self
.
has_se
,
has_se
=
self
.
has_se
,
name
=
"st3"
)
name
=
"st3"
)
self
.
tr3
=
TransitionLayer
(
self
.
tr3
=
BasicBlock
(
in_channels
=
channels_3
,
out_channels
=
channels_4
,
name
=
"tr3"
)
num_channels
=
width
*
4
,
num_filters
=
width
*
8
,
has_se
=
has_se
,
name
=
"tr3"
)
self
.
st4
=
Stage
(
self
.
st4
=
Stage
(
num_channels
=
channels_4
,
num_channels
=
channels_4
,
num_modules
=
num_modules_4
,
num_modules
=
num_modules_4
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录