Mini-Caffe now can be corss compiled for Android platform.
- You need to download Android NDK here first. Or if you use Android Studio, you can download Android NDK through SDK Manager.
- Set up environment variable
NDK_ROOT
for 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.exe
in the download page. You also need a shell environment to run the build. Usually Git for Windows ship withGit Bash
should be fine. IMPORTANT, you need to copy and rename/path/to/TDM-GCC-64/bin/mingw32-make.exe
to/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_NATIVE_API_LEVEL=21 # android native api level
ANDROID_BUILD_JOBS=2 # threads to build
ANDROID_ABIS=(arm64-v8a armeabi x86 x86_64) # android abi to build
build.sh
is tested on Ubuntu 16.04 with Android NDK r13b, Windows 10 with tdmgcc64-gcc-5.1.0-2.exe and Android NDK r12b.
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.