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

Mobilenet Android version #390

Closed
Nanamare opened this issue May 8, 2018 · 6 comments
Closed

Mobilenet Android version #390

Nanamare opened this issue May 8, 2018 · 6 comments

Comments

@Nanamare
Copy link

Nanamare commented May 8, 2018

https://github.com/nanamare/ncnn_mobilenet

@nihui
Copy link
Member

nihui commented May 8, 2018

thanks

one question about your code
you create ncnn::Mat with RGBA2BGR at

input = ncnn::Mat::from_pixels((const unsigned char *) pixelData, ncnn::Mat::PIXEL_RGBA2BGR, width, height);

https://github.com/nanamare/ncnn_mobilenet/blob/843bc386f2de866abbd353ec7610f766082a4648/ncnn_mobileNet/app/src/main/cpp/native-lib.cpp#L131

but the pre-process is for RGB

//mean subtraction
const float meanValues[3] = {103.94f, 116.78f, 123.68f}; // mobileNet mean value RGB 103.94f, 116.78f, 123.68f
input.substract_mean_normalize(meanValues, 0);

https://github.com/nanamare/ncnn_mobilenet/blob/843bc386f2de866abbd353ec7610f766082a4648/ncnn_mobileNet/app/src/main/cpp/native-lib.cpp#L140

so, the channel order is not consistent, is it ?

@Nanamare
Copy link
Author

Nanamare commented May 8, 2018

@nihui
OMG, my bad.
I have to put meanValues in reverse(BGR) or Image Load to RGB

@nihui
Copy link
Member

nihui commented May 8, 2018

the exact order shall be the one used in training phase, which is probably BGR in caffe, or RGB in mxnet

@Nanamare
Copy link
Author

Nanamare commented May 8, 2018

@nihui
Absolutely BGR in caffe! this model trained to using BGR format.

@billmguo
Copy link

any one meet the link issues in mac(Serria) or ubuntu(14.04) build, API 27, NDK r17

Error while executing process /Users/xxx/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /ncnn_mobilenet/ncnn_mobileNet/app/.externalNativeBuild/cmake/debug/arm64-v8a --target objectclassification}
[1/1] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/arm64-v8a/libobjectclassification.so
FAILED: : && /Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android --gcc-toolchain=/Users/xxx/Library/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/xxx/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem /Users/xxx/Library/Android/sdk/ndk-bundle/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=23 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -fopenmp -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math -std=c++11 -frtti -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /Users/xxx/Library/Android/sdk/ndk-bundle/platforms/android-23/arch-arm64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/Users/xxx/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libobjectclassification.so -o ../../../../build/intermediates/cmake/debug/obj/arm64-v8a/libobjectclassification.so CMakeFiles/objectclassification.dir/src/main/cpp/native-lib.cpp.o ../../../../src/main/jniLibs/arm64-v8a/libncnn.a -ljnigraphics -lz -llog -latomic -lm "/Users/xxx/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a" "/Users/xxx/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a" && :
../../../../src/main/jniLibs/arm64-v8a/libncnn.a(net.cpp.o): In function void std::_Destroy_aux<false>::__destroy<ncnn::Blob*>(ncnn::Blob*, ncnn::Blob*)': /home/pf/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_construct.h:(.text._ZN4ncnn3NetD2Ev+0x38): undefined reference to std::string::_Rep::_S_empty_rep_storage'
/home/pf/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_construct.h:(.text._ZN4ncnn3NetD2Ev+0x40): undefined reference to std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/jniLibs/arm64-v8a/libncnn.a(net.cpp.o): In function std::string::_Rep::_M_dispose(std::allocator const&)':
/home/pf/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/basic_string.h:249: undefined reference to std::string::_Rep::_M_destroy(std::allocator<char> const&)' ../../../../src/main/jniLibs/arm64-v8a/libncnn.a(net.cpp.o): In function void std::_Destroy_aux::__destroyncnn::Blob*(ncnn::Blob*, ncnn::Blob*)':
/home/pf/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_construct.h:(.text._ZN4ncnn3NetD2Ev+0x130): undefined reference to std::string::_Rep::_S_empty_rep_storage' /home/pf/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_construct.h:(.text._ZN4ncnn3NetD2Ev+0x138): undefined reference to std::string::_Rep::_S_empty_rep_storage'

@billmguo
Copy link

work on NDK16

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