Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
efd21dd9
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看板
未验证
提交
efd21dd9
编写于
12月 02, 2021
作者:
W
will-jl944
提交者:
GitHub
12月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix assertion bug (#4772)
* fix assertion bug * fix assertion bug
上级
1cb2d6c3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
18 deletion
+11
-18
ppdet/modeling/backbones/lite_hrnet.py
ppdet/modeling/backbones/lite_hrnet.py
+10
-16
ppdet/modeling/ops.py
ppdet/modeling/ops.py
+1
-2
未找到文件。
ppdet/modeling/backbones/lite_hrnet.py
浏览文件 @
efd21dd9
...
...
@@ -48,10 +48,8 @@ class ConvNormLayer(nn.Layer):
self
.
act
=
act
norm_lr
=
0.
if
freeze_norm
else
1.
if
norm_type
is
not
None
:
assert
(
norm_type
in
[
'bn'
,
'sync_bn'
,
'gn'
],
"norm_type should be one of ['bn', 'sync_bn', 'gn'], but got {}"
.
format
(
norm_type
))
assert
norm_type
in
[
'bn'
,
'sync_bn'
,
'gn'
],
\
"norm_type should be one of ['bn', 'sync_bn', 'gn'], but got {}"
.
format
(
norm_type
)
param_attr
=
ParamAttr
(
initializer
=
Constant
(
1.0
),
learning_rate
=
norm_lr
,
...
...
@@ -277,10 +275,8 @@ class ShuffleUnit(nn.Layer):
branch_channel
=
out_channel
//
2
self
.
stride
=
stride
if
self
.
stride
==
1
:
assert
(
in_channel
==
branch_channel
*
2
,
"when stride=1, in_channel {} should equal to branch_channel*2 {}"
.
format
(
in_channel
,
branch_channel
*
2
))
assert
in_channel
==
branch_channel
*
2
,
\
"when stride=1, in_channel {} should equal to branch_channel*2 {}"
.
format
(
in_channel
,
branch_channel
*
2
)
if
stride
>
1
:
self
.
branch1
=
nn
.
Sequential
(
ConvNormLayer
(
...
...
@@ -500,11 +496,11 @@ class LiteHRNetModule(nn.Layer):
freeze_norm
=
False
,
norm_decay
=
0.
):
super
(
LiteHRNetModule
,
self
).
__init__
()
assert
(
num_branches
==
len
(
in_channels
),
"num_branches {} should equal to num_in_channels {}"
.
format
(
num_branches
,
len
(
in_channels
)))
assert
(
module_type
in
[
'LITE'
,
'NAIVE'
],
"module_type should be one of ['LITE', 'NAIVE']"
)
assert
num_branches
==
len
(
in_channels
),
\
"num_branches {} should equal to num_in_channels {}"
.
format
(
num_branches
,
len
(
in_channels
))
assert
module_type
in
[
'LITE'
,
'NAIVE'
],
"module_type should be one of ['LITE', 'NAIVE']"
self
.
num_branches
=
num_branches
self
.
in_channels
=
in_channels
self
.
multiscale_output
=
multiscale_output
...
...
@@ -699,10 +695,8 @@ class LiteHRNet(nn.Layer):
super
(
LiteHRNet
,
self
).
__init__
()
if
isinstance
(
return_idx
,
Integral
):
return_idx
=
[
return_idx
]
assert
(
network_type
in
[
"lite_18"
,
"lite_30"
,
"naive"
,
"wider_naive"
],
assert
network_type
in
[
"lite_18"
,
"lite_30"
,
"naive"
,
"wider_naive"
],
\
"the network_type should be one of [lite_18, lite_30, naive, wider_naive]"
)
assert
len
(
return_idx
)
>
0
,
"need one or more return index"
self
.
freeze_at
=
freeze_at
self
.
freeze_norm
=
freeze_norm
...
...
ppdet/modeling/ops.py
浏览文件 @
efd21dd9
...
...
@@ -1592,8 +1592,7 @@ def smooth_l1(input, label, inside_weight=None, outside_weight=None,
def
channel_shuffle
(
x
,
groups
):
batch_size
,
num_channels
,
height
,
width
=
x
.
shape
[
0
:
4
]
assert
(
num_channels
%
groups
==
0
,
'num_channels should be divisible by groups'
)
assert
num_channels
%
groups
==
0
,
'num_channels should be divisible by groups'
channels_per_group
=
num_channels
//
groups
x
=
paddle
.
reshape
(
x
=
x
,
shape
=
[
batch_size
,
groups
,
channels_per_group
,
height
,
width
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录