alibaba / MNN

MNN is a blazing fast, lightweight deep learning framework, battle-tested by business-critical use cases in Alibaba
http://www.mnn.zone/
8.74k stars 1.67k forks source link

YOLOv10-n onnx结果与mnn模型结果不一致 #3038

Closed WYL-Projects closed 1 month ago

WYL-Projects commented 1 month ago

执行的命令行: python tools/script/testMNNFromOnnx.py best.onnx DEBUG

输出信息如下: Dir exist onnx/test.onnx tensor(float) ['output0'] inputs: images onnx/ outputs: onnx/output0.txt (1, 300, 6) onnx/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ output0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: output0 output0: (1, 300, 6, ) TESTERROR output0 value error : absMaxV:640.977417 - DiffMax 625.885498 Error for output output0 Save mnn result to .error director

Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:06] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ output0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: output0 output0: (1, 300, 6, ) TESTERROR output0 value error : absMaxV:640.977417 - DiffMax 625.885498 Error for output output0 Save mnn result to .error director

Debug Mode: True onnx/test.onnx tensor(float) ['/model.23/Mul_output_0'] inputs: images onnx/ outputs: onnx//model.23/Mul_output_0.txt (1, 4, 8400) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:08] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:08] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:08] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:08] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/Mul_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/Mul_output_0 /model.23/Mul_output_0: (1, 4, 8400, ) TEST_SUCCESS

Test Node : /model.23/Mul True onnx/test.onnx tensor(float) ['/model.23/Transpose_output_0'] inputs: images onnx/ outputs: onnx//model.23/Transpose_output_0.txt (1, 8400, 5) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:10] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:10] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:10] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:10] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/Transpose_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/Transpose_output_0 /model.23/Transpose_output_0: (1, 8400, 5, ) TEST_SUCCESS

Test Node : /model.23/Transpose True onnx/test.onnx tensor(float) ['/model.23/Split_2_output_0'] inputs: images onnx/ outputs: onnx//model.23/Split_2_output_0.txt (1, 8400, 4) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:13] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:13] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:13] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:13] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/Split_2_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/Split_2_output_0 /model.23/Split_2_output_0: (1, 8400, 4, ) TEST_SUCCESS

Test Node : /model.23/Split_2 True Error is between /model.23/Split_2 and /model.23/Concat_6 onnx/test.onnx tensor(float) ['/model.23/GatherElements_2_output_0'] inputs: images onnx/ outputs: onnx//model.23/GatherElements_2_output_0.txt (1, 300, 4) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:15] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:15] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:15] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:15] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/GatherElements_2_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/GatherElements_2_output_0 /model.23/GatherElements_2_output_0: (1, 300, 4, ) TESTERROR /model.23/GatherElements_2_output_0 value error : absMaxV:641.803833 - DiffMax 626.899292 Error for output /model.23/GatherElements_2_output_0 Save mnn result to .error director

Test Node : /model.23/GatherElements_2 False onnx/test.onnx tensor(float) ['/model.23/GatherElements_output_0'] inputs: images onnx/ outputs: onnx//model.23/GatherElements_output_0.txt (1, 300, 4) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:17] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:17] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:17] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:17] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/GatherElements_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/GatherElements_output_0 /model.23/GatherElements_output_0: (1, 300, 4, ) TESTERROR /model.23/GatherElements_output_0 value error : absMaxV:641.780823 - DiffMax 628.601929 Error for output /model.23/GatherElements_output_0 Save mnn result to .error director

Test Node : /model.23/GatherElements False onnx/test.onnx tensor(float) ['/model.23/Split_2_output_0'] inputs: images onnx/ outputs: onnx//model.23/Split_2_output_0.txt (1, 8400, 4) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:19] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:19] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:19] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:19] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/Split_2_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/Split_2_output_0 /model.23/Split_2_output_0: (1, 8400, 4, ) TEST_SUCCESS

Test Node : /model.23/Split_2 True onnx/test.onnx tensor(float) ['/model.23/Tile_output_0'] inputs: images onnx/ outputs: onnx//model.23/Tile_output_0.txt (1, 300, 4) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:21] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:21] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:21] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:21] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/Tile_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/Tile_output_0 /model.23/Tile_output_0: (1, 300, 4, ) TESTERROR /model.23/Tile_output_0 value error : absMaxV:8397.000000 - DiffMax 7882.000000 Error for output /model.23/Tile_output_0 Save mnn result to .error director

Test Node : /model.23/Tile False onnx/test.onnx tensor(float) ['/model.23/TopK_output_0'] inputs: images onnx/ outputs: onnx//model.23/TopK_output_0.txt (1, 300) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:24] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:24] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:24] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:24] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/TopK_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/TopK_output_0 /model.23/TopK_output_0: (1, 300, ) TEST_SUCCESS

Test Node : /model.23/TopK True onnx/test.onnx tensor(float) ['/model.23/Unsqueeze_output_0'] inputs: images onnx/ outputs: onnx//model.23/Unsqueeze_output_0.txt (1, 300, 1) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:26] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:26] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:26] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:26] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/Unsqueeze_output_0, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/Unsqueeze_output_0 /model.23/Unsqueeze_output_0: (1, 300, 1, ) TESTERROR /model.23/Unsqueeze_output_0 value error : absMaxV:8397.000000 - DiffMax 8371.000000 Error for output /model.23/Unsqueeze_output_0 Save mnn result to .error director

Test Node : /model.23/Unsqueeze False Error is between /model.23/TopK and /model.23/Unsqueeze onnx/test.onnx tensor(float) ['/model.23/TopK_output_1'] inputs: images onnx/ outputs: onnx//model.23/TopK_output_1.txt (1, 300) onnx//model.23/ Can't open file:/sys/devices/system/cpu/cpufreq/boost/affected_cpus Can't open file:/sys/devices/system/cpu/cpufreq/ondemand/affected_cpus CPU Group: [ 20 21 31 13 23 1 15 25 3 17 27 5 19 29 7 10 11 30 9 12 22 0 14 24 2 16 26 4 18 28 6 8 ], 2200000 - 5083398 The device supports: i8sdot:0, fp16:0, i8mm: 0, sve2: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 [05:45:28] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:46: ONNX Model ir version: 8 [05:45:28] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:47: ONNX Model opset version: 17 [05:45:28] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.11/Resize_output_0 has empty input, the index is 1 [05:45:28] /dataset/MNN-master/tools/converter/source/onnx/onnxConverter.cpp:146: Check it out ==> /model.14/Resize_output_0 has empty input, the index is 1 Start to Optimize the MNN Net... inputTensors : [ images, ] outputTensors: [ /model.23/TopK_output_1, ] Converted Success! Check convert result by onnx, thredhold is 0.01 images output: /model.23/TopK_output_1 /model.23/TopK_output_1: (1, 300, ) TESTERROR /model.23/TopK_output_1 value error : absMaxV:8391.000000 - DiffMax 8133.000000 Error for output /model.23/TopK_output_1 Save mnn result to .error director

Test Node : /model.23/TopK False Error is between /model.23/TopK and /model.23/TopK

好像是yolov10后处理模块的/model.23/TopK不支持,但我不知道如何去改写它来保持onnx与mnn结果一致,best.onnx我已上传至附件,希望大佬给我解答一下

jxt1234 commented 1 month ago

我们看一下

WYL-Projects commented 1 month ago

我们看一下

好的,麻烦了

jxt1234 commented 1 month ago

看了一下,是 topk 相近的值,算出的 index 不一样。用实际数据运行测试下吧,可能只是计算误差