Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
ac3b6f85
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看板
未验证
提交
ac3b6f85
编写于
1月 17, 2023
作者:
G
Guanghua Yu
提交者:
GitHub
1月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add YOLOv8 ACT demo (#7624)
上级
1e62f011
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
125 addition
and
45 deletion
+125
-45
deploy/auto_compression/README.md
deploy/auto_compression/README.md
+37
-16
deploy/auto_compression/configs/picodet_s_qat_dis.yaml
deploy/auto_compression/configs/picodet_s_qat_dis.yaml
+2
-2
deploy/auto_compression/configs/ppyoloe_l_qat_dis.yaml
deploy/auto_compression/configs/ppyoloe_l_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/ppyoloe_plus_l_qat_dis.yaml
deploy/auto_compression/configs/ppyoloe_plus_l_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/ppyoloe_plus_m_qat_dis.yaml
deploy/auto_compression/configs/ppyoloe_plus_m_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/ppyoloe_plus_s_qat_dis.yaml
deploy/auto_compression/configs/ppyoloe_plus_s_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/ppyoloe_plus_x_qat_dis.yaml
deploy/auto_compression/configs/ppyoloe_plus_x_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/yolov5_s_qat_dis.yml
deploy/auto_compression/configs/yolov5_s_qat_dis.yml
+2
-3
deploy/auto_compression/configs/yolov6mt_s_qat_dis.yaml
deploy/auto_compression/configs/yolov6mt_s_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/yolov7_l_qat_dis.yaml
deploy/auto_compression/configs/yolov7_l_qat_dis.yaml
+2
-3
deploy/auto_compression/configs/yolov8_reader.yml
deploy/auto_compression/configs/yolov8_reader.yml
+27
-0
deploy/auto_compression/configs/yolov8_s_qat_dis.yaml
deploy/auto_compression/configs/yolov8_s_qat_dis.yaml
+32
-0
deploy/auto_compression/run.py
deploy/auto_compression/run.py
+11
-3
未找到文件。
deploy/auto_compression/README.md
浏览文件 @
ac3b6f85
...
@@ -17,43 +17,52 @@
...
@@ -17,43 +17,52 @@
## 2.Benchmark
## 2.Benchmark
### PP-YOLOE
### PP-YOLOE
+
| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 |
| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 |
| :-------- |:-------- |:--------: | :---------------------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| :-------- |:-------- |:--------: | :---------------------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| PP-YOLOE-l | 50.9 | - | 50.6 | 11.2ms | 7.7ms |
**6.7ms**
|
[
config
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/deploy/auto_compression/configs/ppyoloe_l_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/ppyoloe_crn_l_300e_coco_quant.tar
)
|
| PP-YOLOE+_s | 43.7 | - | 42.9 | - | - | - |
[
config
](
./configs/ppyoloe_plus_s_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_s_qat_dis.tar
)
|
| PP-YOLOE+_m | 49.8 | - | 49.3 | - | - | - |
[
config
](
./configs/ppyoloe_plus_m_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_m_qat_dis.tar
)
|
| PP-YOLOE+_l | 52.9 | - | 52.6 | - | - | - |
[
config
](
./configs/ppyoloe_plus_l_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_l_qat_dis.tar
)
|
| PP-YOLOE+_x | 54.7 | - | 54.4 | - | - | - |
[
config
](
./configs/ppyoloe_plus_x_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_x_qat_dis.tar
)
|
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
-
PP-YOLOE-l模型在Tesla V100的GPU环境下测试,并且开启TensorRT,batch_size=1,包含NMS,测试脚本是
[
benchmark demo
](
https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.4/deploy/python
)
。
###
PP-PicoDet
###
YOLOv8
| 模型 | 策略 | mAP | FP32 | FP16 | INT8 | 配置文件 | 模型 |
| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 |
| :-------- |:-------- |:--------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| :-------- |:-------- |:--------: | :---------------------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| PicoDet-S-NPU | Baseline | 30.1 | - | - | - |
[
config
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/picodet/picodet_s_416_coco_npu.yml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/picodet_s_416_coco_npu.tar
)
|
| YOLOv8-s | 44.9 | 43.9 | 44.3 | 9.27ms | 4.65ms |
**3.78ms**
|
[
config
](
https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/yolov8_s_qat_dis.yaml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/yolov8_s_500e_coco_trt_nms_quant.tar
)
|
| PicoDet-S-NPU | 量化训练 | 29.7 | - | - | - |
[
config
](
https://github.com/PaddlePaddle/PaddleSlim/tree/develop/demo/full_quantization/detection/configs/picodet_s_qat_dis.yaml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/picodet_s_npu_quant.tar
)
|
**注意:**
-
表格中YOLOv8模型均为带NMS的模型,可直接在TRT中部署,如果需要对齐测试标准,需要测试不带NMS的模型。
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
-
表格中的性能在Tesla T4的GPU环境下测试,并且开启TensorRT,batch_size=1。
### PP-YOLOE
+
### PP-YOLOE
| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 |
| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 |
| :-------- |:-------- |:--------: | :---------------------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| :-------- |:-------- |:--------: | :---------------------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| PP-YOLOE+_s | 43.7 | - | 42.9 | - | - | - |
[
config
](
./configs/ppyoloe_plus_s_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_s_qat_dis.tar
)
|
| PP-YOLOE-l | 50.9 | - | 50.6 | 11.2ms | 7.7ms |
**6.7ms**
|
[
config
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/deploy/auto_compression/configs/ppyoloe_l_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/ppyoloe_crn_l_300e_coco_quant.tar
)
|
| PP-YOLOE+_m | 49.8 | - | 49.3 | - | - | - |
[
config
](
./configs/ppyoloe_plus_m_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_m_qat_dis.tar
)
|
| PP-YOLOE+_l | 52.9 | - | 52.6 | - | - | - |
[
config
](
./configs/ppyoloe_plus_l_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_l_qat_dis.tar
)
|
| PP-YOLOE+_x | 54.7 | - | 54.4 | - | - | - |
[
config
](
./configs/ppyoloe_plus_x_qat_dis.yaml
)
|
[
Quant Model
](
https://bj.bcebos.com/v1/paddledet/deploy/Inference/ppyoloe_plus_x_qat_dis.tar
)
|
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
-
PP-YOLOE-l模型在Tesla V100的GPU环境下测试,并且开启TensorRT,batch_size=1,包含NMS,测试脚本是
[
benchmark demo
](
https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.4/deploy/python
)
。
### PP-PicoDet
| 模型 | 策略 | mAP | FP32 | FP16 | INT8 | 配置文件 | 模型 |
| :-------- |:-------- |:--------: | :----------------: | :----------------: | :---------------: | :----------------------: | :---------------------: |
| PicoDet-S-NPU | Baseline | 30.1 | - | - | - |
[
config
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/picodet/picodet_s_416_coco_npu.yml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/picodet_s_416_coco_npu.tar
)
|
| PicoDet-S-NPU | 量化训练 | 29.7 | - | - | - |
[
config
](
https://github.com/PaddlePaddle/PaddleSlim/tree/develop/demo/full_quantization/detection/configs/picodet_s_qat_dis.yaml
)
|
[
Model
](
https://bj.bcebos.com/v1/paddle-slim-models/act/picodet_s_npu_quant.tar
)
|
-
mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。
## 3. 自动压缩流程
## 3. 自动压缩流程
#### 3.1 准备环境
#### 3.1 准备环境
-
PaddlePaddle >= 2.
3
(可从
[
Paddle官网
](
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html
)
下载安装)
-
PaddlePaddle >= 2.
4
(可从
[
Paddle官网
](
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html
)
下载安装)
-
PaddleSlim >= 2.
3
-
PaddleSlim >= 2.
4.1
-
PaddleDet >= 2.
4
-
PaddleDet >= 2.
5
-
opencv-python
-
opencv-python
安装paddlepaddle:
安装paddlepaddle:
...
@@ -74,6 +83,8 @@ pip install paddleslim
...
@@ -74,6 +83,8 @@ pip install paddleslim
pip
install
paddledet
pip
install
paddledet
```
```
**注意:**
YOLOv8模型的自动化压缩需要依赖安装最新
[
Develop Paddle
](
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html
)
和
[
Develop PaddleSlim
](
https://github.com/PaddlePaddle/PaddleSlim#%E5%AE%89%E8%A3%85
)
版本。
#### 3.2 准备数据集
#### 3.2 准备数据集
本案例默认以COCO数据进行自动压缩实验,如果自定义COCO数据,或者其他格式数据,请参考
[
数据准备文档
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/docs/tutorials/data/PrepareDataSet.md
)
来准备数据。
本案例默认以COCO数据进行自动压缩实验,如果自定义COCO数据,或者其他格式数据,请参考
[
数据准备文档
](
https://github.com/PaddlePaddle/PaddleDetection/tree/develop/docs/tutorials/data/PrepareDataSet.md
)
来准备数据。
...
@@ -102,6 +113,16 @@ python tools/export_model.py \
...
@@ -102,6 +113,16 @@ python tools/export_model.py \
trt
=
True
\
trt
=
True
\
```
```
YOLOv8-s模型,包含NMS,具体可参考
[
YOLOv8模型文档
](
https://github.com/PaddlePaddle/PaddleYOLO/tree/release/2.5/configs/yolov8
)
, 然后执行:
```
shell
python tools/export_model.py
\
-c
configs/yolov8/yolov8_s_500e_coco.yml
\
-o
weights
=
https://paddledet.bj.bcebos.com/models/yolov8_s_500e_coco.pdparams
\
trt
=
True
```
如快速体验,可直接下载
[
YOLOv8-s导出模型
](
https://bj.bcebos.com/v1/paddle-slim-models/act/yolov8_s_500e_coco_trt_nms.tar
)
#### 3.4 自动压缩并产出模型
#### 3.4 自动压缩并产出模型
蒸馏量化自动压缩示例通过run.py脚本启动,会使用接口
```paddleslim.auto_compression.AutoCompression```
对模型进行自动压缩。配置config文件中模型路径、蒸馏、量化、和训练等部分的参数,配置完成后便可对模型进行量化和蒸馏。具体运行命令为:
蒸馏量化自动压缩示例通过run.py脚本启动,会使用接口
```paddleslim.auto_compression.AutoCompression```
对模型进行自动压缩。配置config文件中模型路径、蒸馏、量化、和训练等部分的参数,配置完成后便可对模型进行量化和蒸馏。具体运行命令为:
...
...
deploy/auto_compression/configs/picodet_s_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
./configs/picodet_reader.yml
reader_config
:
./configs/picodet_reader.yml
in
put_list
:
[
'
image'
,
'
scale_factor'
]
in
clude_nms
:
True
Evaluation
:
True
Evaluation
:
True
model_dir
:
./picodet_s_416_coco_npu/
model_dir
:
./picodet_s_416_coco_npu/
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
l2
loss
:
l2
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
weight_bits
:
8
weight_bits
:
8
...
...
deploy/auto_compression/configs/ppyoloe_l_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/ppyoloe_reader.yml
reader_config
:
configs/ppyoloe_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./ppyoloe_crn_l_300e_coco
model_dir
:
./ppyoloe_crn_l_300e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
deploy/auto_compression/configs/ppyoloe_plus_l_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/ppyoloe_plus_reader.yml
reader_config
:
configs/ppyoloe_plus_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./ppyoloe_plus_crn_l_80e_coco
model_dir
:
./ppyoloe_plus_crn_l_80e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
deploy/auto_compression/configs/ppyoloe_plus_m_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/ppyoloe_plus_reader.yml
reader_config
:
configs/ppyoloe_plus_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./ppyoloe_plus_crn_m_80e_coco
model_dir
:
./ppyoloe_plus_crn_m_80e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
deploy/auto_compression/configs/ppyoloe_plus_s_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/ppyoloe_plus_reader.yml
reader_config
:
configs/ppyoloe_plus_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./ppyoloe_plus_crn_s_80e_coco
model_dir
:
./ppyoloe_plus_crn_s_80e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
deploy/auto_compression/configs/ppyoloe_plus_x_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/ppyoloe_plus_reader.yml
reader_config
:
configs/ppyoloe_plus_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./ppyoloe_plus_crn_x_80e_coco
model_dir
:
./ppyoloe_plus_crn_x_80e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
deploy/auto_compression/configs/yolov5_s_qat_dis.yml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/yolov5_reader.yml
reader_config
:
configs/yolov5_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./yolov5_s_300e_coco
model_dir
:
./yolov5_s_300e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
deploy/auto_compression/configs/yolov6mt_s_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/yolov5_reader.yml
reader_config
:
configs/yolov5_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./yolov6mt_s_400e_coco
model_dir
:
./yolov6mt_s_400e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
deploy/auto_compression/configs/yolov7_l_qat_dis.yaml
浏览文件 @
ac3b6f85
Global
:
Global
:
reader_config
:
configs/yolov5_reader.yml
reader_config
:
configs/yolov5_reader.yml
input_list
:
[
'
image'
,
'
scale_factor'
]
include_nms
:
True
arch
:
YOLO
Evaluation
:
True
Evaluation
:
True
model_dir
:
./yolov7_l_300e_coco
model_dir
:
./yolov7_l_300e_coco
model_filename
:
model.pdmodel
model_filename
:
model.pdmodel
...
@@ -12,7 +11,7 @@ Distillation:
...
@@ -12,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
deploy/auto_compression/configs/yolov8_reader.yml
0 → 100644
浏览文件 @
ac3b6f85
metric
:
COCO
num_classes
:
80
# Dataset configuration
TrainDataset
:
!COCODataSet
image_dir
:
train2017
anno_path
:
annotations/instances_train2017.json
dataset_dir
:
dataset/coco/
EvalDataset
:
!COCODataSet
image_dir
:
val2017
anno_path
:
annotations/instances_val2017.json
dataset_dir
:
dataset/coco/
worker_num
:
0
# preprocess reader in test
EvalReader
:
sample_transforms
:
-
Decode
:
{}
-
Resize
:
{
target_size
:
[
640
,
640
],
keep_ratio
:
True
,
interp
:
1
}
-
Pad
:
{
size
:
[
640
,
640
],
fill_value
:
[
114.
,
114.
,
114.
]}
-
NormalizeImage
:
{
mean
:
[
0.
,
0.
,
0.
],
std
:
[
1.
,
1.
,
1.
],
norm_type
:
none
}
-
Permute
:
{}
batch_size
:
4
deploy/auto_compression/configs/yolov8_s_qat_dis.yaml
0 → 100644
浏览文件 @
ac3b6f85
Global
:
reader_config
:
configs/yolov8_reader.yml
include_nms
:
True
Evaluation
:
True
model_dir
:
./yolov8_s_500e_coco_trt_nms/
model_filename
:
model.pdmodel
params_filename
:
model.pdiparams
Distillation
:
alpha
:
1.0
loss
:
soft_label
QuantAware
:
onnx_format
:
true
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
-
conv2d
-
depthwise_conv2d
TrainConfig
:
train_iter
:
8000
eval_iter
:
1000
learning_rate
:
type
:
CosineAnnealingDecay
learning_rate
:
0.00003
T_max
:
10000
optimizer_builder
:
optimizer
:
type
:
SGD
weight_decay
:
4.0e-05
deploy/auto_compression/run.py
浏览文件 @
ac3b6f85
...
@@ -23,6 +23,7 @@ from ppdet.metrics import COCOMetric, VOCMetric, KeyPointTopDownCOCOEval
...
@@ -23,6 +23,7 @@ from ppdet.metrics import COCOMetric, VOCMetric, KeyPointTopDownCOCOEval
from
paddleslim.auto_compression.config_helpers
import
load_config
as
load_slim_config
from
paddleslim.auto_compression.config_helpers
import
load_config
as
load_slim_config
from
paddleslim.auto_compression
import
AutoCompression
from
paddleslim.auto_compression
import
AutoCompression
from
post_process
import
PPYOLOEPostProcess
from
post_process
import
PPYOLOEPostProcess
from
paddleslim.common.dataloader
import
get_feed_vars
def
argsparser
():
def
argsparser
():
...
@@ -94,9 +95,12 @@ def eval_function(exe, compiled_test_program, test_feed_names, test_fetch_list):
...
@@ -94,9 +95,12 @@ def eval_function(exe, compiled_test_program, test_feed_names, test_fetch_list):
fetch_list
=
test_fetch_list
,
fetch_list
=
test_fetch_list
,
return_numpy
=
False
)
return_numpy
=
False
)
res
=
{}
res
=
{}
if
'arch'
in
global_config
and
global_config
[
'arch'
]
==
'PPYOLOE'
:
if
'include_nms'
in
global_config
and
not
global_config
[
'include_nms'
]:
postprocess
=
PPYOLOEPostProcess
(
if
'arch'
in
global_config
and
global_config
[
'arch'
]
==
'PPYOLOE'
:
score_threshold
=
0.01
,
nms_threshold
=
0.6
)
postprocess
=
PPYOLOEPostProcess
(
score_threshold
=
0.01
,
nms_threshold
=
0.6
)
else
:
assert
"Not support arch={} now."
.
format
(
global_config
[
'arch'
])
res
=
postprocess
(
np
.
array
(
outs
[
0
]),
data_all
[
'scale_factor'
])
res
=
postprocess
(
np
.
array
(
outs
[
0
]),
data_all
[
'scale_factor'
])
else
:
else
:
for
out
in
outs
:
for
out
in
outs
:
...
@@ -128,6 +132,10 @@ def main():
...
@@ -128,6 +132,10 @@ def main():
train_loader
=
create
(
'EvalReader'
)(
reader_cfg
[
'TrainDataset'
],
train_loader
=
create
(
'EvalReader'
)(
reader_cfg
[
'TrainDataset'
],
reader_cfg
[
'worker_num'
],
reader_cfg
[
'worker_num'
],
return_list
=
True
)
return_list
=
True
)
if
global_config
.
get
(
'input_list'
)
is
None
:
global_config
[
'input_list'
]
=
get_feed_vars
(
global_config
[
'model_dir'
],
global_config
[
'model_filename'
],
global_config
[
'params_filename'
])
train_loader
=
reader_wrapper
(
train_loader
,
global_config
[
'input_list'
])
train_loader
=
reader_wrapper
(
train_loader
,
global_config
[
'input_list'
])
if
'Evaluation'
in
global_config
.
keys
()
and
global_config
[
if
'Evaluation'
in
global_config
.
keys
()
and
global_config
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录