diff --git a/example/auto_compression/detection/README.md b/example/auto_compression/detection/README.md index 4261fe7076578c82d4c435377e1e44636523ad88..c817cb64f0d6107c710b60b16a2928ce114eebbc 100644 --- a/example/auto_compression/detection/README.md +++ b/example/auto_compression/detection/README.md @@ -44,6 +44,29 @@ | :-------- |:-------- | :---------------------: | :----------------: | :---------------: | :----------------------: | :---------------------: | | SSD-MobileNetv1 | 73.8 | 73.52 | 4.0ms | 1.7ms | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/ssd_mbv1_voc_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/ssd_mobilenet_v1_quant.tar) | - 测速环境:Tesla T4,TensorRT 8.4.1,CUDA 11.2,batch_size=1,包含NMS. + +### RT-DETR + +| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 | +| :---------------- | :------- | :---------: | :--------: | :------: | :------: | :--------: | :----------------------------------------------------------: | :----------------------------------------------------------: | +| RT-DETR-R50 | 53.1 | 52.9 | 53.0 | 32.05ms | 9.12ms | **6.96ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_r50vd_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_r50vd_6x_coco_quant.tar) | +| RT-DETR-R101 | 54.3 | - | 54.1 | 54.13ms | 12.68ms | **9.20ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_r101vd_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_r101vd_6x_coco_quant.tar) | +| RT-DETR-HGNetv2-L | 53.0 | - | 52.9 | 26.16ms | 8.54ms | **6.65ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_hgnetv2_l_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_hgnetv2_l_6x_coco_quant.tar) | +| RT-DETR-HGNetv2-X | 54.8 | - | 54.6 | 49.22ms | 12.50ms | **9.24ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_hgnetv2_x_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_hgnetv2_x_6x_coco_quant.tar) | + +- 上表测试环境:Tesla T4,TensorRT 8.6.0,CUDA 11.7,batch_size=1。 + +| 模型 | Base mAP | 离线量化mAP | ACT量化mAP | TRT-FP32 | TRT-FP16 | TRT-INT8 | 配置文件 | 量化模型 | +| :---------------- | :------- | :---------: | :--------: | :------: | :------: | :--------: | :----------------------------------------------------------: | :----------------------------------------------------------: | +| RT-DETR-R50 | 53.1 | 52.9 | 53.0 | 9.64ms | 5.00ms | **3.99ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_r50vd_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_r50vd_6x_coco_quant.tar) | +| RT-DETR-R101 | 54.3 | - | 54.1 | 14.93ms | 7.15ms | **5.12ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_r101vd_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_r101vd_6x_coco_quant.tar) | +| RT-DETR-HGNetv2-L | 53.0 | - | 52.9 | 8.17ms | 4.77ms | **4.00ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_hgnetv2_l_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_hgnetv2_l_6x_coco_quant.tar) | +| RT-DETR-HGNetv2-X | 54.8 | - | 54.6 | 12.81ms | 6.97ms | **5.32ms** | [config](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/example/auto_compression/detection/configs/rtdetr_hgnetv2_x_qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/rtdetr_hgnetv2_x_6x_coco_quant.tar) | + +- 上表测试环境:A10,TensorRT 8.6.0,CUDA 11.6,batch_size=1。 +- mAP的指标均在COCO val2017数据集中评测得到,IoU=0.5:0.95。 +- 两个表中的离线量化只量化模型中的conv2d,ACT量化模型中的conv2d和matmul。 + ## 3. 自动压缩流程 #### 3.1 准备环境 diff --git a/example/auto_compression/detection/configs/rtdetr_hgnetv2_l_qat_dis.yaml b/example/auto_compression/detection/configs/rtdetr_hgnetv2_l_qat_dis.yaml new file mode 100644 index 0000000000000000000000000000000000000000..83ebd78b1a343c3401830076ab90157a83947026 --- /dev/null +++ b/example/auto_compression/detection/configs/rtdetr_hgnetv2_l_qat_dis.yaml @@ -0,0 +1,32 @@ + +Global: + reader_config: configs/rtdetr_reader.yml + include_nms: True + Evaluation: True + model_dir: ./rtdetr_hgnetv2_l_6x_coco/ + 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 + - matmul_v2 + +TrainConfig: + train_iter: 200 + eval_iter: 50 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.00003 + T_max: 10000 + optimizer_builder: + optimizer: + type: SGD + weight_decay: 4.0e-05 diff --git a/example/auto_compression/detection/configs/rtdetr_hgnetv2_x_qat_dis.yaml b/example/auto_compression/detection/configs/rtdetr_hgnetv2_x_qat_dis.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c4e2889bbd3c69e758199f99b6fd517d227799d0 --- /dev/null +++ b/example/auto_compression/detection/configs/rtdetr_hgnetv2_x_qat_dis.yaml @@ -0,0 +1,32 @@ + +Global: + reader_config: configs/rtdetr_reader.yml + include_nms: True + Evaluation: True + model_dir: ./rtdetr_r50vd_6x_coco/ + 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 + - matmul_v2 + +TrainConfig: + train_iter: 500 + eval_iter: 100 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.00003 + T_max: 10000 + optimizer_builder: + optimizer: + type: SGD + weight_decay: 4.0e-05 diff --git a/example/auto_compression/detection/configs/rtdetr_r101vd_qat_dis.yaml b/example/auto_compression/detection/configs/rtdetr_r101vd_qat_dis.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bd96d085e8a01cabba890f2602e9619855bf9d5a --- /dev/null +++ b/example/auto_compression/detection/configs/rtdetr_r101vd_qat_dis.yaml @@ -0,0 +1,32 @@ + +Global: + reader_config: configs/rtdetr_reader.yml + include_nms: True + Evaluation: True + model_dir: ./rtdetr_hgnetv2_x_6x_coco/ + 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 + - matmul_v2 + +TrainConfig: + train_iter: 200 + eval_iter: 50 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.00003 + T_max: 10000 + optimizer_builder: + optimizer: + type: SGD + weight_decay: 4.0e-05 diff --git a/example/auto_compression/detection/configs/rtdetr_r50vd_qat_dis.yaml b/example/auto_compression/detection/configs/rtdetr_r50vd_qat_dis.yaml index 48a038569204b98817e7fd40c43307ff54fe40e2..c4e2889bbd3c69e758199f99b6fd517d227799d0 100644 --- a/example/auto_compression/detection/configs/rtdetr_r50vd_qat_dis.yaml +++ b/example/auto_compression/detection/configs/rtdetr_r50vd_qat_dis.yaml @@ -17,10 +17,11 @@ QuantAware: quantize_op_types: - conv2d - depthwise_conv2d + - matmul_v2 TrainConfig: - train_iter: 10 - eval_iter: 10 + train_iter: 500 + eval_iter: 100 learning_rate: type: CosineAnnealingDecay learning_rate: 0.00003