Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
acaf1068
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
acaf1068
编写于
5月 07, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
5月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add pp-yoloe quantization model (#5894)
上级
6f77e8ba
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
42 addition
and
4 deletion
+42
-4
configs/slim/README.md
configs/slim/README.md
+3
-0
configs/slim/README_en.md
configs/slim/README_en.md
+3
-1
configs/slim/quant/ppyoloe_l_qat.yml
configs/slim/quant/ppyoloe_l_qat.yml
+26
-0
ppdet/engine/trainer.py
ppdet/engine/trainer.py
+4
-3
ppdet/modeling/heads/ppyoloe_head.py
ppdet/modeling/heads/ppyoloe_head.py
+1
-0
ppdet/slim/quant.py
ppdet/slim/quant.py
+5
-0
未找到文件。
configs/slim/README.md
浏览文件 @
acaf1068
...
...
@@ -126,6 +126,8 @@ python tools/export_model.py -c configs/{MODEL.yml} --slim_config configs/slim/{
| 模型 | 压缩策略 | 输入尺寸 | 模型体积(MB) | 预测时延(V100) | 预测时延(SD855) | Box AP | 下载 | Inference模型下载 | 模型配置文件 | 压缩算法配置文件 |
| ------------------ | ------------ | -------- | :---------: | :---------: |:---------: | :---------: | :----------------------------------------------: | :----------------------------------------------: |:------------------------------------------: | :------------------------------------: |
| PP-YOLOE-l | baseline | 640 | - | 11.2ms(trt_fp32)
|
7.7ms(trt_fp16) | -- | 50.9 |
[
下载链接
](
https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
)
| - |
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml
)
| - |
| PP-YOLOE-l | 普通在线量化 | 640 | - | 6.7ms(trt_int8) | -- | 48.8 |
[
下载链接
](
https://paddledet.bj.bcebos.com/models/slim/ppyoloe_l_coco_qat.pdparams
)
| - |
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml
)
|
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/quant/ppyoloe_l_qat.yml
)
|
| PP-YOLOv2_R50vd | baseline | 640 | 208.6 | 19.1ms | -- | 49.1 |
[
下载链接
](
https://paddledet.bj.bcebos.com/models/ppyolov2_r50vd_dcn_365e_coco.pdparams
)
|
[
下载链接
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_365e_coco.tar
)
|
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
| - |
| PP-YOLOv2_R50vd | PACT在线量化 | 640 | -- | 17.3ms | -- | 48.1 |
[
下载链接
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_qat.pdparams
)
|
[
下载链接
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_qat.tar
)
|
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
|
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/quant/ppyolov2_r50vd_dcn_qat.yml
)
|
| PP-YOLO_R50vd | baseline | 608 | 183.3 | 17.4ms | -- | 44.8 |
[
下载链接
](
https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams
)
|
[
下载链接
](
https://paddledet.bj.bcebos.com/models/slim/ppyolo_r50vd_dcn_1x_coco.tar
)
|
[
配置文件
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
| - |
...
...
@@ -146,6 +148,7 @@ python tools/export_model.py -c configs/{MODEL.yml} --slim_config configs/slim/{
说明:
-
上述V100预测时延非量化模型均是使用TensorRT-FP32测试,量化模型均使用TensorRT-INT8测试,并且都包含NMS耗时。
-
SD855预测时延为使用PaddleLite部署,使用arm8架构并使用4线程(4 Threads)推理时延。
-
上述PP-YOLOE模型均在V100,开启TensorRT环境中测速,不包含NMS。(导出模型时指定:-o trt=True exclude_nms=True)
### 离线量化
需要准备val集,用来对离线量化模型进行校准,运行方式:
...
...
configs/slim/README_en.md
浏览文件 @
acaf1068
...
...
@@ -124,7 +124,9 @@ Description:
| Model | Compression Strategy | Input Size | Model Volume(MB) | Prediction Delay(V100) | Prediction Delay(SD855) | Box AP | Download | Download of Inference Model | Model Configuration File | Compression Algorithm Configuration File |
| ------------------------- | -------------------------- | ----------- | :--------------: | :--------------------: | :---------------------: | :-------------------: | :-----------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: |
| PP-YOLOv2_R50vd | baseline | 640 | 208.6 | 19.1ms | -- | 49.1 |
[
link
](
https://paddledet.bj.bcebos.com/models/ppyolov2_r50vd_dcn_365e_coco.pdparams
)
|
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_365e_coco.tar
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
| - |
| PP-YOLOE-l | baseline | 640 | - | 11.2ms(trt_fp32)
|
7.7ms(trt_fp16) | -- | 50.9 |
[
link
](
https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
)
| - |
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml
)
| - |
| PP-YOLOE-l | Common Online quantitative | 640 | - | 6.7ms(trt_int8) | -- | 48.8 |
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyoloe_l_coco_qat.pdparams
)
| - |
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyoloe/ppyoloe_crn_l_300e_coco.yml
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/quant/ppyoloe_l_qat.yml
)
|
| PP-YOLOv2_R50vd | baseline | 640 | 208.6 | 19.1ms | -- | 49.1 |
[
link
](
https://paddledet.bj.bcebos.com/models/ppyolov2_r50vd_dcn_365e_coco.pdparams
)
|
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_365e_coco.tar
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
| - |
| PP-YOLOv2_R50vd | PACT Online quantitative | 640 | -- | 17.3ms | -- | 48.1 |
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_qat.pdparams
)
|
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolov2_r50vd_dcn_qat.tar
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/quant/ppyolov2_r50vd_dcn_qat.yml
)
|
| PP-YOLO_R50vd | baseline | 608 | 183.3 | 17.4ms | -- | 44.8 |
[
link
](
https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams
)
|
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolo_r50vd_dcn_1x_coco.tar
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
| - |
| PP-YOLO_R50vd | PACT Online quantitative | 608 | 67.3 | 13.8ms | -- | 44.3 |
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolo_r50vd_qat_pact.pdparams
)
|
[
link
](
https://paddledet.bj.bcebos.com/models/slim/ppyolo_r50vd_qat_pact.tar
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml
)
|
[
Configuration File
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/quant/ppyolo_r50vd_qat_pact.yml
)
|
...
...
configs/slim/quant/ppyoloe_l_qat.yml
0 → 100644
浏览文件 @
acaf1068
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
slim
:
QAT
QAT
:
quant_config
:
{
'
weight_quantize_type'
:
'
channel_wise_abs_max'
,
'
activation_quantize_type'
:
'
moving_average_abs_max'
,
'
weight_bits'
:
8
,
'
activation_bits'
:
8
,
'
dtype'
:
'
int8'
,
'
window_size'
:
10000
,
'
moving_rate'
:
0.9
,
'
quantizable_layer_type'
:
[
'
Conv2D'
,
'
Linear'
]}
print_model
:
True
epoch
:
30
snapshot_epoch
:
5
LearningRate
:
base_lr
:
0.001
schedulers
:
-
!PiecewiseDecay
gamma
:
0.1
milestones
:
-
10
-
20
-
!LinearWarmup
start_factor
:
0.
steps
:
100
TrainReader
:
batch_size
:
8
ppdet/engine/trainer.py
浏览文件 @
acaf1068
...
...
@@ -701,6 +701,7 @@ class Trainer(object):
if
hasattr
(
self
.
model
,
'deploy'
):
self
.
model
.
deploy
=
True
if
'slim'
not
in
self
.
cfg
:
for
layer
in
self
.
model
.
sublayers
():
if
hasattr
(
layer
,
'convert_to_deploy'
):
layer
.
convert_to_deploy
()
...
...
ppdet/modeling/heads/ppyoloe_head.py
浏览文件 @
acaf1068
...
...
@@ -111,6 +111,7 @@ class PPYOLOEHead(nn.Layer):
in_c
,
4
*
(
self
.
reg_max
+
1
),
3
,
padding
=
1
))
# projection conv
self
.
proj_conv
=
nn
.
Conv2D
(
self
.
reg_max
+
1
,
1
,
1
,
bias_attr
=
False
)
self
.
proj_conv
.
skip_quant
=
True
self
.
_init_weights
()
@
classmethod
...
...
ppdet/slim/quant.py
浏览文件 @
acaf1068
...
...
@@ -38,6 +38,11 @@ class QAT(object):
logger
.
info
(
"Model before quant:"
)
logger
.
info
(
model
)
# For PP-YOLOE, convert model to deploy firstly.
for
layer
in
model
.
sublayers
():
if
hasattr
(
layer
,
'convert_to_deploy'
):
layer
.
convert_to_deploy
()
self
.
quanter
.
quantize
(
model
)
if
self
.
print_model
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录