Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
8ede57a4
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看板
提交
8ede57a4
编写于
5月 28, 2021
作者:
W
weishengyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add MODEL_URLS
上级
c05df5fa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
28 deletion
+27
-28
ppcls/arch/backbone/legendary_models/hrnet.py
ppcls/arch/backbone/legendary_models/hrnet.py
+27
-28
未找到文件。
ppcls/arch/backbone/legendary_models/hrnet.py
浏览文件 @
8ede57a4
...
...
@@ -18,32 +18,33 @@ from __future__ import print_function
import
math
import
paddle
from
paddle
import
nn
from
paddle
import
ParamAttr
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
from
paddle.nn
import
AdaptiveAvgPool2D
,
MaxPool2D
,
AvgPool2D
from
paddle.nn.functional
import
upsample
from
paddle.nn.initializer
import
Uniform
from
ppcls.arch.backbone.base.theseus_layer
import
TheseusLayer
,
Identity
__all__
=
[
"HRNet_W18_C"
,
"HRNet_W30_C"
,
"HRNet_W32_C"
,
"HRNet_W40_C"
,
"HRNet_W44_C"
,
"HRNet_W48_C"
,
"HRNet_W60_C"
,
"HRNet_W64_C"
,
"SE_HRNet_W18_C"
,
"SE_HRNet_W30_C"
,
"SE_HRNet_W32_C"
,
"SE_HRNet_W40_C"
,
"SE_HRNet_W44_C"
,
"SE_HRNet_W48_C"
,
"SE_HRNet_W60_C"
,
"SE_HRNet_W64_C"
,
]
MODEL_URLS
=
{
"HRNet_W18_C"
:
""
,
"HRNet_W30_C"
:
""
,
"HRNet_W32_C"
:
""
,
"HRNet_W40_C"
:
""
,
"HRNet_W44_C"
:
""
,
"HRNet_W48_C"
:
""
,
"HRNet_W60_C"
:
""
,
"HRNet_W64_C"
:
""
,
"SE_HRNet_W18_C"
:
""
,
"SE_HRNet_W30_C"
:
""
,
"SE_HRNet_W32_C"
:
""
,
"SE_HRNet_W40_C"
:
""
,
"SE_HRNet_W44_C"
:
""
,
"SE_HRNet_W48_C"
:
""
,
"SE_HRNet_W60_C"
:
""
,
"SE_HRNet_W64_C"
:
""
,
}
__all__
=
list
(
MODEL_URLS
.
keys
())
class
ConvBNLayer
(
TheseusLayer
):
...
...
@@ -191,7 +192,7 @@ class SELayer(TheseusLayer):
def
__init__
(
self
,
num_channels
,
num_filters
,
reduction_ratio
):
super
(
SELayer
,
self
).
__init__
()
self
.
pool2d_gap
=
AdaptiveAvgPool2D
(
1
)
self
.
pool2d_gap
=
nn
.
AdaptiveAvgPool2D
(
1
)
self
.
_num_channels
=
num_channels
...
...
@@ -207,8 +208,7 @@ class SELayer(TheseusLayer):
self
.
fc_excitation
=
nn
.
Linear
(
med_ch
,
num_filters
,
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
self
.
sigmoid
=
nn
.
Sigmoid
()
def
forward
(
self
,
x
,
res_dict
=
None
):
...
...
@@ -331,7 +331,7 @@ class FuseLayers(TheseusLayer):
xj
=
self
.
residual_func_list
[
residual_func_idx
](
x
[
j
])
residual_func_idx
+=
1
xj
=
F
.
upsample
(
xj
,
scale_factor
=
2
**
(
j
-
i
),
mode
=
"nearest"
)
xj
=
upsample
(
xj
,
scale_factor
=
2
**
(
j
-
i
),
mode
=
"nearest"
)
residual
=
paddle
.
add
(
x
=
residual
,
y
=
xj
)
elif
j
<
i
:
xj
=
x
[
j
]
...
...
@@ -476,15 +476,14 @@ class HRNet(TheseusLayer):
filter_size
=
1
,
stride
=
1
)
self
.
avg_pool
=
AdaptiveAvgPool2D
(
1
)
self
.
avg_pool
=
nn
.
AdaptiveAvgPool2D
(
1
)
stdv
=
1.0
/
math
.
sqrt
(
2048
*
1.0
)
self
.
fc
=
nn
.
Linear
(
2048
,
class_num
,
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
def
forward
(
self
,
x
,
res_dict
=
None
):
x
=
self
.
conv_layer1_1
(
x
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录