Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
dc427410
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
1 年多 前同步成功
通知
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看板
未验证
提交
dc427410
编写于
7月 12, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
7月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update ppyoloe act demo (#1277) (#1281)
上级
0384aa23
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
22 deletion
+11
-22
example/auto_compression/detection/README.md
example/auto_compression/detection/README.md
+6
-12
example/auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
...auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
+3
-6
example/auto_compression/detection/eval.py
example/auto_compression/detection/eval.py
+2
-2
example/auto_compression/detection/run.py
example/auto_compression/detection/run.py
+0
-2
未找到文件。
example/auto_compression/detection/README.md
浏览文件 @
dc427410
...
...
@@ -23,10 +23,10 @@
| 模型 | 策略 | 输入尺寸 | mAP
<sup>
val
<br>
0.5:0.95 | 预测时延
<sup><small>
FP32
</small><sup><br><sup>
(ms) |预测时延
<sup><small>
FP16
</small><sup><br><sup>
(ms) | 预测时延
<sup><small>
INT8
</small><sup><br><sup>
(ms) | 配置文件 | Inference模型 |
| :-------- |:-------- |:--------: | :---------------------: | :----------------: | :----------------: | :---------------: | :-----------------------------: | :-----------------------------: |
| PP-YOLOE-l | Base模型 | 640
*
640 | 50.9 | 11.2 | 7.7ms | - |
[
config
](
https://github.com/PaddlePaddle/PaddleDetection/blob/develop/configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/detection/ppyoloe_crn_l_300e_coco.tar
)
|
| PP-YOLOE-l | 量化
+蒸馏
| 640
*
640 | 50.6 | - | - | 6.7ms |
[
config
](
https://github.com/PaddlePaddle/PaddleSlim/tree/develop/demo/auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/ppyoloe_crn_l_300e_coco_quant.tar
)
|
| PP-YOLOE-l | 量化
蒸馏训练
| 640
*
640 | 50.6 | - | - | 6.7ms |
[
config
](
https://github.com/PaddlePaddle/PaddleSlim/tree/develop/demo/auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/ppyoloe_crn_l_300e_coco_quant.tar
)
|
-
mAP的指标均在COCO val2017数据集中评测得到。
-
PP-YOLOE模型在Tesla V100的GPU环境下测试,并且开启TensorRT,测试脚本是
[
benchmark demo
](
https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.4/deploy/python
)
。
-
PP-YOLOE模型在Tesla V100的GPU环境下测试,并且开启TensorRT,
batch_size=1,包含NMS,
测试脚本是
[
benchmark demo
](
https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.4/deploy/python
)
。
## 3. 自动压缩流程
...
...
@@ -63,6 +63,8 @@ pip install paddledet
如果数据集为非COCO格式数据,请修改
[
configs
](
./configs
)
中reader配置文件中的Dataset字段。
以PP-YOLOE模型为例,如果已经准备好数据集,请直接修改[./configs/yolo_reader.yml]中
`EvalDataset`
的
`dataset_dir`
字段为自己数据集路径即可。
#### 3.3 准备预测模型
预测模型的格式为:
`model.pdmodel`
和
`model.pdiparams`
两个,带
`pdmodel`
的是模型文件,带
`pdiparams`
后缀的是权重文件。
...
...
@@ -84,13 +86,7 @@ python tools/export_model.py \
trt
=
True
\
```
**注意**
:PP-YOLOE导出时设置
`trt=True`
旨在优化在TensorRT上的性能,其他模型不需要设置
`trt=True`
。
或直接下载:
```
shell
wget https://bj.bcebos.com/v1/paddle-slim-models/detection/ppyoloe_crn_l_300e_coco.tar
tar
-xf
ppyoloe_crn_l_300e_coco.tar
```
**注意**
:PP-YOLOE导出时设置
`trt=True`
旨在优化在TensorRT上的性能,如果没有使用TensorRT,或者其他模型都不需要设置
`trt=True`
。如果想快速体验,可以直接下载
[
PP-YOLOE-l导出模型
](
https://bj.bcebos.com/v1/paddle-slim-models/detection/ppyoloe_crn_l_300e_coco.tar
)
。
#### 3.4 自动压缩并产出模型
...
...
@@ -122,8 +118,6 @@ python eval.py --config_path=./configs/ppyoloe_l_qat_dis.yaml
## 4.预测部署
可以参考
[
PaddleDetection部署教程
](
https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.4/deploy
)
:
-
GPU上量化模型开启TensorRT并设置trt_int8模式进行部署;
-
CPU上可参考
[
X86 CPU部署量化模型教程
](
https://github.com/PaddlePaddle/Paddle-Inference-Demo/blob/master/docs/optimize/paddle_x86_cpu_int8.md
)
;
-
移动端请直接使用
[
Paddle Lite Demo
](
https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.4/deploy/lite
)
部署。
-
GPU上量化模型开启TensorRT并设置trt_int8模式进行部署。
## 5.FAQ
example/auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
浏览文件 @
dc427410
...
...
@@ -9,10 +9,7 @@ Global:
Distillation
:
alpha
:
1.0
loss
:
l2
node
:
-
concat_15.tmp_0
-
concat_14.tmp_0
loss
:
soft_label
Quantization
:
use_pact
:
true
...
...
@@ -22,12 +19,12 @@ Quantization:
-
depthwise_conv2d
TrainConfig
:
train_iter
:
3
000
train_iter
:
5
000
eval_iter
:
1000
learning_rate
:
type
:
CosineAnnealingDecay
learning_rate
:
0.00003
T_max
:
5
000
T_max
:
6
000
optimizer_builder
:
optimizer
:
type
:
SGD
...
...
example/auto_compression/detection/eval.py
浏览文件 @
dc427410
...
...
@@ -76,8 +76,8 @@ def eval():
place
=
paddle
.
CUDAPlace
(
0
)
if
FLAGS
.
devices
==
'gpu'
else
paddle
.
CPUPlace
()
exe
=
paddle
.
static
.
Executor
(
place
)
val_program
,
feed_target_names
,
fetch_targets
=
paddle
.
fluid
.
io
.
load_inference_model
(
global_config
[
"model_dir"
],
val_program
,
feed_target_names
,
fetch_targets
=
paddle
.
static
.
load_inference_model
(
global_config
[
"model_dir"
]
.
rstrip
(
'/'
)
,
exe
,
model_filename
=
global_config
[
"model_filename"
],
params_filename
=
global_config
[
"params_filename"
])
...
...
example/auto_compression/detection/run.py
浏览文件 @
dc427410
...
...
@@ -43,8 +43,6 @@ def argsparser():
type
=
str
,
default
=
'gpu'
,
help
=
"which device used to compress."
)
parser
.
add_argument
(
'--eval'
,
type
=
bool
,
default
=
False
,
help
=
"whether to run evaluation."
)
return
parser
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录