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

ncnn-20230517-android-shared 32位Android APK 上 执行矩阵乘法forward时崩溃 #4826

Closed
garbe-github-support opened this issue Jun 28, 2023 · 4 comments

Comments

@garbe-github-support
Copy link

garbe-github-support commented Jun 28, 2023

复现条件
开源库这个位置的代码
https://github.com/Digital2Slave/ncnn-android-yolov8-seg/blob/7f76b69b936b1edd34456dc11279e51ecdb28084/app/src/main/jni/yolo.cpp#L162C39-L162C39
image

把这个代码复制到自己的项目中(没有测试这个项目的代码会不会崩溃)
然后,用
ncnn-20230517-android-shared 包, 打包32位的APK
荣耀honor80 pro VIVO IQoo 测试,运行到这个位置APP就会直接崩溃
使用同版本的 非shared的不会出错,使用更低版本的shared 非shared 都也不会出错,打包成64位也不会出错

输入矩阵尺寸信息
a 尺寸 = w 32 h 2 c 1 cstep = 64, elemSize= 4 elemPack = 1
b 尺寸 = w 15360 h 32 c 1 cstep = 491520, elemSize= 4 elemPack = 1

报错信息
2023-06-28 20:34:23.462 12454-14030/xxx E/DEBUG: #00 pc 0004c9cc /data/app/~~mHLNNM_lu_r4qz_zkueSpA==/xxx -zciNAeg6Ht3OMNprAXiqtQ==/lib/arm/libcrashsdk.so
2023-06-28 20:34:23.462 12454-14030/xxx u E/DEBUG: #1 pc 0004ac5c /data/app/~~mHLNNM_lu_r4qz_zkueSpA==/xxx -zciNAeg6Ht3OMNprAXiqtQ==/lib/arm/libcrashsdk.so
2023-06-28 20:34:23.462 12454-14030/xxx E/DEBUG: #2 pc 00007bac /data/app/~~mHLNNM_lu_r4qz_zkueSpA==/xxx -zciNAeg6Ht3OMNprAXiqtQ==/lib/arm/libcrashsdk.so
2023-06-28 20:34:23.462 12454-14030/xxx E/DEBUG: #3 pc 0002d23c /data/app/~~mHLNNM_lu_r4qz_zkueSpA==/xxx -zciNAeg6Ht3OMNprAXiqtQ==/lib/arm/libcrashsdk.so
2023-06-28 20:34:23.462 12454-14030/xxx E/DEBUG: #4 pc 0005c083 /apex/com.android.runtime/lib/bionic/libc.so (__cxa_finalize+190)
2023-06-28 20:34:23.462 12454-14030/xxx E/DEBUG: #5 pc 0005147b /apex/com.android.runtime/lib/bionic/libc.so (exit+10)
2023-06-28 20:34:23.462 12454-14030/xxx E/DEBUG: #6 pc 002d4bf0 /data/app/~~mHLNNM_lu_r4qz_zkueSpA==/xxxxx-zciNAeg6Ht3OMNprAXiqtQ==/lib/arm/libncnn.so (__kmp_invoke_microtask+1064)

@nihui
Copy link
Member

nihui commented Jun 28, 2023

应该是这个commit修复了,可以测试下 7883f4d

@garbe-github-support
Copy link
Author

好的 ,谢谢啦

@glenn-jocher
Copy link

@garbe-github-support I have great news 😃! I've recently added official support for Ultralytics YOLOv8 NCNN export ✅ in PR ultralytics/ultralytics#3529 with the help of @nihui which is part of ultralytics==8.0.129. NCNN works for all tasks including Detect, Segment, Pose and Classify.

You can now export with CLI:

yolo export model=yolov8n.pt format=ncnn

or Python:

from ultralytics import YOLO

# Create a model
model = YOLO('yolov8n.pt')

# Export the model to NCNN with arguments
model.export(format='ncnn', half=True, imgsz=640)

Output is a yolov8n_ncnn_model/ directory containing model.bin, model.param and metadata.yaml, along with extra PNNX files. For details see https://github.com/pnnx/pnnx README.

To get this update:

  • Git – Run git pull from within your ultralytics/ directory or run git clone https://github.com/ultralytics/ultralytics again
  • Pip – Update with pip install -U ultralytics
  • Notebooks – Check out the updated notebooks Run on Gradient Open In Colab Open In Kaggle
  • Docker – Run sudo docker pull ultralytics/ultralytics:latest to update your image Docker Pulls

Please let us know if NCNN export is working correctly for you, and don't hesitate to report any other issues you find or feature requests you may have. Happy training with YOLOv8 🚀!

@garbe-github-support
Copy link
Author

Thank you, it's a great job!

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

No branches or pull requests

3 participants