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

out.h w c are all zero after replacing my own .so file #438

Closed
YiLin-Chen opened this issue Jun 13, 2018 · 5 comments
Closed

out.h w c are all zero after replacing my own .so file #438

YiLin-Chen opened this issue Jun 13, 2018 · 5 comments

Comments

@YiLin-Chen
Copy link

YiLin-Chen commented Jun 13, 2018

I found that my matrix out is empty
ncnn::Mat out;
ex.extract(squeezenet_v1_1_param_id::BLOB_prob, out);

I have read #391 #248 #396, and none of their solution can solve my problem. Below is my building steps,

  1. build .a file for android according to the article https://github.com/Tencent/ncnn/wiki/cmake-%E6%89%93%E5%8C%85-android-sdk

  2. modify Android.mk file in ncnn-mobile squeezencnn-AS app (https://github.com/dangbo/ncnn-mobile), just change NCNN_INSTALL_PATH := /my/path/to/ncnn/build-android/install

  3. modify Application.mk file by commend NDK_TOOLCHAIN_VERSION := 4.9 (same as 为什么我拿ncnn编译出来的.a文件编译so的时候会报undefined reference to '__kmpc_fork_call'的错误 #292 )

  4. generate libsqueezencnn.so by ndk-build

During the above process, I didn't get any error message, however, the result is wrong. The output is alway "tench, Tinca, tinca = 0.000" and out.c out.w out.h are all zero. I use the original model and code as ncnn-mobile squeezencnn-AS provides.

I use Android Studio 3.1.2 on macOS High Sierra with ndk-r16b. Actually the prebuild .a file is not working for me either.

Thanks.

@YiLin-Chen
Copy link
Author

I found that the return value of load_param and load_model are 0. so weird... I didn't change the model.

@YiLin-Chen
Copy link
Author

YiLin-Chen commented Jun 14, 2018

After digging into the source code, I think it runs into

if (magic != 7767517)
{
fprintf(stderr, "param is too old, please regenerate\n");
return 0;
}

@nihui
Copy link
Member

nihui commented Jun 14, 2018

the model bundled in squeezencnn-AS project is too old to work with the latest ncnn libraray. try replacing model files with the latest version in ncnn repo

@YiLin-Chen
Copy link
Author

YiLin-Chen commented Jun 14, 2018

Thanks for your reply. I change the whole project to ncnn/examples/squeezencnn and use both prebuild and my own .a files, however, the result is same as before. ret = 0 from load_param and load_ model

@YiLin-Chen
Copy link
Author

Okay, I solve the problem and you are right. The model in ncnn-mobile repo is too old to be used. Please forget my last comment, I might have something wrong with my operations. To conclude, I solved the problem after I replace the ncnn-mobile project with the project in ncnn/examples/squeezencnn. Thanks :)

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