diff --git a/README.md b/README.md index 8a7c146d3e42a0cec0ce14f3d0c7e90bcd2cb397..8210f3d6e041e1d76c2d10ead4f112b0b59c6713 100755 --- a/README.md +++ b/README.md @@ -182,6 +182,9 @@ git clone https://github.com/PaddlePaddle/PaddleSlim.git & cd PaddleSlim python setup.py install ``` +### 验证安装 + +安装完成后您可以使用 python 或 python3 进入 python 解释器,输入import paddleslim, 没有报错则说明安装成功。 ### 快速开始 diff --git a/example/auto_compression/README.md b/example/auto_compression/README.md index 4008d6622035e7782ac1974e3c231f52b5fca8f4..6f0e4878d1e567e5a971d95b7905eff01f61e220 100644 --- a/example/auto_compression/README.md +++ b/example/auto_compression/README.md @@ -220,21 +220,21 @@ ac.compress() - 测试FP32模型的速度 ``` - python ./image_classification/infer.py + python ./image_classification/paddle_inference_eval.py --model_path='./MobileNetV1_infer' --use_gpu=True --use_trt=True ### using tensorrt FP32 batch size: 1 time(ms): 0.6140608787536621 ``` - 测试FP16模型的速度 ``` - python ./image_classification/infer.py --use_fp16=True + python ./image_classification/paddle_inference_eval.py --model_path='./MobileNetV1_infer' --use_gpu=True --use_trt=True --use_fp16=True ### using tensorrt FP16 batch size: 1 time(ms): 0.5795984268188477 ``` - 测试INT8模型的速度 ``` - python ./image_classification/infer.py --model_dir=./MobileNetV1_quant/ --use_int8=True + python ./image_classification/paddle_inference_eval.py --model_path='./MobileNetV1_quant/' --use_gpu=True --use_trt=True --use_int8=True ### using tensorrt INT8 batch size: 1 time(ms): 0.5213963985443115 ``` diff --git a/example/auto_compression/image_classification/configs/eval.yaml b/example/auto_compression/image_classification/configs/eval.yaml index ae1987620250ece96ab1c9d2d14bdf1d96a90f84..b11e4c048f283b087a7225621f4269958802c971 100644 --- a/example/auto_compression/image_classification/configs/eval.yaml +++ b/example/auto_compression/image_classification/configs/eval.yaml @@ -1,7 +1,8 @@ -model_dir: './MobileNetV1_infer' -model_filename: 'inference.pdmodel' -params_filename: "inference.pdiparams" -batch_size: 128 -data_dir: './ILSVRC2012_data_demo/ILSVRC2012/' -img_size: 224 -resize_size: 256 +Global: + model_dir: './MobileNetV1_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/auto_compression/image_classification/paddle_inference_eval.py b/example/auto_compression/image_classification/paddle_inference_eval.py index e086a95375b6b8ae50f29406dbd3f529aa5fdf9c..d3607387545efa4e8e17ee7a2fc559507367b2fc 100644 --- a/example/auto_compression/image_classification/paddle_inference_eval.py +++ b/example/auto_compression/image_classification/paddle_inference_eval.py @@ -172,9 +172,9 @@ class Predictor(object): crop_size=args.img_size, resize_size=args.resize_size) else: - image = np.ones( - (1, 3, args.img_size, args.img_size)).astype(np.float32) - label = None + image = np.ones((args.batch_size, 3, args.img_size, + args.img_size)).astype(np.float32) + label = [[None]] * args.batch_size val_loader = [[image, label]] results = [] input_names = self.paddle_predictor.get_input_names()