Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
70ccf385
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
70ccf385
编写于
9月 30, 2019
作者:
B
Bai Yifan
提交者:
whs
9月 30, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix scripts and docs (#3465)
上级
a324d22d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
105 addition
and
64 deletion
+105
-64
PaddleSlim/classification/distillation/README.md
PaddleSlim/classification/distillation/README.md
+2
-0
PaddleSlim/classification/distillation/run.sh
PaddleSlim/classification/distillation/run.sh
+3
-31
PaddleSlim/classification/pruning/README.md
PaddleSlim/classification/pruning/README.md
+2
-0
PaddleSlim/classification/pruning/run.sh
PaddleSlim/classification/pruning/run.sh
+42
-11
PaddleSlim/classification/quantization/README.md
PaddleSlim/classification/quantization/README.md
+2
-0
PaddleSlim/classification/quantization/run.sh
PaddleSlim/classification/quantization/run.sh
+54
-22
未找到文件。
PaddleSlim/classification/distillation/README.md
浏览文件 @
70ccf385
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
## 概述
## 概述
该示例使用PaddleSlim提供的
[
蒸馏策略
](
[https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#3-%E8%92%B8%E9%A6%8F](https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#3-蒸馏
)
)对分类模型进行知识蒸馏。
该示例使用PaddleSlim提供的
[
蒸馏策略
](
[https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#3-%E8%92%B8%E9%A6%8F](https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#3-蒸馏
)
)对分类模型进行知识蒸馏。
>本文默认使用ILSVRC2012数据集,数据集存放在`models/PaddleSlim/data/`路径下, 可以参考[数据准备](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification#数据准备)在执行训练脚本run.sh前配置好您的数据集
在阅读该示例前,建议您先了解以下内容:
在阅读该示例前,建议您先了解以下内容:
-
[
分类模型的常规训练方法
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification
)
-
[
分类模型的常规训练方法
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification
)
...
...
PaddleSlim/classification/distillation/run.sh
浏览文件 @
70ccf385
...
@@ -2,9 +2,6 @@
...
@@ -2,9 +2,6 @@
# download pretrain model
# download pretrain model
root_url
=
"http://paddle-imagenet-models-name.bj.bcebos.com"
root_url
=
"http://paddle-imagenet-models-name.bj.bcebos.com"
MobileNetV1
=
"MobileNetV1_pretrained.tar"
MobileNetV2
=
"MobileNetV2_pretrained.tar"
ResNet34
=
"ResNet34_pretrained.tar"
ResNet50
=
"ResNet50_pretrained.tar"
ResNet50
=
"ResNet50_pretrained.tar"
pretrain_dir
=
'../pretrain'
pretrain_dir
=
'../pretrain'
...
@@ -14,15 +11,6 @@ fi
...
@@ -14,15 +11,6 @@ fi
cd
${
pretrain_dir
}
cd
${
pretrain_dir
}
if
[
!
-f
${
MobileNetV2
}
]
;
then
wget
${
root_url
}
/
${
MobileNetV2
}
tar
xf
${
MobileNetV2
}
fi
if
[
!
-f
${
ResNet34
}
]
;
then
wget
${
root_url
}
/
${
ResNet34
}
tar
xf
${
ResNet34
}
fi
if
[
!
-f
${
ResNet50
}
]
;
then
if
[
!
-f
${
ResNet50
}
]
;
then
wget
${
root_url
}
/
${
ResNet50
}
wget
${
root_url
}
/
${
ResNet50
}
tar
xf
${
ResNet50
}
tar
xf
${
ResNet50
}
...
@@ -62,7 +50,7 @@ for files in $(ls res50_*)
...
@@ -62,7 +50,7 @@ for files in $(ls res50_*)
done
done
cd
-
cd
-
# for mobilenet_v2 distillation
#
#
for mobilenet_v2 distillation
#cd ${pretrain_dir}/ResNet50_pretrained
#cd ${pretrain_dir}/ResNet50_pretrained
#for files in $(ls res50_*)
#for files in $(ls res50_*)
# do mv $files ${files#*_}
# do mv $files ${files#*_}
...
@@ -86,7 +74,7 @@ cd -
...
@@ -86,7 +74,7 @@ cd -
#done
#done
#cd -
#cd -
# for resnet34 distillation
#
#
for resnet34 distillation
#cd ${pretrain_dir}/ResNet50_pretrained
#cd ${pretrain_dir}/ResNet50_pretrained
#for files in $(ls res50_*)
#for files in $(ls res50_*)
# do mv $files ${files#*_}
# do mv $files ${files#*_}
...
@@ -96,16 +84,7 @@ cd -
...
@@ -96,16 +84,7 @@ cd -
#done
#done
#cd -
#cd -
#
#
#cd ${pretrain_dir}/ResNet34_pretrained
#python -u compress.py \
#for files in $(ls res34_*)
# do mv $files ${files#*_}
#done
#for files in $(ls *)
# do mv $files "res34_"$files
#done
#cd -
#
#python compress.py \
#--model "ResNet34" \
#--model "ResNet34" \
#--teacher_model "ResNet50" \
#--teacher_model "ResNet50" \
#--teacher_pretrained_model ../pretrain/ResNet50_pretrained \
#--teacher_pretrained_model ../pretrain/ResNet50_pretrained \
...
@@ -118,10 +97,3 @@ cd -
...
@@ -118,10 +97,3 @@ cd -
# do mv $files ${files#*_}
# do mv $files ${files#*_}
#done
#done
#cd -
#cd -
#
#cd ${pretrain_dir}/ResNet34_pretrained
#for files in $(ls res34_*)
# do mv $files ${files#*_}
#done
#cd -
PaddleSlim/classification/pruning/README.md
浏览文件 @
70ccf385
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
## 概述
## 概述
该示例使用PaddleSlim提供的
[
卷积通道剪裁压缩策略
](
https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#2-%E5%8D%B7%E7%A7%AF%E6%A0%B8%E5%89%AA%E8%A3%81%E5%8E%9F%E7%90%86
)
对分类模型进行压缩。
该示例使用PaddleSlim提供的
[
卷积通道剪裁压缩策略
](
https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#2-%E5%8D%B7%E7%A7%AF%E6%A0%B8%E5%89%AA%E8%A3%81%E5%8E%9F%E7%90%86
)
对分类模型进行压缩。
>本文默认使用ILSVRC2012数据集,数据集存放在`models/PaddleSlim/data/`路径下, 可以参考[数据准备](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification#数据准备)在执行训练脚本run.sh前配置好您的数据集
在阅读该示例前,建议您先了解以下内容:
在阅读该示例前,建议您先了解以下内容:
-
[
分类模型的常规训练方法
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification
)
-
[
分类模型的常规训练方法
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification
)
...
...
PaddleSlim/classification/pruning/run.sh
浏览文件 @
70ccf385
#!/usr/bin/env bash
export
CUDA_VISIBLE_DEVICES
=
0
export
CUDA_VISIBLE_DEVICES
=
0
nohup
python compress.py
\
# download pretrain model
root_url
=
"http://paddle-imagenet-models-name.bj.bcebos.com"
MobileNetV1
=
"MobileNetV1_pretrained.tar"
MobileNetV2
=
"MobileNetV2_pretrained.tar"
ResNet50
=
"ResNet50_pretrained.tar"
pretrain_dir
=
'../pretrain'
if
[
!
-d
${
pretrain_dir
}
]
;
then
mkdir
${
pretrain_dir
}
fi
cd
${
pretrain_dir
}
if
[
!
-f
${
MobileNetV1
}
]
;
then
wget
${
root_url
}
/
${
MobileNetV1
}
tar
xf
${
MobileNetV1
}
fi
if
[
!
-f
${
MobileNetV2
}
]
;
then
wget
${
root_url
}
/
${
MobileNetV2
}
tar
xf
${
MobileNetV2
}
fi
if
[
!
-f
${
ResNet50
}
]
;
then
wget
${
root_url
}
/
${
ResNet50
}
tar
xf
${
ResNet50
}
fi
cd
-
nohup
python
-u
compress.py
\
--model
"MobileNet"
\
--model
"MobileNet"
\
--use_gpu
0
\
--use_gpu
1
\
--batch_size
1
\
--batch_size
256
\
--pretrained_model
../pretrain/MobileNetV1_pretrained
\
--pretrained_model
../pretrain/MobileNetV1_pretrained
\
--config_file
"./configs/mobilenet_v1.yaml"
\
--config_file
"./configs/mobilenet_v1.yaml"
\
>
mobilenet_v1.log 2>&1 &
>
mobilenet_v1.log 2>&1 &
tailf mobilenet_v1.log
tailf mobilenet_v1.log
# for compression of mobilenet_v2
# for compression of mobilenet_v2
#nohup python compress.py \
#nohup python
-u
compress.py \
#--model "MobileNetV2" \
#--model "MobileNetV2" \
#--use_gpu
0
\
#--use_gpu
1
\
#--batch_size
1
\
#--batch_size
256
\
#--pretrained_model ../pretrain/MobileNetV2_pretrained \
#--pretrained_model ../pretrain/MobileNetV2_pretrained \
#--config_file "./configs/mobilenet_v2.yaml" \
#--config_file "./configs/mobilenet_v2.yaml" \
#> mobilenet_v2.log 2>&1 &
#> mobilenet_v2.log 2>&1 &
#tailf mobilenet_v2.log
#tailf mobilenet_v2.log
# for compression of resnet50
#
#
for compression of resnet50
#python compress.py \
#python
-u
compress.py \
#--model "ResNet50" \
#--model "ResNet50" \
#--use_gpu
0
\
#--use_gpu
1
\
#--batch_size
1
\
#--batch_size
256
\
#--pretrained_model ../pretrain/ResNet50_pretrained \
#--pretrained_model ../pretrain/ResNet50_pretrained \
#--config_file "./configs/resnet50.yaml" \
#--config_file "./configs/resnet50.yaml" \
#> resnet50.log 2>&1 &
#> resnet50.log 2>&1 &
#tailf resnet50.log
#tailf resnet50.log
PaddleSlim/classification/quantization/README.md
浏览文件 @
70ccf385
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
## 概述
## 概述
该示例使用PaddleSlim提供的
[
量化压缩策略
](
https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#1-quantization-aware-training%E9%87%8F%E5%8C%96%E4%BB%8B%E7%BB%8D
)
对分类模型进行压缩。
该示例使用PaddleSlim提供的
[
量化压缩策略
](
https://github.com/PaddlePaddle/models/blob/develop/PaddleSlim/docs/tutorial.md#1-quantization-aware-training%E9%87%8F%E5%8C%96%E4%BB%8B%E7%BB%8D
)
对分类模型进行压缩。
>本文默认使用ILSVRC2012数据集,数据集存放在`models/PaddleSlim/data/`路径下, 可以参考[数据准备](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification#数据准备)在执行训练脚本run.sh前配置好您的数据集
在阅读该示例前,建议您先了解以下内容:
在阅读该示例前,建议您先了解以下内容:
-
[
分类模型的常规训练方法
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification
)
-
[
分类模型的常规训练方法
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/image_classification
)
...
...
PaddleSlim/classification/quantization/run.sh
浏览文件 @
70ccf385
#!/usr/bin/env bash
#!/usr/bin/env bash
#export CUDA_VISIBLE_DEVICES=0
# download pretrain model
root_url
=
"http://paddle-imagenet-models-name.bj.bcebos.com"
MobileNetV1
=
"MobileNetV1_pretrained.tar"
MobileNetV2
=
"MobileNetV2_pretrained.tar"
ResNet50
=
"ResNet50_pretrained.tar"
pretrain_dir
=
'../pretrain'
# for quantization for mobilenet_v1
if
[
!
-d
${
pretrain_dir
}
]
;
then
#python compress.py \
mkdir
${
pretrain_dir
}
# --model "MobileNet" \
fi
# --use_gpu 1 \
# --batch_size 32 \
cd
${
pretrain_dir
}
# --pretrained_model ../pretrain/MobileNetV1_pretrained \
# --config_file "./configs/mobilenet_v1.yaml" \
if
[
!
-f
${
MobileNetV1
}
]
;
then
#> mobilenet_v1.log 2>&1 &
wget
${
root_url
}
/
${
MobileNetV1
}
#tailf mobilenet_v1.log
tar
xf
${
MobileNetV1
}
fi
if
[
!
-f
${
MobileNetV2
}
]
;
then
wget
${
root_url
}
/
${
MobileNetV2
}
tar
xf
${
MobileNetV2
}
fi
if
[
!
-f
${
ResNet50
}
]
;
then
wget
${
root_url
}
/
${
ResNet50
}
tar
xf
${
ResNet50
}
fi
cd
-
# enable GC strategy
export
FLAGS_fast_eager_deletion_mode
=
1
export
FLAGS_eager_delete_tensor_gb
=
0.0
export
CUDA_VISIBLE_DEVICES
=
0
# for quantization of mobilenet_v2
## for quantization for mobilenet_v1
# python compress.py \
python
-u
compress.py
\
--model
"MobileNet"
\
--use_gpu
1
\
--batch_size
32
\
--pretrained_model
../pretrain/MobileNetV1_pretrained
\
--config_file
"./configs/mobilenet_v1.yaml"
\
>
mobilenet_v1.log 2>&1 &
tailf mobilenet_v1.log
## for quantization of mobilenet_v2
#python -u compress.py \
# --model "MobileNetV2" \
# --model "MobileNetV2" \
# --use_gpu 1 \
# --use_gpu 1 \
# --batch_size 32 \
# --batch_size 32 \
...
@@ -22,14 +56,12 @@
...
@@ -22,14 +56,12 @@
# > mobilenet_v2.log 2>&1 &
# > mobilenet_v2.log 2>&1 &
#tailf mobilenet_v2.log
#tailf mobilenet_v2.log
# for compression of resnet50
# for compression of resnet50
python compress.py
\
#python -u compress.py \
--model
"ResNet50"
\
# --model "ResNet50" \
--use_gpu
1
\
# --use_gpu 1 \
--batch_size
32
\
# --batch_size 32 \
--pretrained_model
../pretrain/ResNet50_pretrained
\
# --pretrained_model ../pretrain/ResNet50_pretrained \
--config_file
"./configs/resnet50.yaml"
\
# --config_file "./configs/resnet50.yaml" \
>
resnet50.log 2>&1 &
# > resnet50.log 2>&1 &
tailf resnet50.log
#tailf resnet50.log
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录