Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
36b48e9e
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
36b48e9e
编写于
7月 28, 2021
作者:
W
wangguanzhong
提交者:
GitHub
7月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean param name (#3799)
上级
4ea5b435
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
39 addition
and
129 deletion
+39
-129
ppdet/modeling/backbones/blazenet.py
ppdet/modeling/backbones/blazenet.py
+3
-14
ppdet/modeling/backbones/ghostnet.py
ppdet/modeling/backbones/ghostnet.py
+4
-10
ppdet/modeling/backbones/hrnet.py
ppdet/modeling/backbones/hrnet.py
+7
-19
ppdet/modeling/backbones/mobilenet_v3.py
ppdet/modeling/backbones/mobilenet_v3.py
+6
-20
ppdet/modeling/backbones/vgg.py
ppdet/modeling/backbones/vgg.py
+2
-7
ppdet/modeling/heads/fcos_head.py
ppdet/modeling/heads/fcos_head.py
+8
-19
ppdet/modeling/necks/blazeface_fpn.py
ppdet/modeling/necks/blazeface_fpn.py
+3
-14
ppdet/modeling/necks/hrfpn.py
ppdet/modeling/necks/hrfpn.py
+0
-4
ppdet/modeling/reid/jde_embedding_head.py
ppdet/modeling/reid/jde_embedding_head.py
+1
-3
ppdet/modeling/reid/pyramidal_embedding.py
ppdet/modeling/reid/pyramidal_embedding.py
+3
-7
ppdet/modeling/reid/resnet.py
ppdet/modeling/reid/resnet.py
+2
-12
未找到文件。
ppdet/modeling/backbones/blazenet.py
浏览文件 @
36b48e9e
...
...
@@ -55,25 +55,14 @@ class ConvBNLayer(nn.Layer):
padding
=
padding
,
groups
=
num_groups
,
weight_attr
=
ParamAttr
(
learning_rate
=
conv_lr
,
initializer
=
KaimingNormal
(),
name
=
name
+
"_weights"
),
learning_rate
=
conv_lr
,
initializer
=
KaimingNormal
()),
bias_attr
=
False
)
param_attr
=
ParamAttr
(
name
=
name
+
"_bn_scale"
)
bias_attr
=
ParamAttr
(
name
=
name
+
"_bn_offset"
)
if
norm_type
==
'sync_bn'
:
self
.
_batch_norm
=
nn
.
SyncBatchNorm
(
out_channels
,
weight_attr
=
param_attr
,
bias_attr
=
bias_attr
)
self
.
_batch_norm
=
nn
.
SyncBatchNorm
(
out_channels
)
else
:
self
.
_batch_norm
=
nn
.
BatchNorm
(
out_channels
,
act
=
None
,
param_attr
=
param_attr
,
bias_attr
=
bias_attr
,
use_global_stats
=
False
,
moving_mean_name
=
name
+
'_bn_mean'
,
moving_variance_name
=
name
+
'_bn_variance'
)
out_channels
,
act
=
None
,
use_global_stats
=
False
)
def
forward
(
self
,
x
):
x
=
self
.
_conv
(
x
)
...
...
ppdet/modeling/backbones/ghostnet.py
浏览文件 @
36b48e9e
...
...
@@ -100,21 +100,15 @@ class SEBlock(nn.Layer):
num_channels
,
med_ch
,
weight_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
initializer
=
Uniform
(
-
stdv
,
stdv
),
name
=
name
+
"_1_weights"
),
bias_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
name
=
name
+
"_1_offset"
))
learning_rate
=
lr_mult
,
initializer
=
Uniform
(
-
stdv
,
stdv
)),
bias_attr
=
ParamAttr
(
learning_rate
=
lr_mult
))
stdv
=
1.0
/
math
.
sqrt
(
med_ch
*
1.0
)
self
.
excitation
=
Linear
(
med_ch
,
num_channels
,
weight_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
initializer
=
Uniform
(
-
stdv
,
stdv
),
name
=
name
+
"_2_weights"
),
bias_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
name
=
name
+
"_2_offset"
))
learning_rate
=
lr_mult
,
initializer
=
Uniform
(
-
stdv
,
stdv
)),
bias_attr
=
ParamAttr
(
learning_rate
=
lr_mult
))
def
forward
(
self
,
inputs
):
pool
=
self
.
pool2d_gap
(
inputs
)
...
...
ppdet/modeling/backbones/hrnet.py
浏览文件 @
36b48e9e
...
...
@@ -51,31 +51,23 @@ class ConvNormLayer(nn.Layer):
stride
=
stride
,
padding
=
(
filter_size
-
1
)
//
2
,
groups
=
1
,
weight_attr
=
ParamAttr
(
name
=
name
+
"_weights"
,
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
weight_attr
=
ParamAttr
(
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
bias_attr
=
False
)
norm_lr
=
0.
if
freeze_norm
else
1.
norm_name
=
name
+
'_bn'
param_attr
=
ParamAttr
(
name
=
norm_name
+
"_scale"
,
learning_rate
=
norm_lr
,
regularizer
=
L2Decay
(
norm_decay
))
learning_rate
=
norm_lr
,
regularizer
=
L2Decay
(
norm_decay
))
bias_attr
=
ParamAttr
(
name
=
norm_name
+
"_offset"
,
learning_rate
=
norm_lr
,
regularizer
=
L2Decay
(
norm_decay
))
learning_rate
=
norm_lr
,
regularizer
=
L2Decay
(
norm_decay
))
global_stats
=
True
if
freeze_norm
else
False
if
norm_type
in
[
'bn'
,
'sync_bn'
]:
self
.
norm
=
nn
.
BatchNorm
(
ch_out
,
param_attr
=
param_attr
,
bias_attr
=
bias_attr
,
use_global_stats
=
global_stats
,
moving_mean_name
=
norm_name
+
'_mean'
,
moving_variance_name
=
norm_name
+
'_variance'
)
use_global_stats
=
global_stats
)
elif
norm_type
==
'gn'
:
self
.
norm
=
nn
.
GroupNorm
(
num_groups
=
norm_groups
,
...
...
@@ -375,17 +367,13 @@ class SELayer(nn.Layer):
self
.
squeeze
=
Linear
(
num_channels
,
med_ch
,
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
),
name
=
name
+
"_sqz_weights"
),
bias_attr
=
ParamAttr
(
name
=
name
+
'_sqz_offset'
))
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
stdv
=
1.0
/
math
.
sqrt
(
med_ch
*
1.0
)
self
.
excitation
=
Linear
(
med_ch
,
num_filters
,
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
),
name
=
name
+
"_exc_weights"
),
bias_attr
=
ParamAttr
(
name
=
name
+
'_exc_offset'
))
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
def
forward
(
self
,
input
):
pool
=
self
.
pool2d_gap
(
input
)
...
...
ppdet/modeling/backbones/mobilenet_v3.py
浏览文件 @
36b48e9e
...
...
@@ -62,21 +62,17 @@ class ConvBNLayer(nn.Layer):
padding
=
padding
,
groups
=
num_groups
,
weight_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
),
name
=
name
+
"_weights"
),
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
)),
bias_attr
=
False
)
norm_lr
=
0.
if
freeze_norm
else
lr_mult
param_attr
=
ParamAttr
(
learning_rate
=
norm_lr
,
regularizer
=
L2Decay
(
norm_decay
),
name
=
name
+
"_bn_scale"
,
trainable
=
False
if
freeze_norm
else
True
)
bias_attr
=
ParamAttr
(
learning_rate
=
norm_lr
,
regularizer
=
L2Decay
(
norm_decay
),
name
=
name
+
"_bn_offset"
,
trainable
=
False
if
freeze_norm
else
True
)
global_stats
=
True
if
freeze_norm
else
False
if
norm_type
==
'sync_bn'
:
...
...
@@ -88,9 +84,7 @@ class ConvBNLayer(nn.Layer):
act
=
None
,
param_attr
=
param_attr
,
bias_attr
=
bias_attr
,
use_global_stats
=
global_stats
,
moving_mean_name
=
name
+
'_bn_mean'
,
moving_variance_name
=
name
+
'_bn_variance'
)
use_global_stats
=
global_stats
)
norm_params
=
self
.
bn
.
parameters
()
if
freeze_norm
:
for
param
in
norm_params
:
...
...
@@ -203,13 +197,9 @@ class SEModule(nn.Layer):
stride
=
1
,
padding
=
0
,
weight_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
),
name
=
name
+
"_1_weights"
),
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
)),
bias_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
),
name
=
name
+
"_1_offset"
))
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
)))
self
.
conv2
=
nn
.
Conv2D
(
in_channels
=
mid_channels
,
out_channels
=
channel
,
...
...
@@ -217,13 +207,9 @@ class SEModule(nn.Layer):
stride
=
1
,
padding
=
0
,
weight_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
),
name
=
name
+
"_2_weights"
),
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
)),
bias_attr
=
ParamAttr
(
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
),
name
=
name
+
"_2_offset"
))
learning_rate
=
lr_mult
,
regularizer
=
L2Decay
(
conv_decay
)))
def
forward
(
self
,
inputs
):
outputs
=
self
.
avg_pool
(
inputs
)
...
...
ppdet/modeling/backbones/vgg.py
浏览文件 @
36b48e9e
...
...
@@ -30,9 +30,7 @@ class ConvBlock(nn.Layer):
out_channels
=
out_channels
,
kernel_size
=
3
,
stride
=
1
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
name
+
"1_weights"
),
bias_attr
=
ParamAttr
(
name
=
name
+
"1_bias"
))
padding
=
1
)
self
.
conv_out_list
=
[]
for
i
in
range
(
1
,
groups
):
conv_out
=
self
.
add_sublayer
(
...
...
@@ -42,10 +40,7 @@ class ConvBlock(nn.Layer):
out_channels
=
out_channels
,
kernel_size
=
3
,
stride
=
1
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
name
+
"{}_weights"
.
format
(
i
+
1
)),
bias_attr
=
ParamAttr
(
name
=
name
+
"{}_bias"
.
format
(
i
+
1
))))
padding
=
1
))
self
.
conv_out_list
.
append
(
conv_out
)
self
.
pool
=
MaxPool2D
(
...
...
ppdet/modeling/heads/fcos_head.py
浏览文件 @
36b48e9e
...
...
@@ -151,12 +151,9 @@ class FCOSHead(nn.Layer):
kernel_size
=
3
,
stride
=
1
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
conv_cls_name
+
"_weights"
,
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
weight_attr
=
ParamAttr
(
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
bias_attr
=
ParamAttr
(
name
=
conv_cls_name
+
"_bias"
,
initializer
=
Constant
(
value
=
bias_init_value
))))
conv_reg_name
=
"fcos_head_reg"
...
...
@@ -168,13 +165,9 @@ class FCOSHead(nn.Layer):
kernel_size
=
3
,
stride
=
1
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
conv_reg_name
+
"_weights"
,
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
bias_attr
=
ParamAttr
(
name
=
conv_reg_name
+
"_bias"
,
initializer
=
Constant
(
value
=
0
))))
weight_attr
=
ParamAttr
(
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
bias_attr
=
ParamAttr
(
initializer
=
Constant
(
value
=
0
))))
conv_centerness_name
=
"fcos_head_centerness"
self
.
fcos_head_centerness
=
self
.
add_sublayer
(
...
...
@@ -185,13 +178,9 @@ class FCOSHead(nn.Layer):
kernel_size
=
3
,
stride
=
1
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
conv_centerness_name
+
"_weights"
,
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
bias_attr
=
ParamAttr
(
name
=
conv_centerness_name
+
"_bias"
,
initializer
=
Constant
(
value
=
0
))))
weight_attr
=
ParamAttr
(
initializer
=
Normal
(
mean
=
0.
,
std
=
0.01
)),
bias_attr
=
ParamAttr
(
initializer
=
Constant
(
value
=
0
))))
self
.
scales_regs
=
[]
for
i
in
range
(
len
(
self
.
fpn_stride
)):
...
...
ppdet/modeling/necks/blazeface_fpn.py
浏览文件 @
36b48e9e
...
...
@@ -51,25 +51,14 @@ class ConvBNLayer(nn.Layer):
padding
=
padding
,
groups
=
num_groups
,
weight_attr
=
ParamAttr
(
learning_rate
=
conv_lr
,
initializer
=
KaimingNormal
(),
name
=
name
+
"_weights"
),
learning_rate
=
conv_lr
,
initializer
=
KaimingNormal
()),
bias_attr
=
False
)
param_attr
=
ParamAttr
(
name
=
name
+
"_bn_scale"
)
bias_attr
=
ParamAttr
(
name
=
name
+
"_bn_offset"
)
if
norm_type
==
'sync_bn'
:
self
.
_batch_norm
=
nn
.
SyncBatchNorm
(
out_channels
,
weight_attr
=
param_attr
,
bias_attr
=
bias_attr
)
self
.
_batch_norm
=
nn
.
SyncBatchNorm
(
out_channels
)
else
:
self
.
_batch_norm
=
nn
.
BatchNorm
(
out_channels
,
act
=
None
,
param_attr
=
param_attr
,
bias_attr
=
bias_attr
,
use_global_stats
=
False
,
moving_mean_name
=
name
+
'_bn_mean'
,
moving_variance_name
=
name
+
'_bn_variance'
)
out_channels
,
act
=
None
,
use_global_stats
=
False
)
def
forward
(
self
,
x
):
x
=
self
.
_conv
(
x
)
...
...
ppdet/modeling/necks/hrfpn.py
浏览文件 @
36b48e9e
...
...
@@ -14,7 +14,6 @@
import
paddle
import
paddle.nn.functional
as
F
from
paddle
import
ParamAttr
import
paddle.nn
as
nn
from
ppdet.core.workspace
import
register
from
..shape_spec
import
ShapeSpec
...
...
@@ -53,7 +52,6 @@ class HRFPN(nn.Layer):
in_channels
=
in_channel
,
out_channels
=
out_channel
,
kernel_size
=
1
,
weight_attr
=
ParamAttr
(
name
=
'hrfpn_reduction_weights'
),
bias_attr
=
False
)
if
share_conv
:
...
...
@@ -62,7 +60,6 @@ class HRFPN(nn.Layer):
out_channels
=
out_channel
,
kernel_size
=
3
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
'fpn_conv_weights'
),
bias_attr
=
False
)
else
:
self
.
fpn_conv
=
[]
...
...
@@ -75,7 +72,6 @@ class HRFPN(nn.Layer):
out_channels
=
out_channel
,
kernel_size
=
3
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
conv_name
+
"_weights"
),
bias_attr
=
False
))
self
.
fpn_conv
.
append
(
conv
)
...
...
ppdet/modeling/reid/jde_embedding_head.py
浏览文件 @
36b48e9e
...
...
@@ -92,9 +92,7 @@ class JDEEmbeddingHead(nn.Layer):
kernel_size
=
3
,
stride
=
1
,
padding
=
1
,
weight_attr
=
ParamAttr
(
name
=
name
+
'.conv.weights'
),
bias_attr
=
ParamAttr
(
name
=
name
+
'.conv.bias'
,
regularizer
=
L2Decay
(
0.
))))
bias_attr
=
ParamAttr
(
regularizer
=
L2Decay
(
0.
))))
self
.
identify_outputs
.
append
(
identify_output
)
loss_p_cls
=
self
.
add_sublayer
(
'cls.{}'
.
format
(
i
),
LossParam
(
-
4.15
))
...
...
ppdet/modeling/reid/pyramidal_embedding.py
浏览文件 @
36b48e9e
...
...
@@ -89,16 +89,12 @@ class PCBPyramid(nn.Layer):
if
idx_branches
>=
sum
(
self
.
num_in_each_level
[
0
:
idx_levels
+
1
]):
idx_levels
+=
1
name
=
"Linear_branch_id_{}"
.
format
(
idx_branches
)
fc
=
nn
.
Linear
(
in_features
=
num_conv_out_channels
,
out_features
=
self
.
num_classes
,
weight_attr
=
ParamAttr
(
name
=
name
+
"_weights"
,
initializer
=
Normal
(
mean
=
0.
,
std
=
0.001
)),
bias_attr
=
ParamAttr
(
name
=
name
+
"_bias"
,
initializer
=
Constant
(
value
=
0.
)))
weight_attr
=
ParamAttr
(
initializer
=
Normal
(
mean
=
0.
,
std
=
0.001
)),
bias_attr
=
ParamAttr
(
initializer
=
Constant
(
value
=
0.
)))
pyramid_fc_list
.
append
(
fc
)
return
pyramid_conv_list
,
pyramid_fc_list
...
...
ppdet/modeling/reid/resnet.py
浏览文件 @
36b48e9e
...
...
@@ -50,23 +50,13 @@ class ConvBNLayer(nn.Layer):
dilation
=
dilation
,
groups
=
groups
,
weight_attr
=
ParamAttr
(
name
=
name
+
"_weights"
,
learning_rate
=
lr_mult
,
initializer
=
Normal
(
0
,
math
.
sqrt
(
2.
/
conv_stdv
))),
bias_attr
=
False
,
data_format
=
data_format
)
if
name
==
"conv1"
:
bn_name
=
"bn_"
+
name
else
:
bn_name
=
"bn"
+
name
[
3
:]
self
.
_batch_norm
=
nn
.
BatchNorm
(
num_filters
,
act
=
act
,
param_attr
=
ParamAttr
(
name
=
bn_name
+
"_scale"
),
bias_attr
=
ParamAttr
(
bn_name
+
"_offset"
),
moving_mean_name
=
bn_name
+
"_mean"
,
moving_variance_name
=
bn_name
+
"_variance"
,
data_layout
=
data_format
)
num_filters
,
act
=
act
,
data_layout
=
data_format
)
def
forward
(
self
,
inputs
):
y
=
self
.
_conv
(
inputs
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录