Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
80184c47
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
大约 2 年 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
80184c47
编写于
5月 20, 2022
作者:
Z
zhouzj
提交者:
GitHub
5月 20, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Auto_seg's demo (#1124)
* Add dataset download link. * Fix some bugs. * Fix some bugs. * Fix docs.
上级
66c1680c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
10 deletion
+44
-10
demo/auto_compression/hyperparameter_tutorial.md
demo/auto_compression/hyperparameter_tutorial.md
+7
-7
demo/auto_compression/semantic_segmentation/README.md
demo/auto_compression/semantic_segmentation/README.md
+33
-2
demo/auto_compression/semantic_segmentation/configs/pp_humanseg_sparse_dis.yaml
...semantic_segmentation/configs/pp_humanseg_sparse_dis.yaml
+4
-1
未找到文件。
demo/auto_compression/hyperparameter_tutorial.md
浏览文件 @
80184c47
...
@@ -56,7 +56,7 @@ Prune:
...
@@ -56,7 +56,7 @@ Prune:
# pruned_ratio: 裁剪比例
# pruned_ratio: 裁剪比例
pruned_ratio
:
0.25
pruned_ratio
:
0.25
# prune_params_name: 需要裁剪的参数名字
# prune_params_name: 需要裁剪的参数名字
prune_params_name
:
prune_params_name
:
-
conv1_weights
-
conv1_weights
# criterion: 评估一个卷积层内通道重要性所参考的指标
# criterion: 评估一个卷积层内通道重要性所参考的指标
criterion
:
l1_norm
criterion
:
l1_norm
...
@@ -79,12 +79,12 @@ UnstructurePrune:
...
@@ -79,12 +79,12 @@ UnstructurePrune:
threshold
:
0.001
threshold
:
0.001
# gmp_config: 传入额外的训练超参用以指导GMP训练过程
# gmp_config: 传入额外的训练超参用以指导GMP训练过程
gmp_config
:
gmp_config
:
-
stable_iterations
:
0
stable_iterations
:
0
-
pruning_iterations
:
4500
# total_iters * 0.4~0.45
pruning_iterations
:
4500
# total_iters * 0.4~0.45
-
tunning_iterations
:
4500
# total_iters * 0.4~0.45
tunning_iterations
:
4500
# total_iters * 0.4~0.45
-
resume_iteration
:
-1
resume_iteration
:
-1
-
pruning_steps
:
100
pruning_steps
:
100
-
initial_ratio
:
0.15
initial_ratio
:
0.15
# prune_params_type: 用以指定哪些类型的参数参与稀疏。
# prune_params_type: 用以指定哪些类型的参数参与稀疏。
prune_params_type
:
conv1x1_only
prune_params_type
:
conv1x1_only
# local_sparsity: 剪裁比例(ratio)应用的范围
# local_sparsity: 剪裁比例(ratio)应用的范围
...
...
demo/auto_compression/semantic_segmentation/README.md
浏览文件 @
80184c47
...
@@ -61,7 +61,7 @@ pip install paddleseg
...
@@ -61,7 +61,7 @@ pip install paddleseg
#### 3.2 准备数据集
#### 3.2 准备数据集
开发者可下载开源数据集或自定义语义分割数据集,例如PP-HumanSeg-Lite模型中使用的语义分割数据集
[
PP-HumanSeg14K
](
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.5/contrib/PP-HumanSeg/paper.md#pp-humanseg14k-a-large-scale-teleconferencing-video-dataset
)
可从官方渠道下载。
开发者可下载开源数据集
(
[
AIsegment
](
https://github.com/aisegmentcn/matting_human_datasets
)
)
或自定义语义分割数据集,例如PP-HumanSeg-Lite模型中使用的语义分割数据集
[
PP-HumanSeg14K
](
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.5/contrib/PP-HumanSeg/paper.md#pp-humanseg14k-a-large-scale-teleconferencing-video-dataset
)
可从官方渠道下载。
如果是自定义数据,请参考
[
PaddleSeg数据准备文档
](
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.5/docs/data/marker/marker_cn.md
)
来检查对齐数据格式即可。
如果是自定义数据,请参考
[
PaddleSeg数据准备文档
](
https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.5/docs/data/marker/marker_cn.md
)
来检查对齐数据格式即可。
...
@@ -74,7 +74,7 @@ pip install paddleseg
...
@@ -74,7 +74,7 @@ pip install paddleseg
-
如果想快速体验,可直接下载PP-HumanSeg-Lite 的预测模型:
-
如果想快速体验,可直接下载PP-HumanSeg-Lite 的预测模型:
```
shell
```
shell
wget https://
paddleseg.bj.bcebos.com/dygraph/ppseg
/ppseg_lite_portrait_398x224_with_softmax.tar.gz
wget https://
bj.bcebos.com/v1/paddlemodels/PaddleSlim/analysis
/ppseg_lite_portrait_398x224_with_softmax.tar.gz
tar
-xzf
ppseg_lite_portrait_398x224_with_softmax.tar.gz
tar
-xzf
ppseg_lite_portrait_398x224_with_softmax.tar.gz
```
```
...
@@ -87,6 +87,7 @@ tar -xzf ppseg_lite_portrait_398x224_with_softmax.tar.gz
...
@@ -87,6 +87,7 @@ tar -xzf ppseg_lite_portrait_398x224_with_softmax.tar.gz
当只设置训练参数,并传入
``deploy_hardware``
字段时,将自动搜索压缩策略进行压缩。以骁龙710(SD710)为部署硬件,进行自动压缩的运行命令如下:
当只设置训练参数,并传入
``deploy_hardware``
字段时,将自动搜索压缩策略进行压缩。以骁龙710(SD710)为部署硬件,进行自动压缩的运行命令如下:
```
shell
```
shell
# 单卡启动
export
CUDA_VISIBLE_DEVICES
=
0
export
CUDA_VISIBLE_DEVICES
=
0
python run.py
\
python run.py
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
...
@@ -95,9 +96,20 @@ python run.py \
...
@@ -95,9 +96,20 @@ python run.py \
--save_dir
=
'./save_model'
\
--save_dir
=
'./save_model'
\
--config_path
=
'configs/pp_humanseg_auto.yaml'
\
--config_path
=
'configs/pp_humanseg_auto.yaml'
\
--deploy_hardware
=
'SD710'
--deploy_hardware
=
'SD710'
# 多卡启动
export
CUDA_VISIBLE_DEVICES
=
0,1
python
-m
paddle.distributed.launch run.py
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
--model_filename
=
'model.pdmodel'
\
--params_filename
=
'model.pdiparams'
\
--save_dir
=
'./save_model'
\
--config_path
=
'configs/pp_humanseg_auto.yaml'
--deploy_hardware
=
'SD710'
```
```
-
自行配置稀疏参数进行非结构化稀疏和蒸馏训练,配置参数含义详见
[
自动压缩超参文档
](
https://github.com/PaddlePaddle/PaddleSlim/blob/27dafe1c722476f1b16879f7045e9215b6f37559/demo/auto_compression/hyperparameter_tutorial.md
)
。具体命令如下所示:
-
自行配置稀疏参数进行非结构化稀疏和蒸馏训练,配置参数含义详见
[
自动压缩超参文档
](
https://github.com/PaddlePaddle/PaddleSlim/blob/27dafe1c722476f1b16879f7045e9215b6f37559/demo/auto_compression/hyperparameter_tutorial.md
)
。具体命令如下所示:
```
shell
```
shell
# 单卡启动
export
CUDA_VISIBLE_DEVICES
=
0
export
CUDA_VISIBLE_DEVICES
=
0
python run.py
\
python run.py
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
...
@@ -105,10 +117,20 @@ python run.py \
...
@@ -105,10 +117,20 @@ python run.py \
--params_filename
=
'model.pdiparams'
\
--params_filename
=
'model.pdiparams'
\
--save_dir
=
'./save_model'
\
--save_dir
=
'./save_model'
\
--config_path
=
'configs/pp_humanseg_sparse_dis.yaml'
--config_path
=
'configs/pp_humanseg_sparse_dis.yaml'
# 多卡启动
export
CUDA_VISIBLE_DEVICES
=
0,1
python
-m
paddle.distributed.launch run.py
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
--model_filename
=
'model.pdmodel'
\
--params_filename
=
'model.pdiparams'
\
--save_dir
=
'./save_model'
\
--config_path
=
'configs/pp_humanseg_sparse_dis.yaml'
```
```
-
自行配置量化参数进行量化和蒸馏训练,配置参数含义详见
[
自动压缩超参文档
](
https://github.com/PaddlePaddle/PaddleSlim/blob/27dafe1c722476f1b16879f7045e9215b6f37559/demo/auto_compression/hyperparameter_tutorial.md
)
。具体命令如下所示:
-
自行配置量化参数进行量化和蒸馏训练,配置参数含义详见
[
自动压缩超参文档
](
https://github.com/PaddlePaddle/PaddleSlim/blob/27dafe1c722476f1b16879f7045e9215b6f37559/demo/auto_compression/hyperparameter_tutorial.md
)
。具体命令如下所示:
```
shell
```
shell
# 单卡启动
export
CUDA_VISIBLE_DEVICES
=
0
export
CUDA_VISIBLE_DEVICES
=
0
python run.py
\
python run.py
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
...
@@ -116,6 +138,15 @@ python run.py \
...
@@ -116,6 +138,15 @@ python run.py \
--params_filename
=
'model.pdiparams'
\
--params_filename
=
'model.pdiparams'
\
--save_dir
=
'./save_model'
\
--save_dir
=
'./save_model'
\
--config_path
=
'configs/pp_humanseg_quant_dis.yaml'
--config_path
=
'configs/pp_humanseg_quant_dis.yaml'
# 多卡启动
export
CUDA_VISIBLE_DEVICES
=
0,1
python
-m
paddle.distributed.launch run.py
\
--model_dir
=
'./ppseg_lite_portrait_398x224_with_softmax'
\
--model_filename
=
'model.pdmodel'
\
--params_filename
=
'model.pdiparams'
\
--save_dir
=
'./save_model'
\
--config_path
=
'configs/pp_humanseg_quant_dis.yaml'
```
```
压缩完成后会在
`save_dir`
中产出压缩好的预测模型,可直接预测部署。
压缩完成后会在
`save_dir`
中产出压缩好的预测模型,可直接预测部署。
...
...
demo/auto_compression/semantic_segmentation/configs/pp_humanseg_sparse_dis.yaml
浏览文件 @
80184c47
...
@@ -27,7 +27,10 @@ UnstructurePrune:
...
@@ -27,7 +27,10 @@ UnstructurePrune:
TrainConfig
:
TrainConfig
:
epochs
:
14
epochs
:
14
eval_iter
:
400
eval_iter
:
400
learning_rate
:
5.0e-03
learning_rate
:
type
:
PiecewiseDecay
boundaries
:
[
4500
]
values
:
[
0.005
,
0.0005
]
optim_args
:
optim_args
:
weight_decay
:
0.0005
weight_decay
:
0.0005
optimizer
:
SGD
optimizer
:
SGD
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录