Mini-Caffe now can be cross compiled for Android platform.
- You need to download Android NDK here first (version higher than android-ndk-15c). Or if you use Android Studio, you can download Android NDK through SDK Manager.
- Set up environment variable
NDK_ROOTfor Android NDK.NDK_ROOT=/path/to/ndk, if you use Windows, make sure to replace path separator\to/. - If you use Windows, you also need the GNU toolchain. Usually tdm-gcc should be fine. Download 64bit version of tdm-gcc like
tdmgcc64-gcc-x.x.x.exein the download page. You also need a shell environment to run the build. Usually Git for Windows ship withGit Bashshould be fine. IMPORTANT, you need to copy and rename/path/to/TDM-GCC-64/bin/mingw32-make.exeto/path/to/TDM-GCC-64/bin/make.exe.
Run build.sh will automatically cross compile Mini-Caffe and libraries(protobuf and OpenBLAS) it relies on. The default build option is listed below, currently you can directly change them in build.sh file.
ANDROID_PLATFORM_LEVEL=21 # android native api level
ANDROID_BUILD_JOBS=4 # threads to build
ANDROID_ABIS=(arm64-v8a armeabi-v7a) # android abi to build
build.sh is tested on Fedora 27 with android-ndk-15c, Windows 10 with tdmgcc64-gcc-5.1.0-2.exe and Android NDK r16b.
Every library will create a build folder for every ANDROID_ABI. Mini-Caffe output libcaffe.so will be in jniLibs.
I have modify Leliana/WhatsThis which uses MXNet as backend. Make Mini-Caffe as its backend, checkout project luoyetx/WhatsThis. What's more, you also need to checkout the Java API here.