Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
d3133089
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看板
未验证
提交
d3133089
编写于
5月 28, 2021
作者:
B
Bin Lu
提交者:
GitHub
5月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update mobilenet_v1.py
上级
aa8cf9ba
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
ppcls/arch/backbone/legendary_models/mobilenet_v1.py
ppcls/arch/backbone/legendary_models/mobilenet_v1.py
+12
-12
未找到文件。
ppcls/arch/backbone/legendary_models/mobilenet_v1.py
浏览文件 @
d3133089
...
...
@@ -19,7 +19,7 @@ import paddle
from
paddle
import
ParamAttr
import
paddle.nn
as
nn
from
paddle.nn
import
Conv2D
,
BatchNorm
,
Linear
,
Dropout
,
ReLU
,
Flatten
from
paddle.nn
import
AdaptiveAvgPool2D
,
MaxPool2D
,
AvgPool2D
from
paddle.nn
import
AdaptiveAvgPool2D
from
paddle.nn.initializer
import
KaimingNormal
import
math
...
...
@@ -47,7 +47,7 @@ class ConvBNLayer(TheseusLayer):
num_groups
=
1
):
super
(
ConvBNLayer
,
self
).
__init__
()
self
.
_
conv
=
Conv2D
(
self
.
conv
=
Conv2D
(
in_channels
=
num_channels
,
out_channels
=
num_filters
,
kernel_size
=
filter_size
,
...
...
@@ -58,15 +58,15 @@ class ConvBNLayer(TheseusLayer):
initializer
=
KaimingNormal
()),
bias_attr
=
False
)
self
.
_
bn
=
BatchNorm
(
self
.
bn
=
BatchNorm
(
num_filters
)
self
.
_
relu
=
ReLU
()
self
.
relu
=
ReLU
()
def
forward
(
self
,
x
):
x
=
self
.
_
conv
(
x
)
x
=
self
.
_
bn
(
x
)
x
=
self
.
_
relu
(
x
)
x
=
self
.
conv
(
x
)
x
=
self
.
bn
(
x
)
x
=
self
.
relu
(
x
)
return
x
...
...
@@ -80,7 +80,7 @@ class DepthwiseSeparable(TheseusLayer):
scale
):
super
(
DepthwiseSeparable
,
self
).
__init__
()
self
.
_
depthwise_conv
=
ConvBNLayer
(
self
.
depthwise_conv
=
ConvBNLayer
(
num_channels
=
num_channels
,
num_filters
=
int
(
num_filters1
*
scale
),
filter_size
=
3
,
...
...
@@ -88,7 +88,7 @@ class DepthwiseSeparable(TheseusLayer):
padding
=
1
,
num_groups
=
int
(
num_groups
*
scale
))
self
.
_
pointwise_conv
=
ConvBNLayer
(
self
.
pointwise_conv
=
ConvBNLayer
(
num_channels
=
int
(
num_filters1
*
scale
),
filter_size
=
1
,
num_filters
=
int
(
num_filters2
*
scale
),
...
...
@@ -96,8 +96,8 @@ class DepthwiseSeparable(TheseusLayer):
padding
=
0
)
def
forward
(
self
,
x
):
x
=
self
.
_
depthwise_conv
(
x
)
x
=
self
.
_
pointwise_conv
(
x
)
x
=
self
.
depthwise_conv
(
x
)
x
=
self
.
pointwise_conv
(
x
)
return
x
...
...
@@ -139,7 +139,7 @@ class MobileNet(TheseusLayer):
scale
=
scale
)
for
params
in
self
.
cfg
])
self
.
avg_pool
=
AdaptiveAvgPool2D
(
1
)
self
.
flatten
=
Flatten
(
start_axis
=
1
,
stop_axis
=-
1
)
self
.
flatten
=
Flatten
(
start_axis
=
1
,
stop_axis
=-
1
)
self
.
fc
=
Linear
(
int
(
1024
*
scale
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录