diff --git a/examples/vision/detection/yolov6/quantize/cpp/README.md b/examples/vision/detection/yolov6/quantize/cpp/README.md index 7ad762100..a929f8ced 100755 --- a/examples/vision/detection/yolov6/quantize/cpp/README.md +++ b/examples/vision/detection/yolov6/quantize/cpp/README.md @@ -23,7 +23,7 @@ cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-x.x.x make -j #下载FastDeloy提供的yolov6s量化模型文件和测试图片 -wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov6s_qat_model.tar +wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov6s_qat_model_new.tar tar -xvf yolov6s_qat_model.tar wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg diff --git a/examples/vision/detection/yolov6/quantize/python/README.md b/examples/vision/detection/yolov6/quantize/python/README.md index 057e13f9a..e9b80bb6f 100755 --- a/examples/vision/detection/yolov6/quantize/python/README.md +++ b/examples/vision/detection/yolov6/quantize/python/README.md @@ -17,7 +17,7 @@ git clone https://github.com/PaddlePaddle/FastDeploy.git cd examples/slim/yolov6/python #下载FastDeloy提供的yolov6s量化模型文件和测试图片 -wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov6s_qat_model.tar +wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov6s_qat_model_new.tar tar -xvf yolov6s_qat_model.tar wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg diff --git a/tools/common_tools/auto_compression/README.md b/tools/common_tools/auto_compression/README.md index 7c1b3feac..ed0717a42 100644 --- a/tools/common_tools/auto_compression/README.md +++ b/tools/common_tools/auto_compression/README.md @@ -99,6 +99,11 @@ FastDeploy目前为用户提供了多个模型的压缩[config](./configs/)文 | -------------------- | ------------------------------------------------------------ |----------------------------------------- | | [mobilenetv1_ssld_quant](./configs/classification/mobilenetv1_ssld_quant.yaml) | [mobilenetv1_ssld](https://bj.bcebos.com/paddlehub/fastdeploy/MobileNetV1_ssld_infer.tgz) | | | [resnet50_vd_quant](./configs/classification/resnet50_vd_quant.yaml) | [resnet50_vd](https://bj.bcebos.com/paddlehub/fastdeploy/ResNet50_vd_infer.tgz) | | +| [efficientnetb0_quant](./configs/classification/efficientnetb0_quant.yaml) | [efficientnetb0](https://bj.bcebos.com/paddlehub/fastdeploy/EfficientNetB0_small_infer.tgz) | | +| [mobilenetv3_large_x1_0_quant](./configs/classification/mobilenetv3_large_x1_0_quant.yaml) | [mobilenetv3_large_x1_0](https://bj.bcebos.com/paddlehub/fastdeploy/MobileNetV3_large_x1_0_ssld_infer.tgz) | | +| [pphgnet_tiny_quant](./configs/classification/pphgnet_tiny_quant.yaml) | [pphgnet_tiny](https://bj.bcebos.com/paddlehub/fastdeploy/PPHGNet_tiny_ssld_infer.tgz) | | +| [pplcnetv2_base_quant](./configs/classification/pplcnetv2_base_quant.yaml) | [pplcnetv2_base](https://bj.bcebos.com/paddlehub/fastdeploy/PPLCNetV2_base_infer.tgz) | | + | [yolov5s_quant](./configs/detection/yolov5s_quant.yaml) | [yolov5s](https://paddle-slim-models.bj.bcebos.com/act/yolov5s.onnx) | | | [yolov6s_quant](./configs/detection/yolov6s_quant.yaml) | [yolov6s](https://paddle-slim-models.bj.bcebos.com/act/yolov6s.onnx) | | | [yolov7_quant](./configs/detection/yolov7_quant.yaml) | [yolov7](https://paddle-slim-models.bj.bcebos.com/act/yolov7.onnx) | | diff --git a/tools/common_tools/auto_compression/README_EN.md b/tools/common_tools/auto_compression/README_EN.md index fb1480819..c3b0cfee6 100644 --- a/tools/common_tools/auto_compression/README_EN.md +++ b/tools/common_tools/auto_compression/README_EN.md @@ -107,6 +107,10 @@ FastDeploy currently provides users with compression [config](./configs/) files | -------------------- | ------------------------------------------------------------ |----------------------------------------- | | [mobilenetv1_ssld_quant](./configs/classification/mobilenetv1_ssld_quant.yaml) | [mobilenetv1_ssld](https://bj.bcebos.com/paddlehub/fastdeploy/MobileNetV1_ssld_infer.tgz) | | | [resnet50_vd_quant](./configs/classification/resnet50_vd_quant.yaml) | [resnet50_vd](https://bj.bcebos.com/paddlehub/fastdeploy/ResNet50_vd_infer.tgz) | | +| [efficientnetb0_quant](./configs/classification/efficientnetb0_quant.yaml) | [efficientnetb0](https://bj.bcebos.com/paddlehub/fastdeploy/EfficientNetB0_small_infer.tgz) | | +| [mobilenetv3_large_x1_0_quant](./configs/classification/mobilenetv3_large_x1_0_quant.yaml) | [mobilenetv3_large_x1_0](https://bj.bcebos.com/paddlehub/fastdeploy/MobileNetV3_large_x1_0_ssld_infer.tgz) | | +| [pphgnet_tiny_quant](./configs/classification/pphgnet_tiny_quant.yaml) | [pphgnet_tiny](https://bj.bcebos.com/paddlehub/fastdeploy/PPHGNet_tiny_ssld_infer.tgz) | | +| [pplcnetv2_base_quant](./configs/classification/pplcnetv2_base_quant.yaml) | [pplcnetv2_base](https://bj.bcebos.com/paddlehub/fastdeploy/PPLCNetV2_base_infer.tgz) | | | [yolov5s_quant](./configs/detection/yolov5s_quant.yaml) | [yolov5s](https://paddle-slim-models.bj.bcebos.com/act/yolov5s.onnx) | | | [yolov6s_quant](./configs/detection/yolov6s_quant.yaml) | [yolov6s](https://paddle-slim-models.bj.bcebos.com/act/yolov6s.onnx) | | | [yolov7_quant](./configs/detection/yolov7_quant.yaml) | [yolov7](https://paddle-slim-models.bj.bcebos.com/act/yolov7.onnx) | | diff --git a/tools/common_tools/auto_compression/configs/classification/efficientnetb0_quant.yaml b/tools/common_tools/auto_compression/configs/classification/efficientnetb0_quant.yaml new file mode 100644 index 000000000..4a502445e --- /dev/null +++ b/tools/common_tools/auto_compression/configs/classification/efficientnetb0_quant.yaml @@ -0,0 +1,50 @@ +Global: + model_dir: ./EfficientNetB0_small_infer/ + format: 'paddle' + model_filename: inference.pdmodel + params_filename: inference.pdiparams + qat_image_path: ./ImageNet_val_640 + ptq_image_path: ./ImageNet_val_640 + input_list: ['inputs'] + qat_preprocess: cls_image_preprocess + ptq_preprocess: cls_image_preprocess + qat_batch_size: 32 + +Distillation: + alpha: 1.0 + loss: l2 + node: + - softmax_0.tmp_0 + +QuantAware: + use_pact: true + activation_bits: 8 + is_full_quantize: false + onnx_format: True + activation_quantize_type: moving_average_abs_max + weight_quantize_type: channel_wise_abs_max + not_quant_pattern: + - skip_quant + quantize_op_types: + - conv2d + - depthwise_conv2d + - matmul + - matmul_v2 + weight_bits: 8 + +TrainConfig: + epochs: 1 + eval_iter: 500 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.015 + T_max: 8000 + optimizer_builder: + optimizer: + type: Momentum + weight_decay: 0.00002 + origin_metric: 0.7738 + +PTQ: + calibration_method: 'avg' # option: avg, abs_max, hist, KL, mse + skip_tensor_list: None diff --git a/tools/common_tools/auto_compression/configs/classification/mobilenetv3_large_x1_0_quant.yaml b/tools/common_tools/auto_compression/configs/classification/mobilenetv3_large_x1_0_quant.yaml new file mode 100644 index 000000000..3ee6c8d3b --- /dev/null +++ b/tools/common_tools/auto_compression/configs/classification/mobilenetv3_large_x1_0_quant.yaml @@ -0,0 +1,46 @@ +Global: + model_dir: ./MobileNetV3_large_x1_0_ssld_infer/ + format: 'paddle' + model_filename: inference.pdmodel + params_filename: inference.pdiparams + qat_image_path: ./ImageNet_val_640 + ptq_image_path: ./ImageNet_val_640 + input_list: ['inputs'] + qat_preprocess: cls_image_preprocess + ptq_preprocess: cls_image_preprocess + qat_batch_size: 128 + + +Distillation: + alpha: 1.0 + loss: soft_label + +QuantAware: + use_pact: true + activation_bits: 8 + is_full_quantize: false + onnx_format: True + activation_quantize_type: moving_average_abs_max + weight_quantize_type: channel_wise_abs_max + not_quant_pattern: + - skip_quant + quantize_op_types: + - conv2d + - depthwise_conv2d + - matmul + - matmul_v2 + weight_bits: 8 + +TrainConfig: + epochs: 2 + eval_iter: 5000 + learning_rate: 0.001 + optimizer_builder: + optimizer: + type: Momentum + weight_decay: 0.00002 + origin_metric: 0.7896 + +PTQ: + calibration_method: 'avg' # option: avg, abs_max, hist, KL, mse + skip_tensor_list: None diff --git a/tools/common_tools/auto_compression/configs/classification/pphgnet_tiny_quant.yaml b/tools/common_tools/auto_compression/configs/classification/pphgnet_tiny_quant.yaml new file mode 100644 index 000000000..b282d6dde --- /dev/null +++ b/tools/common_tools/auto_compression/configs/classification/pphgnet_tiny_quant.yaml @@ -0,0 +1,50 @@ +Global: + model_dir: ./PPHGNet_tiny_ssld_infer/ + format: 'paddle' + model_filename: inference.pdmodel + params_filename: inference.pdiparams + qat_image_path: ./ImageNet_val_640 + ptq_image_path: ./ImageNet_val_640 + input_list: ['x'] + qat_preprocess: cls_image_preprocess + ptq_preprocess: cls_image_preprocess + qat_batch_size: 32 + +Distillation: + alpha: 1.0 + loss: l2 + node: + - softmax_1.tmp_0 + +QuantAware: + use_pact: true + activation_bits: 8 + is_full_quantize: false + onnx_format: True + activation_quantize_type: moving_average_abs_max + weight_quantize_type: channel_wise_abs_max + not_quant_pattern: + - skip_quant + quantize_op_types: + - conv2d + - depthwise_conv2d + - matmul + - matmul_v2 + weight_bits: 8 + +TrainConfig: + epochs: 1 + eval_iter: 500 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.015 + T_max: 8000 + optimizer_builder: + optimizer: + type: Momentum + weight_decay: 0.00002 + origin_metric: 0.7959 + +PTQ: + calibration_method: 'avg' # option: avg, abs_max, hist, KL, mse + skip_tensor_list: None diff --git a/tools/common_tools/auto_compression/configs/classification/pplcnetv2_base_quant.yaml b/tools/common_tools/auto_compression/configs/classification/pplcnetv2_base_quant.yaml new file mode 100644 index 000000000..7c81c3ce2 --- /dev/null +++ b/tools/common_tools/auto_compression/configs/classification/pplcnetv2_base_quant.yaml @@ -0,0 +1,50 @@ +Global: + model_dir: ./PPLCNetV2_base_infer/ + format: 'paddle' + model_filename: inference.pdmodel + params_filename: inference.pdiparams + qat_image_path: ./ImageNet_val_640 + ptq_image_path: ./ImageNet_val_640 + input_list: ['x'] + qat_preprocess: cls_image_preprocess + ptq_preprocess: cls_image_preprocess + qat_batch_size: 32 + +Distillation: + alpha: 1.0 + loss: l2 + node: + - softmax_1.tmp_0 + +QuantAware: + use_pact: true + activation_bits: 8 + is_full_quantize: false + onnx_format: True + activation_quantize_type: moving_average_abs_max + weight_quantize_type: channel_wise_abs_max + not_quant_pattern: + - skip_quant + quantize_op_types: + - conv2d + - depthwise_conv2d + - matmul + - matmul_v2 + weight_bits: 8 + +TrainConfig: + epochs: 1 + eval_iter: 500 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.015 + T_max: 8000 + optimizer_builder: + optimizer: + type: Momentum + weight_decay: 0.00002 + origin_metric: 0.7704 + +PTQ: + calibration_method: 'avg' # option: avg, abs_max, hist, KL, mse + skip_tensor_list: None