airockchip / rknn_model_zoo

Apache License 2.0
873 stars 167 forks source link

模型转换成功,但是推理结果不正确 #14

Closed wantao1008hh closed 1 year ago

wantao1008hh commented 1 year ago

转换日志如下

---> Create RKNN object W init: rknn-toolkit2 version: 1.4.0-22dcfef4 ---> Seting RKNN config ---> Loading onnx model ---> Building Analysing : 0%| | 0/Analysing : 100%|███████████████████████████████████████████████| 145/145 [00:00<00:00, 5146.43it/s] Quantizating : 0%| | 0/Quantizating : 1%|▎ | 1/145 [00:Quantizating : 1%|▋ | 2/145 [00:Quantizating : 2%|▉ | 3/145 [00:Quantizating : 3%|█▎ | 4/145 [00:Quantizating : 4%|█▉ | 6/145 [00:Quantizating : 6%|██▋ | 8/145 [00:Quantizating : 7%|███▏ | 10/145 [00:Quantizating : 9%|████▏ | 13/145 [00:Quantizating : 10%|████▊ | 15/145 [00:Quantizating : 12%|█████▌ | 17/145 [00:Quantizating : 14%|██████▍ | 20/145 [00:Quantizating : 17%|███████▊ | 24/145 [00:Quantizating : 19%|█████████ | 28/145 [00:Quantizating : 21%|██████████ | 31/145 [00:Quantizating : 24%|███████████▎ | 35/145 [00:Quantizating : 26%|████████████▎ | 38/145 [00:Quantizating : 28%|█████████████▎ | 41/145 [00:Quantizating : 31%|██████████████▌ | 45/145 [00:Quantizating : 34%|████████████████▏ | 50/145 [00:Quantizating : 38%|█████████████████▊ | 55/145 [00:Quantizating : 41%|███████████████████ | 59/145 [00:Quantizating : 43%|████████████████████▍ | 63/145 [00:Quantizating : 50%|███████████████████████▎ | 72/145 [00:Quantizating : 53%|████████████████████████▉ | 77/145 [00:Quantizating : 58%|███████████████████████████▏ | 84/145 [00:Quantizating : 61%|████████████████████████████▊ | 89/145 [00:Quantizating : 65%|██████████████████████████████▍ | 94/145 [00:Quantizating : 68%|████████████████████████████████ | 99/145 [00:Quantizating : 71%|████████████████████████████████▋ | 103/145 [00:Quantizating : 74%|█████████████████████████████████▉ | 107/145 [00:Quantizating : 77%|███████████████████████████████████▏ | 111/145 [00:Quantizating : 79%|████████████████████████████████████▏ | 114/145 [00:Quantizating : 82%|█████████████████████████████████████▊ | 119/145 [00:Quantizating : 86%|███████████████████████████████████████▎ | 124/145 [00:Quantizating : 88%|████████████████████████████████████████▌ | 128/145 [00:Quantizating : 92%|██████████████████████████████████████████▏ | 133/145 [00:Quantizating : 96%|████████████████████████████████████████████ | 139/145 [00:Quantizating : 100%|██████████████████████████████████████████████| 145/145 [00:Quantizating : 100%|██████████████████████████████████████████████| 145/145 [00:05<00:00, 24.87it/s] W build: The default input dtype of 'images' is changed from 'float32' to 'int8' in rknn model for performance! Please take care of this change when deploy rknn model with Runtime API! W build: The default output dtype of 'output' is changed from 'float32' to 'int8' in rknn model for performance! Please take care of this change when deploy rknn model with Runtime API! W build: The default output dtype of '332' is changed from 'float32' to 'int8' in rknn model for performance! Please take care of this change when deploy rknn model with Runtime API! W build: The default output dtype of '334' is changed from 'float32' to 'int8' in rknn model for performance! Please take care of this change when deploy rknn model with Runtime API! ---> Export RKNN model WARNING: RK3568 model needn't pre_compile. Ignore! Convert Done!

============================== Compare_convert_dist_via_python sample: 1 ---> Init_rknn_runtime I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36) D RKNNAPI: ============================================== D RKNNAPI: RKNN VERSION: D RKNNAPI: API: 1.4.0 (bb6dac9 build: 2022-08-29 16:17:01) D RKNNAPI: DRV: rknn_server: 1.4.0 (bb6dac9 build: 2022-08-29 16:16:39) D RKNNAPI: DRV: rknnrt: 1.4.0 (a10f100eb@2022-09-09T09:06:40) D RKNNAPI: ============================================== ---> compute onnx result For example iter 1/1 rknn(asymmetric_quantized-8) VS onnx cos_similarity: output-0 : 0.997616171836853 output-1 : 0.9967880249023438 output-2 : 0.995629072189331

============================== Compare_convert_dist_via_Capi looptime: 100 api_type: normal sample: 1

Device: RK3568 adb server version (40) doesn't match this client (39); killing...

wantao1008hh commented 1 year ago

使用的是airockchip/yolov5 master分支 pt使用的是yolov5-v6.2版本,转化后的onnx文件 提取码: 1234 转化的配置如下: model_name: yolov5_yolov7 model_framework: onnx model_file_path: yolov5s-v6_2.onnx RK_device_platform: rk3568 RK_device_id: PR51213100161 dataset: ../../../../../datasets/COCO/coco_dataset_20.txt quantize: True pre_compile: online graph: in_0: shape: 3,640,640 mean_values: 0 std_values: 255 img_type: RGB

configs: quantized_dtype: asymmetric_quantized-8 quantized_algorithm: normal optimization_level: 3` 推理结果显示如下: BOX_THRESH = 0.25 NMS_THRESH = 0.45 sendpix0

wantao1008hh commented 1 year ago

已解决,simgod函数问题,这个模型时不带的,所以预测时需要去掉。

charming2992 commented 1 year ago

已解决,simgod函数问题,这个模型时不带的,所以预测时需要去掉。

请问这个怎么解决的呀

wantao1008hh commented 1 year ago

已解决,simgod函数问题,这个模型时不带的,所以预测时需要去掉。

请问这个怎么解决的呀

使用测试的方法有问题,模型转换时没有问题的,测试使用提供的他demo,不要用其他版本测试。 image

charming2992 commented 1 year ago

我是使用的他提供修改的yolov7训练和导出的,现在使用这个python_demo时v7出现通道的问题,但是yolov5能成功了。(都是使用的自己的数据集训练的)