Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
0ef1ac3f
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看板
未验证
提交
0ef1ac3f
编写于
5月 11, 2022
作者:
G
gaotingquan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
6e0900ec
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
17 deletion
+21
-17
ppcls/arch/backbone/legendary_models/pp_lcnet_v2.py
ppcls/arch/backbone/legendary_models/pp_lcnet_v2.py
+21
-17
未找到文件。
ppcls/arch/backbone/legendary_models/pp_lcnet_v2.py
浏览文件 @
0ef1ac3f
...
@@ -256,10 +256,10 @@ class PPLCNetV2(TheseusLayer):
...
@@ -256,10 +256,10 @@ class PPLCNetV2(TheseusLayer):
depths
=
[
2
,
2
,
6
,
2
],
depths
=
[
2
,
2
,
6
,
2
],
class_num
=
1000
,
class_num
=
1000
,
dropout_prob
=
0.2
,
dropout_prob
=
0.2
,
class_
expand
=
1280
):
expand
=
1280
):
super
().
__init__
()
super
().
__init__
()
self
.
scale
=
scale
self
.
scale
=
scale
self
.
class_expand
=
class_
expand
self
.
expand
=
expand
self
.
stem
=
nn
.
Sequential
(
*
[
self
.
stem
=
nn
.
Sequential
(
*
[
ConvBNLayer
(
ConvBNLayer
(
...
@@ -339,19 +339,22 @@ class PPLCNetV2(TheseusLayer):
...
@@ -339,19 +339,22 @@ class PPLCNetV2(TheseusLayer):
self
.
avg_pool
=
AdaptiveAvgPool2D
(
1
)
self
.
avg_pool
=
AdaptiveAvgPool2D
(
1
)
self
.
last_conv
=
Conv2D
(
if
self
.
expand
:
in_channels
=
make_divisible
(
NET_CONFIG
[
"stage4"
][
0
]
*
2
*
scale
),
self
.
last_conv
=
Conv2D
(
out_channels
=
self
.
class_expand
,
in_channels
=
make_divisible
(
NET_CONFIG
[
"stage4"
][
0
]
*
2
*
kernel_size
=
1
,
scale
),
stride
=
1
,
out_channels
=
self
.
expand
,
padding
=
0
,
kernel_size
=
1
,
bias_attr
=
False
)
stride
=
1
,
padding
=
0
,
bias_attr
=
False
)
self
.
act
=
nn
.
ReLU
()
self
.
dropout
=
Dropout
(
p
=
dropout_prob
,
mode
=
"downscale_in_infer"
)
self
.
act
=
nn
.
ReLU
()
self
.
dropout
=
Dropout
(
p
=
dropout_prob
,
mode
=
"downscale_in_infer"
)
self
.
flatten
=
nn
.
Flatten
(
start_axis
=
1
,
stop_axis
=-
1
)
self
.
flatten
=
nn
.
Flatten
(
start_axis
=
1
,
stop_axis
=-
1
)
in_features
=
self
.
expand
if
self
.
expand
else
NET_CONFIG
[
"stage4"
][
self
.
fc
=
Linear
(
self
.
class_expand
,
class_num
)
0
]
*
2
*
scale
self
.
fc
=
Linear
(
in_features
,
class_num
)
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
x
=
self
.
stem
(
x
)
x
=
self
.
stem
(
x
)
...
@@ -360,9 +363,10 @@ class PPLCNetV2(TheseusLayer):
...
@@ -360,9 +363,10 @@ class PPLCNetV2(TheseusLayer):
x
=
self
.
stage3
(
x
)
x
=
self
.
stage3
(
x
)
x
=
self
.
stage4
(
x
)
x
=
self
.
stage4
(
x
)
x
=
self
.
avg_pool
(
x
)
x
=
self
.
avg_pool
(
x
)
x
=
self
.
last_conv
(
x
)
if
self
.
expand
:
x
=
self
.
act
(
x
)
x
=
self
.
last_conv
(
x
)
x
=
self
.
dropout
(
x
)
x
=
self
.
act
(
x
)
x
=
self
.
dropout
(
x
)
x
=
self
.
flatten
(
x
)
x
=
self
.
flatten
(
x
)
x
=
self
.
fc
(
x
)
x
=
self
.
fc
(
x
)
return
x
return
x
...
@@ -393,4 +397,4 @@ def PPLCNetV2_base(pretrained=False, use_ssld=False, **kwargs):
...
@@ -393,4 +397,4 @@ def PPLCNetV2_base(pretrained=False, use_ssld=False, **kwargs):
"""
"""
model
=
PPLCNetV2
(
scale
=
1.0
,
depths
=
[
2
,
2
,
6
,
2
],
**
kwargs
)
model
=
PPLCNetV2
(
scale
=
1.0
,
depths
=
[
2
,
2
,
6
,
2
],
**
kwargs
)
_load_pretrained
(
pretrained
,
model
,
MODEL_URLS
[
"PPLCNetV2_base"
],
use_ssld
)
_load_pretrained
(
pretrained
,
model
,
MODEL_URLS
[
"PPLCNetV2_base"
],
use_ssld
)
return
model
return
model
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录