Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quantized.out int8量化后的模型在CPU后端运行resnet50出错(已更新到最新commit版本) #2737

Closed
YingkunZhou opened this issue Jan 18, 2024 · 10 comments
Labels

Comments

@YingkunZhou
Copy link

YingkunZhou commented Jan 18, 2024

#2614

初步测试mobilenet看起来是正常了许多,感谢开发者的努力!

但和上述issue同样的复现方法,我又用resnet50试了试,得到的结果如下:

模型下载地址:https://github.com/onnx/models/raw/main/Computer_Vision/resnet50_Opset16_timm/resnet50_Opset16.onnx

./pictureRecognition.out resnet50.mnn daisy.jpg
Load Cache file error.
The device support i8sdot:1, support fp16:1, support i8mm: 0
Session Info: memory use 29.272980 MB, flops is 4096.363281 M, backendType is 0, batch size = 1
input: w:224 , h:224, bpp: 3
origin size: 2100, 1500
For Image: daisy.jpg
672, -28.451855
657, -28.451855
658, -28.451855
659, -28.451855
660, -28.451855
661, -28.451855
662, -28.451855
663, -28.451855
664, -28.451855
665, -28.451855

有点好奇MNN里的量化框架有没有CI自动测试,为什么连最基本的reset50量化完都跑错

而未量化前的模型,被我命名为tmp.mnn (参考#2614 的操作流程),得到的分类结果就正常很多了

./pictureRecognition.out tmp.mnn  daisy.jpg                  
Load Cache file error.
The device support i8sdot:1, support fp16:1, support i8mm: 0
Session Info: memory use 169.978363 MB, flops is 4096.171875 M, backendType is 0, batch size = 1
input: w:224 , h:224, bpp: 3
origin size: 2100, 1500
For Image: daisy.jpg
985, 9.131153
113, -6.110043
506, -6.371115
308, -6.521829
987, -6.540517
714, -6.673302
307, -6.787087
698, -6.899653
783, -6.938828
652, -6.959727
@YingkunZhou YingkunZhou changed the title quantized.out int8量化后的模型在CPU后端运行resnet50仍然出错 quantized.out int8量化后的模型在CPU后端运行resnet50出错(已更新到最新commit版本) Jan 18, 2024
@YingkunZhou
Copy link
Author

YingkunZhou commented Jan 18, 2024

继续用经典的模型efficientnetv2_b0试了试
模型的下载地址为:https://github.com/onnx/models/raw/main/Computer_Vision/tf_efficientnetv2_b0_Opset16_timm/tf_efficientnetv2_b0_Opset16.onnx

得到的量化完的运行结果:

./pictureRecognition.out tf_efficientnetv2_b0_Opset16.mnn daisy.jpg
Load Cache file error.
The device support i8sdot:1, support fp16:1, support i8mm: 0
Create execution error : 101
Create execution error : 101
Session Info: memory use 0.005398 MB, flops is 463.154877 M, backendType is 0, batch size = 1
input: w:192 , h:192, bpp: 3
origin size: 2100, 1500
Can't run session because not resized
For Image: daisy.jpg
21, 250908922840517956672101818055251722240.000000
971, 155706892288681663873593671155795886080.000000
558, 144564517325205176731988373268433207296.000000
952, 112714106392544388862589291026817482752.000000
485, 72253792300723863246554176667036680192.000000
280, 70477894939442528461738991265310048256.000000
255, 42867207357076265693574510722641035264.000000
930, 40476864538057105379101055316830191616.000000
234, 39606622401000425894973568566339567616.000000
39, 33638683099101550629631678460033236992.000000

这结果多少是有些抽象了

而未量化前的模型结果

./pictureRecognition.out tmp.mnn daisy.jpg  
Load Cache file error.
The device support i8sdot:1, support fp16:1, support i8mm: 0
Session Info: memory use 34.192852 MB, flops is 537.623291 M, backendType is 0, batch size = 1
input: w:192 , h:192, bpp: 3
origin size: 2100, 1500
For Image: daisy.jpg
985, 9.512913
89, 2.403510
322, 2.085096
108, 2.013274
883, 1.951369
309, 1.885692
113, 1.817128
968, 1.690546
770, 1.643703
738, 1.622023

看着就正常很多

@v0jiuqi
Copy link
Collaborator

v0jiuqi commented Jan 19, 2024

我测试了结果没有不对啊,你用pictureRecognition_module.out 测试看看

@YingkunZhou
Copy link
Author

YingkunZhou commented Jan 21, 2024

@v0jiuqi 您确实是测试了量化后的模型了吗,能否贴一下您运行的分类结果让我看看,感谢!

模型就是上面提到的两个onnx官方仓库的,然后图片为
daisy

然后我是在arm64的开发板jetson orin (不是在x86的机器上,这一点也请注意)上进行编译运行的

@YingkunZhou
Copy link
Author

具体的量化流程可以参考#2614

@YingkunZhou
Copy link
Author

另外我想问一下,官方是打算放弃Session接口,改用Module接口了吗

@YingkunZhou
Copy link
Author

我测试了结果没有不对啊,你用pictureRecognition_module.out 测试看看

@v0jiuqi 可否提供一下你用pictureRecognition_module.out 测试的config.json文件,感谢

@v0jiuqi
Copy link
Collaborator

v0jiuqi commented Jan 31, 2024

这个是我们的量化工具和后端不一致导致的,你等我们更新吧

@YingkunZhou
Copy link
Author

好的,感谢

@hebangwen
Copy link

这个是我们的量化工具和后端不一致导致的,你等我们更新吧

请问这个问题修复了吗

Copy link

Marking as stale. No activity in 60 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants