Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
6cae5aaf
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看板
提交
6cae5aaf
编写于
8月 29, 2020
作者:
littletomatodonkey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more distillation models
上级
5a15c165
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
11 deletion
+15
-11
ppcls/modeling/architectures/distillation_models.py
ppcls/modeling/architectures/distillation_models.py
+15
-10
ppcls/utils/save_load.py
ppcls/utils/save_load.py
+0
-1
未找到文件。
ppcls/modeling/architectures/distillation_models.py
浏览文件 @
6cae5aaf
...
...
@@ -42,20 +42,25 @@ class ResNet50_vd_distill_MobileNetV3_large_x1_0(fluid.dygraph.Layer):
def
forward
(
self
,
input
):
teacher_label
=
self
.
teacher
(
input
)
teacher_label
.
stop_gradient
=
True
student_label
=
self
.
student
(
input
)
return
teacher_label
,
student_label
class
ResNeXt101_32x16d_wsl_distill_ResNet50_vd
():
def
net
(
self
,
input
,
class_dim
=
1000
):
# student
student
=
ResNet50_vd
()
out_student
=
student
.
net
(
input
,
class_dim
=
class_dim
)
# teacher
teacher
=
ResNeXt101_32x16d_wsl
()
out_teacher
=
teacher
.
net
(
input
,
class_dim
=
class_dim
)
out_teacher
.
stop_gradient
=
True
class
ResNeXt101_32x16d_wsl_distill_ResNet50_vd
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
,
class_dim
=
1000
,
**
args
):
super
(
ResNet50_vd_distill_MobileNetV3_large_x1_0
,
self
).
__init__
()
self
.
teacher
=
ResNeXt101_32x16d_wsl
(
class_dim
=
class_dim
,
**
args
)
self
.
student
=
ResNet50_vd
(
class_dim
=
class_dim
,
**
args
)
def
forward
(
self
,
input
):
teacher_label
=
self
.
teacher
(
input
)
teacher_label
.
stop_gradient
=
True
student_label
=
self
.
student
(
input
)
return
out_teacher
,
out_student
return
teacher_label
,
student_label
\ No newline at end of file
ppcls/utils/save_load.py
浏览文件 @
6cae5aaf
...
...
@@ -58,7 +58,6 @@ def load_dygraph_pretrain(
model_dict
=
model
.
state_dict
()
for
key
in
model_dict
.
keys
():
weight_name
=
model_dict
[
key
].
name
print
(
"dyg key: {}, weight_name: {}"
.
format
(
key
,
weight_name
))
if
weight_name
in
pre_state_dict
.
keys
():
print
(
'Load weight: {}, shape: {}'
.
format
(
weight_name
,
pre_state_dict
[
weight_name
].
shape
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录