未验证 提交 573d7314 编写于 作者: G Guanghua Yu 提交者: GitHub

add picodet quant model (#5617)

上级 ac528aaf
......@@ -220,9 +220,10 @@ paddle2onnx --model_dir output_inference/picodet_s_320_coco_lcnet/ \
### 部署
- PaddleInference demo [Python](../../deploy/python) & [C++](../../deploy/cpp)
- OpenVINO demo [Python](../../deploy/third_engine/demo/openvino/python)
- [PaddleLite C++ demo](../../deploy/lite)
- [Android demo(Paddle Lite)](https://github.com/PaddlePaddle/Paddle-Lite-Demo/tree/develop/object_detection/android/app/cxx/picodet_detection_demo)
- PaddleInference demo [Python](../../deploy/python) & [C++](../../deploy/cpp)
Android demo可视化:
......@@ -237,43 +238,35 @@ Android demo可视化:
<summary>依赖包:</summary>
- PaddlePaddle >= 2.2.2
- PaddleSlim >= 2.2.1
- PaddleSlim >= 2.2.2
**安装:**
```shell
pip install paddleslim==2.2.1
pip install paddleslim==2.2.2
```
</details>
<details>
<summary>量化训练 (点击展开)</summary>
<details open>
<summary>量化训练</summary>
开始量化训练:
```shell
python tools/train.py -c configs/picodet/picodet_s_320_coco_lcnet.yml \
--slim_config configs/slim/quant/picodet_s_quant.yml --eval
python tools/train.py -c configs/picodet/picodet_s_416_coco_lcnet.yml \
--slim_config configs/slim/quant/picodet_s_416_lcnet_quant.yml --eval
```
- 更多细节请参考[slim文档](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim)
</details>
<details>
<summary>离线量化 (点击展开)</summary>
校准及导出量化模型:
- 量化训练Model ZOO:
```shell
python tools/post_quant.py -c configs/picodet/picodet_s_320_coco_lcnet.yml \
--slim_config configs/slim/post_quant/picodet_s_ptq.yml
```
- 注意: 离线量化模型精度问题正在解决中.
</details>
| 量化模型 | 输入尺寸 | mAP<sup>val<br>0.5:0.95 | Configs | Weight | Inference Model | Paddle Lite(INT8) |
| :-------- | :--------: | :--------------------: | :-------: | :----------------: | :----------------: | :----------------: |
| PicoDet-S | 416*416 | 31.5 | [config](./picodet_s_416_coco_lcnet.yml) &#124; [slim config](../slim/quant/picodet_s_416_lcnet_quant.yml) | [model](https://paddledet.bj.bcebos.com/models/picodet_s_416_coco_lcnet_quant.pdparams) | [w/ 后处理](https://paddledet.bj.bcebos.com/deploy/Inference/picodet_s_416_coco_lcnet_quant.tar) &#124; [w/o 后处理](https://paddledet.bj.bcebos.com/deploy/Inference/picodet_s_416_coco_lcnet_quant_non_postprocess.tar) | [w/ 后处理](https://paddledet.bj.bcebos.com/deploy/paddlelite/picodet_s_416_coco_lcnet_quant.nb) &#124; [w/o 后处理](https://paddledet.bj.bcebos.com/deploy/paddlelite/picodet_s_416_coco_lcnet_quant_non_postprocess.nb) |
## 非结构化剪枝
......
......@@ -216,9 +216,10 @@ paddle2onnx --model_dir output_inference/picodet_s_320_coco_lcnet/ \
### Deploy
- PaddleInference demo [Python](../../deploy/python) & [C++](../../deploy/cpp)
- OpenVINO demo [Python](../../deploy/third_engine/demo/openvino/python)
- [PaddleLite C++ demo](../../deploy/lite)
- [Android demo(Paddle Lite)](https://github.com/PaddlePaddle/Paddle-Lite-Demo/tree/develop/object_detection/android/app/cxx/picodet_detection_demo)
- PaddleInference demo [Python](../../deploy/python) & [C++](../../deploy/cpp)
Android demo visualization:
......@@ -233,43 +234,35 @@ Android demo visualization:
<summary>Requirements:</summary>
- PaddlePaddle >= 2.2.2
- PaddleSlim >= 2.2.1
- PaddleSlim >= 2.2.2
**Install:**
```shell
pip install paddleslim==2.2.1
pip install paddleslim==2.2.2
```
</details>
<details>
<summary>Quant aware (click to expand)</summary>
<details open>
<summary>Quant aware</summary>
Configure the quant config and start training:
```shell
python tools/train.py -c configs/picodet/picodet_s_320_coco_lcnet.yml \
--slim_config configs/slim/quant/picodet_s_quant.yml --eval
python tools/train.py -c configs/picodet/picodet_s_416_coco_lcnet.yml \
--slim_config configs/slim/quant/picodet_s_416_lcnet_quant.yml --eval
```
- More detail can refer to [slim document](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim)
</details>
<details>
<summary>Post quant (click to expand)</summary>
Configure the post quant config and start calibrate model:
- Quant Aware Model ZOO:
```shell
python tools/post_quant.py -c configs/picodet/picodet_s_320_coco_lcnet.yml \
--slim_config configs/slim/post_quant/picodet_s_ptq.yml
```
- Notes: Now the accuracy of post quant is abnormal and this problem is being solved.
</details>
| Quant Model | Input size | mAP<sup>val<br>0.5:0.95 | Configs | Weight | Inference Model | Paddle Lite(INT8) |
| :-------- | :--------: | :--------------------: | :-------: | :----------------: | :----------------: | :----------------: |
| PicoDet-S | 416*416 | 31.5 | [config](./picodet_s_416_coco_lcnet.yml) &#124; [slim config](../slim/quant/picodet_s_416_lcnet_quant.yml) | [model](https://paddledet.bj.bcebos.com/models/picodet_s_416_coco_lcnet_quant.pdparams) | [w/ postprocess](https://paddledet.bj.bcebos.com/deploy/Inference/picodet_s_416_coco_lcnet_quant.tar) &#124; [w/o postprocess](https://paddledet.bj.bcebos.com/deploy/Inference/picodet_s_416_coco_lcnet_quant_non_postprocess.tar) | [w/ postprocess](https://paddledet.bj.bcebos.com/deploy/paddlelite/picodet_s_416_coco_lcnet_quant.nb) &#124; [w/o postprocess](https://paddledet.bj.bcebos.com/deploy/paddlelite/picodet_s_416_coco_lcnet_quant_non_postprocess.nb) |
## Unstructured Pruning
......
pretrain_weights: https://paddledet.bj.bcebos.com/models/picodet_s_416_coco_lcnet.pdparams
slim: QAT
QAT:
quant_config: {
'activation_preprocess_type': 'PACT',
'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: False
TrainReader:
batch_size: 48
LearningRate:
base_lr: 0.024
schedulers:
- !CosineDecay
max_epochs: 300
- !LinearWarmup
start_factor: 0.1
steps: 300
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册