PaddlePaddle / PaddleSlim

PaddleSlim is an open-source library for deep model compression and architecture search.
https://paddleslim.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.56k stars 345 forks source link

yolov5离线量化报错 #1880

Open luoshiyong opened 5 months ago

luoshiyong commented 5 months ago

----------- Running Arguments ----------- arch: YOLOv5 dataset_dir: /mnt/data01/luoshiyong/data/liugang model_dir: /mnt/data01/luoshiyong/code/PaddleSlim-release-2.5/yolov5out/best.onnx skip_tensors: None train_anno_path: annotations/instances1_train.json train_image_dir: images/train val_anno_path: annotations/instances1_val.json val_image_dir: images/val

loading annotations into memory... Done (t=0.22s) creating index... index created! I0626 11:09:01.155823 541758 interpretercore.cc:237] New Executor is Running. 2024-06-26 11:09:01,300-INFO: Loaded model from: /mnt/data01/luoshiyong/code/PaddleSlim-release-2.5/yolov5out/best_infer Wed Jun 26 11:09:01-INFO: Load model and set data loader ... Wed Jun 26 11:09:01-WARNING: The old way to load inference model is deprecated. Please specify path_prefix. model path: /mnt/data01/luoshiyong/code/PaddleSlim-release-2.5/yolov5out/best_infer/model.pdmodel, params path: /mnt/data01/luoshiyong/code/PaddleSlim-release-2.5/yolov5out/best_infer/model.pdiparams W0626 11:09:01.377684 541758 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 12.2, Runtime API Version: 11.6 W0626 11:09:01.419098 541758 gpu_resources.cc:149] device: 0, cuDNN Version: 8.4. Wed Jun 26 11:09:05-INFO: Collect quantized variable names ... Sampling stage, Run batch:| | 0/32 Traceback (most recent call last): File "post_quant.py", line 98, in main() File "post_quant.py", line 72, in main quant_post_static( File "/home/cisdi/anaconda3/envs/luoshiyong/lib/python3.8/site-packages/paddleslim-Stopping.at.filesystem.boundary._GIT_DISCOVERY_ACROSSFILESYSTEM.not.set.-py3.8.egg/paddleslim/quant/quanter.py", line 669, in quant_post_static File "/home/cisdi/anaconda3/envs/luoshiyong/lib/python3.8/site-packages/paddle/static/quantization/post_training_quantization.py", line 482, in quantize self._executor.run( File "/home/cisdi/anaconda3/envs/luoshiyong/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1392, in run res = self._run_impl( File "/home/cisdi/anaconda3/envs/luoshiyong/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1618, in _run_impl ret = new_exe.run( File "/home/cisdi/anaconda3/envs/luoshiyong/lib/python3.8/site-packages/paddle/fluid/executor.py", line 654, in run tensors = self._new_exe.run( ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [1, 512, 1, 1], X's size = 512, 'shape' is [2, 512], the capacity of 'shape' is 1024. [Hint: Expected capacity == in_size, but received capacity:1024 != in_size:512.] (at ../paddle/fluid/operators/reshape_op.cc:234) [operator < reshape2 > error]

minghaoBD commented 4 months ago

你好,这里的错误是指 reshape op的输入X和目标shape无法兼容。可以尝试将目标shape改成 [-1, 512]