ncnn-android-yolov7
ncnn-android-yolov7 copied to clipboard
"Unsupported Java." and Using Custom Model Successfully
The project requires JDK11 and android-ndk-r21e. You need to download the NDK from github manually.
By the way, this is the version that doesn't need downgrading (2023/05/22) : https://drive.google.com/file/d/12IyuXRKKGG2Zh_PBLE6dPFCeEGQYuiNp/view?usp=sharing New a Native C++ project named "MyJNI" and replace the app/scr/main.
Next, go to these reference : https://youtu.be/PukcRMN-Hs0 https://youtu.be/gOvvzS1-RuI https://blog.csdn.net/qq_43268106/article/details/127139216
Finally, we need to change output name to Convolution, instead of Permute :
Thank @xiang-wuu so much for this example!
Hi dadin852,
I followed the steps recommended by you and in the videos indicated, but I still have a problem. The application closes right after turning on the camera. Using the weights available here in git (assets/yolov7-tiny.bin and yolov7-tiny.param) the application works normally on my cell phone.
Do you have any ideas to help me? Below is the modified excerpt from yolo.cpp
Seems that you're using Premute outputs. Would you try to set Convolution as outputs?
Seems that you're using Premute outputs. Would you try to set Convolution as outputs?
Thanks for your feedback dadin852!
Unfortunately, I don't think I have enough experience to make this change.
I'm exporting the trained weights from pytroch to onnx with the command:
python export.py --weights yolov7-tiny.pt --simplify --topk-all 100 --iou-thres 0.50 --conf-thres 0.15 --img-size 448 448 --max-wh 448
to export from onnx to ncnn use: ./onnx2ncnn yolov7-tiny.onnx yolov7-tiny.param yolov7-tiny.bin
Should the changes suggested by you be made directly in the generated .param file or in the onnx file?
Below I am sending the generated .param file. yolov7-tiny.zip
Open your .param in Netron website :
Then you'll see the convolution output names.
For your model, you may use : "/model.77/m.0/Conv_output_0" instead of "output" "/model.77/m.1/Conv_output_0" instead of "286" "/model.77/m.2/Conv_output_0" instead of "298"
Open your .param in Netron website :
Then you'll see the convolution output names.
For your model, you may use : "/model.77/m.0/Conv_output_0" instead of "output" "/model.77/m.1/Conv_output_0" instead of "286" "/model.77/m.2/Conv_output_0" instead of "298"
dadin852
It worked!!
I greatly appreciate your help! It was extremely useful!