Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
f8bc4673
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看板
未验证
提交
f8bc4673
编写于
4月 16, 2020
作者:
G
Guanghua Yu
提交者:
GitHub
4月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set MobileNetV3 `feature_maps` parameter (#515)
上级
d103a9f8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
19 deletion
+37
-19
configs/ssd/ssdlite_mobilenet_v3_large.yml
configs/ssd/ssdlite_mobilenet_v3_large.yml
+1
-1
configs/ssd/ssdlite_mobilenet_v3_small.yml
configs/ssd/ssdlite_mobilenet_v3_small.yml
+1
-1
configs/yolov3_mobilenet_v3.yml
configs/yolov3_mobilenet_v3.yml
+1
-1
ppdet/modeling/backbones/mobilenet_v3.py
ppdet/modeling/backbones/mobilenet_v3.py
+34
-16
未找到文件。
configs/ssd/ssdlite_mobilenet_v3_large.yml
浏览文件 @
f8bc4673
...
...
@@ -26,8 +26,8 @@ MobileNetV3:
scale
:
1.0
model_name
:
large
extra_block_filters
:
[[
256
,
512
],
[
128
,
256
],
[
128
,
256
],
[
64
,
128
]]
with_extra_blocks
:
true
conv_decay
:
0.00004
feature_maps
:
[
5
,
7
,
8
,
9
,
10
,
11
]
SSDLiteMultiBoxHead
:
aspect_ratios
:
[[
2.
],
[
2.
,
3.
],
[
2.
,
3.
],
[
2.
,
3.
],
[
2.
,
3.
],
[
2.
,
3.
]]
...
...
configs/ssd/ssdlite_mobilenet_v3_small.yml
浏览文件 @
f8bc4673
...
...
@@ -26,8 +26,8 @@ MobileNetV3:
scale
:
1.0
model_name
:
small
extra_block_filters
:
[[
256
,
512
],
[
128
,
256
],
[
128
,
256
],
[
64
,
128
]]
with_extra_blocks
:
true
conv_decay
:
0.00004
feature_maps
:
[
5
,
7
,
8
,
9
,
10
,
11
]
SSDLiteMultiBoxHead
:
aspect_ratios
:
[[
2.
],
[
2.
,
3.
],
[
2.
,
3.
],
[
2.
,
3.
],
[
2.
,
3.
],
[
2.
,
3.
]]
...
...
configs/yolov3_mobilenet_v3.yml
浏览文件 @
f8bc4673
...
...
@@ -19,7 +19,7 @@ MobileNetV3:
norm_decay
:
0.
model_name
:
large
scale
:
1.
with_extra_blocks
:
false
feature_maps
:
[
1
,
2
,
3
,
4
,
6
]
YOLOv3Head
:
anchor_masks
:
[[
6
,
7
,
8
],
[
3
,
4
,
5
],
[
0
,
1
,
2
]]
...
...
ppdet/modeling/backbones/mobilenet_v3.py
浏览文件 @
f8bc4673
...
...
@@ -12,12 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
collections
import
OrderedDict
import
paddle.fluid
as
fluid
from
paddle.fluid.param_attr
import
ParamAttr
from
paddle.fluid.regularizer
import
L2Decay
from
ppdet.core.workspace
import
register
import
math
from
numbers
import
Integral
__all__
=
[
'MobileNetV3'
]
...
...
@@ -32,7 +38,7 @@ class MobileNetV3():
norm_type (str): normalization type, 'bn' and 'sync_bn' are supported.
norm_decay (float): weight decay for normalization layer weights.
conv_decay (float): weight decay for convolution layer weights.
with_extra_blocks (bool): if extra blocks should be add
ed.
feature_maps (list): index of stages whose feature maps are return
ed.
extra_block_filters (list): number of filter for each extra block.
"""
__shared__
=
[
'norm_type'
]
...
...
@@ -40,21 +46,24 @@ class MobileNetV3():
def
__init__
(
self
,
scale
=
1.0
,
model_name
=
'small'
,
with_extra_blocks
=
False
,
feature_maps
=
[
5
,
6
,
7
,
8
,
9
,
10
]
,
conv_decay
=
0.0
,
norm_type
=
'bn'
,
norm_decay
=
0.0
,
extra_block_filters
=
[[
256
,
512
],
[
128
,
256
],
[
128
,
256
],
[
64
,
128
]]):
if
isinstance
(
feature_maps
,
Integral
):
feature_maps
=
[
feature_maps
]
self
.
scale
=
scale
self
.
model_name
=
model_name
self
.
with_extra_blocks
=
with_extra_block
s
self
.
feature_maps
=
feature_map
s
self
.
extra_block_filters
=
extra_block_filters
self
.
conv_decay
=
conv_decay
self
.
norm_decay
=
norm_decay
self
.
inplanes
=
16
self
.
end_points
=
[]
self
.
block_stride
=
1
self
.
block_stride
=
0
if
model_name
==
"large"
:
self
.
cfg
=
[
# kernel_size, expand, channel, se_block, act_mode, stride
...
...
@@ -181,8 +190,11 @@ class MobileNetV3():
if_act
=
True
,
act
=
act
,
name
=
name
+
'_expand'
)
if
self
.
block_stride
==
16
and
stride
==
2
:
self
.
end_points
.
append
(
conv0
)
if
self
.
block_stride
==
4
and
stride
==
2
:
self
.
block_stride
+=
1
if
self
.
block_stride
in
self
.
feature_maps
:
self
.
end_points
.
append
(
conv0
)
conv1
=
self
.
_conv_bn_layer
(
input
=
conv0
,
filter_size
=
filter_size
,
...
...
@@ -265,9 +277,11 @@ class MobileNetV3():
name
=
'conv1'
)
i
=
0
for
layer_cfg
in
cfg
:
self
.
block_stride
*=
layer_cfg
[
5
]
if
layer_cfg
[
5
]
==
2
:
blocks
.
append
(
conv
)
self
.
block_stride
+=
1
if
self
.
block_stride
in
self
.
feature_maps
:
self
.
end_points
.
append
(
conv
)
conv
=
self
.
_residual_unit
(
input
=
conv
,
num_in_filter
=
inplanes
,
...
...
@@ -280,10 +294,9 @@ class MobileNetV3():
name
=
'conv'
+
str
(
i
+
2
))
inplanes
=
int
(
scale
*
layer_cfg
[
2
])
i
+=
1
blocks
.
append
(
conv
)
if
not
self
.
with_extra_blocks
:
return
blocks
self
.
block_stride
+=
1
if
self
.
block_stride
in
self
.
feature_maps
:
self
.
end_points
.
append
(
conv
)
# extra block
conv_extra
=
self
.
_conv_bn_layer
(
...
...
@@ -296,13 +309,18 @@ class MobileNetV3():
if_act
=
True
,
act
=
'hard_swish'
,
name
=
'conv'
+
str
(
i
+
2
))
self
.
end_points
.
append
(
conv_extra
)
self
.
block_stride
+=
1
if
self
.
block_stride
in
self
.
feature_maps
:
self
.
end_points
.
append
(
conv_extra
)
i
+=
1
for
block_filter
in
self
.
extra_block_filters
:
conv_extra
=
self
.
_extra_block_dw
(
conv_extra
,
block_filter
[
0
],
block_filter
[
1
],
2
,
'conv'
+
str
(
i
+
2
))
self
.
end_points
.
append
(
conv_extra
)
self
.
block_stride
+=
1
if
self
.
block_stride
in
self
.
feature_maps
:
self
.
end_points
.
append
(
conv_extra
)
i
+=
1
return
self
.
end_points
return
OrderedDict
([(
'mbv3_{}'
.
format
(
idx
),
feat
)
for
idx
,
feat
in
enumerate
(
self
.
end_points
)])
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录