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

"Unsupported Java." and Using Custom Model Successfully #16

Open
dadin852 opened this issue May 15, 2023 · 6 comments
Open

"Unsupported Java." and Using Custom Model Successfully #16

dadin852 opened this issue May 15, 2023 · 6 comments

Comments

@dadin852
Copy link

dadin852 commented May 15, 2023

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.

@dadin852 dadin852 changed the title Error: Unsupported Java. "Unsupported Java." and Using Custom Model Successfully May 16, 2023
@dadin852
Copy link
Author

dadin852 commented May 16, 2023

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 :
螢幕擷取畫面 (2)
螢幕擷取畫面 (3)

Thank @xiang-wuu so much for this example!

@jhony2507
Copy link

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
yolo-tuny-custom

@dadin852
Copy link
Author

dadin852 commented May 18, 2023

Seems that you're using Premute outputs. Would you try to set Convolution as outputs?
239368588-2d584147-b114-4aec-9459-e59a6c61c1b2

@jhony2507
Copy link

Seems that you're using Premute outputs. Would you try to set Convolution as outputs? 239368588-2d584147-b114-4aec-9459-e59a6c61c1b2

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

@dadin852
Copy link
Author

dadin852 commented May 19, 2023

Open your .param in Netron website :
Screenshot_20230519_222033_Chrome
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"

@jhony2507
Copy link

Open your .param in Netron website : Screenshot_20230519_222033_Chrome 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!

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

2 participants