From 880ad20bc61157f9501903e92e8a47547fdba74b Mon Sep 17 00:00:00 2001 From: Chang Xu Date: Thu, 13 Oct 2022 15:14:07 +0800 Subject: [PATCH] Fix FullQuant Demo (#1459) --- example/full_quantization/image_classification/README.md | 4 ++-- .../image_classification/configs/eval.yaml | 7 ------- .../configs/mobilenetv3_large_qat_dis.yaml | 2 +- example/full_quantization/image_classification/eval.py | 9 ++------- 4 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 example/full_quantization/image_classification/configs/eval.yaml diff --git a/example/full_quantization/image_classification/README.md b/example/full_quantization/image_classification/README.md index 79f491fd..8c33ca84 100644 --- a/example/full_quantization/image_classification/README.md +++ b/example/full_quantization/image_classification/README.md @@ -89,11 +89,11 @@ python -m paddle.distributed.launch run.py --save_dir='./save_quant_mobilev3/' - **验证精度** -根据训练log可以看到模型验证的精度,若需再次验证精度,修改配置文件```./configs/MobileNetV1/qat_dis.yaml```中所需验证模型的文件夹路径及模型和参数名称```model_dir, model_filename, params_filename```,然后使用以下命令进行验证: +根据训练log可以看到模型验证的精度,若需再次验证精度,修改配置文件```./configs/mobilenetv3_large_qat_dis.yaml```中所需验证模型的文件夹路径及模型和参数名称```model_dir, model_filename, params_filename```,然后使用以下命令进行验证: ```shell export CUDA_VISIBLE_DEVICES=0 -python eval.py --config_path='./configs/eval.yaml' +python eval.py --config_path='./configs/mobilenetv3_large_qat_dis.yaml' ``` diff --git a/example/full_quantization/image_classification/configs/eval.yaml b/example/full_quantization/image_classification/configs/eval.yaml deleted file mode 100644 index 6bcc5ff9..00000000 --- a/example/full_quantization/image_classification/configs/eval.yaml +++ /dev/null @@ -1,7 +0,0 @@ -model_dir: ./MobileNetV3_large_x1_0_infer -model_filename: inference.pdmodel -params_filename: inference.pdiparams -batch_size: 128 -data_dir: ./ILSVRC2012_data_demo/ILSVRC2012/ -img_size: 224 -resize_size: 256 diff --git a/example/full_quantization/image_classification/configs/mobilenetv3_large_qat_dis.yaml b/example/full_quantization/image_classification/configs/mobilenetv3_large_qat_dis.yaml index 8a1335b5..52c76219 100644 --- a/example/full_quantization/image_classification/configs/mobilenetv3_large_qat_dis.yaml +++ b/example/full_quantization/image_classification/configs/mobilenetv3_large_qat_dis.yaml @@ -4,7 +4,7 @@ Global: model_filename: inference.pdmodel params_filename: inference.pdiparams batch_size: 128 - data_dir: ./ILSVRC2012_data_demo/ILSVRC2012/ + data_dir: ./ILSVRC2012/ Distillation: alpha: 1.0 diff --git a/example/full_quantization/image_classification/eval.py b/example/full_quantization/image_classification/eval.py index 790f3543..433e62a8 100644 --- a/example/full_quantization/image_classification/eval.py +++ b/example/full_quantization/image_classification/eval.py @@ -33,11 +33,6 @@ def argsparser(): type=str, default='./image_classification/configs/eval.yaml', help="path of compression strategy config.") - parser.add_argument( - '--model_dir', - type=str, - default='./MobileNetV1_infer', - help='model directory') return parser @@ -92,6 +87,8 @@ def eval(): acc_num += 1 top_5 = float(acc_num) / len(label) results.append([top_1, top_5]) + if batch_id % 100 == 0: + print('Eval iter:', batch_id) result = np.mean(np.array(results), axis=0) return result[0] @@ -103,8 +100,6 @@ def main(args): global data_dir data_dir = global_config['data_dir'] - if args.model_dir != global_config['model_dir']: - global_config['model_dir'] = args.model_dir global img_size, resize_size img_size = int(global_config[ -- GitLab