GithubHelp home page GithubHelp logo

caffe-android-lib's Introduction

Hi, I'm Shiro 👋

sh1r0's github stats

caffe-android-lib's People

Contributors

sh1r0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caffe-android-lib's Issues

run `./bin/caffe train` through android adb

I compiled caffe-android-lib successfully for armeabi-v7a, and would like to train a model
directly on phone.

Without hassling with UI, I decide to run caffe binary through adb shell. After having the
root permission, I run

./bin/caffe train -solver examples/mnist/lenet_solver.prototxt

However, I got a segmentation fault.

Meanwhile, using libcaffe.so in Android app works perfectly.

Caffe-android-lib fail in Mac OS

Hi,

I need ti integrate caffe library in my Android project to import classes in C source using NDK, when I try to build this library in Mac Os, I have the next error

      readlink: illegal option -- f
      usage: readlink [-n] [file ..

Can you help me?

Questions: How correcly add it to JNI, the Compiler flag CPU_ONLY = ON is not working.

HI,
I have android.mk file and source code uses the cafe.
Adding cafe .so library as include $(PREBUILT_SHARED_LIBRARY).
And to module adding the Header files.

But always i am getting error that:
[exec] ../../../ext/caffe/android/include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: No such file or directory [exec] #include <cublas_v2.h>

So i understand that CPU_ONLY=ON don`t transwer so i added for android and application mk files.

APP_CPPFLAGS := -CPU_ONLY=ON
LOCAL_CPPFLAGS := -CPU_ONLY=ON

But still getting the same error. Maybe i am doing something wrong ?

Thanks in Advance.

About Openblas

hi sh1r0:
I'm very interesting in your project.This project is very wondeful.It works very well with eigen,but it seems not work with openblas. I ran it in android, but it crashed infunction "cblas_sgemm".

Performance

Has anyone tested the performance on an android device?

Caffe-Android-Lib build issue

I need to build the Caffe-Android-Lib for this purpose I have followed the README.md instruction in
https://github.com/sh1r0/caffe-android-lib this link. I have successfully cloned the repo by this
git clone --recursive https://github.com/sh1r0/caffe-android-lib.git command
then I moved to the caffe-android-lib folder and have run this command
./build.py $(NDK_PATH) but it showed the error as below

inflating: OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCVModules_armeabi-relea se.cmake
Traceback (most recent call last): File "D:\Jamal\Others\Caffe_library\caffe-android-lib\build.py", line 113, in <module> main(sys.argv[1:]) File "D:\Jamal\Others\Caffe_library\caffe-android-lib\build.py", line 105, in main setup() File "D:\Jamal\Others\Caffe_library\caffe-android-lib\build.py", line 54, in s etup shutil.rmtree(OPENCV_TEMP_DIR) File "C:\Python34\lib\shutil.py", line 478, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Python34\lib\shutil.py", line 373, in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) File "C:\Python34\lib\shutil.py", line 371, in _rmtree_unsafe os.unlink(fullname) PermissionError: [WinError 5] Access is denied: 'OpenCV-2.4.9-android-sdk\\LICEN SE'
D:\Jamal\Others\Caffe_library\caffe-android-lib>

I have used the Windows7 64 bit machine & android-ndk-r8b

omp_set_num_threads didnot work?

Hi sh1r0:
in the caffe_jni.cpp, I use omp_set_num_threads(4),then follow with omp_get_max_threads(),and the result is 4,it's ok.But when I call omp_get_max_threads() in the function predict_top_k() in the file of caffe_mobile.cpp, the result is 8 ( 8 core inside). that's so weird.
Then I use Eigen::setNbThreads(4) in the caffe_jni.cpp, and call Eigen::nbThreads() in caffe_mobile.cpp like this:

VLOG(1)<<Eigen::nbThreads();
const vector<Blob<float>*>& result = caffe_net->Forward(dummy_bottom_vec, &loss);
VLOG(1)<<Eigen::nbThreads();

the results are 4,it's right. But in the lib of eigen, the function parallelize_gemm,calls nbThreads(), and the results are 8... it actually runs in 8 threads...

it seems that the action scope of the layer jni and the layer in the eigen is not the same...
Does anyone have some idea?

predict_top_k interface in caffe_mobile.cpp

Hi,I got a question about this interface.I just wanna acquire the prediction(prob) vector of one single channel(gray) image and I can not be quite understood of this interface.
What does the function CHECK(ReadImageToDatum(img_path, 0, 256, 256, true, &datum)) mean and what kind of parameter should be passed into the ReadImageToDatum?And what does those parameter mean?Should I preprocess the image by myself?

Confusing about that,I give it a shot.I use CHECK(ReadImageToDatum(img_path, 0, 28, 28, false, &datum)); and then after compiled and running on the android device,the application crashed,with this

How to access data from android camera without storing them to some jpg file?

I'm running a detector based on your caffe version. I'd like to increase the detection speed by passing the data from camera to caffe without the intermediate storing to SD-Card step. Can you point me a way how to do that?
In turn (if you are interested) I could share my code for running my detector on android in turn once the code is little more sophisticated / readable.

For starting I guess I would have to replace the string variable jstring imgPath in caffe_jni.cpp line 88 by a pointer pointing to the location of the image in the RAM memory of the smartphone

JNIEXPORT jintArray JNICALL
Java_com_demoDetectorApp_caffe_1android_1lib_CaffeMobile_predictImage(JNIEnv *env,
                                                            jobject thiz,
                                                            jstring imgPath,
                                                            jint k) {

Then I would need to store tthe image as a opencv Mat object. I know how to go on from there. (Basically one needs to copy the opencv Mat into the blob[0] object of the caffe network).

For any hints / advice I would be very grateful!

build_protobuf.sh contains absolute path cause compile failed

in file : /caffe-android-lib/scripts/build_protobuf.sh
it contains :
cmake -DCMAKE_TOOLCHAIN_FILE=
/android-cmake/android.toolchain.cmake..........

I think it should be :
cmake -DCMAKE_TOOLCHAIN_FILE=="${WD}/android-cmake/android.toolchain.cmake"....

Else, some build error will pop up

Use "main"

Hi,

In order to unit test the JNI I would like to compile and run it using the main function, are you able to use it for testing? How can this be done? I also noticed the mobile/main.cpp under caffe, what is the purpose of that testing?

Thanks

Different abis support

Hello.

Are you planing to support not only armeabi-v7a? I had tried to do that, i had replaced APP_ABI in Application.mk to armeabi, but had got this error:
Android NDK: ERROR:caffe-android-lib/caffe-mobile/jni/Android.mk:protobuf: LOCAL_SRC_FILES points to a missing file Android NDK: Check that caffe-android-lib/caffe-mobile/jni/../../protobuf/obj/local/armeabi/libprotobuf.a exists or that its path is correct

This happened because protobuf library is building only for armeabi-v7a, and i can't make it to build for another eabi.

Thanks in advance.

P.S. sorry for my bad English

Code crashes while calling native methods

I have been following
https://github.com/sh1r0/caffe-android-lib/blob/master/README.md
and as i run this
caffeMobile.loadModel(modelPath, weightsPath);

Code crashes with following logcat

04-20 18:06:07.692: D/dalvikvm(9250): Trying to load lib /data/data/com.example.caffendk/lib/libcaffe.so 0x41496e98
04-20 18:06:07.782: D/dalvikvm(9250): Added shared lib /data/data/com.example.caffendk/lib/libcaffe.so 0x41496e98
04-20 18:06:07.782: D/dalvikvm(9250): No JNI_OnLoad found in /data/data/com.example.caffendk/lib/libcaffe.so 0x41496e98, skipping init
04-20 18:06:07.782: D/dalvikvm(9250): Trying to load lib /data/data/com.example.caffendk/lib/libcaffe_jni.so 0x41496e98
04-20 18:06:07.792: D/dalvikvm(9250): Added shared lib /data/data/com.example.caffendk/lib/libcaffe_jni.so 0x41496e98
04-20 18:06:07.832: W/dalvikvm(9250): No implementation found for native Lcom/example/caffendk/CaffeMobile;.loadModel:(Ljava/lang/String;Ljava/lang/String;)I
04-20 18:06:07.832: D/AndroidRuntime(9250): Shutting down VM
04-20 18:06:07.832: W/dalvikvm(9250): threadid=1: thread exiting with uncaught exception (group=0x40a13300)

04-20 18:06:07.842: E/AndroidRuntime(9250): FATAL EXCEPTION: main
04-20 18:06:07.842: E/AndroidRuntime(9250): java.lang.UnsatisfiedLinkError: Native method not found: com.example.caffendk.CaffeMobile.loadModel:(Ljava/lang/String;Ljava/lang/String;)I
04-20 18:06:07.842: E/AndroidRuntime(9250): at com.example.caffendk.CaffeMobile.loadModel(Native Method)
04-20 18:06:07.842: E/AndroidRuntime(9250): at com.example.caffendk.MainActivity.onCreate(MainActivity.java:25)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.Activity.performCreate(Activity.java:5008)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.os.Handler.dispatchMessage(Handler.java:99)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.os.Looper.loop(Looper.java:137)
04-20 18:06:07.842: E/AndroidRuntime(9250): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-20 18:06:07.842: E/AndroidRuntime(9250): at java.lang.reflect.Method.invokeNative(Native Method)
04-20 18:06:07.842: E/AndroidRuntime(9250): at java.lang.reflect.Method.invoke(Method.java:511)
04-20 18:06:07.842: E/AndroidRuntime(9250): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-20 18:06:07.842: E/AndroidRuntime(9250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-20 18:06:07.842: E/AndroidRuntime(9250): at dalvik.system.NativeStart.main(Native Method)

I desperately need to run caffe on android, so can somebody suggest me what's going wrong.

Caffe Android lib build error

Now I tried to build the caffe android lib by using Mac osx 10.9.5 & android-ndk-r10d
steps I followed
1.git clone --recursive https://github.com/sh1r0/caffe-android-lib.git cloned the source from this command
2.In terminal moved inside to this directory caffe-android-lib
3. Run the ./build.py $(NDK_PATH) script

{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210
{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural

\f0\fs22 \cf0 \CocoaLigature0 ownloading boost 1.55.0 please wait...
curl: (3) malformed
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 357 100 357 0 0 52 0 0:00:06 0:00:06 --:--:-- 93
<html>\ <head>\ <title>302 Found</title>\ </head>\ <body>\ <h1>302 Found</h1>\ The resource was found at <a href="http://liquidtelecom.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2">http://liquidtelecom.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2</a>;\ you should be redirected automatically.\ \ \ </body>\ </html>Failed to download boost! Please download boost 1.55.0 manually\ and save it in this directory as boost_1_55_0.tar.bz2\ Android NDK: WARNING:/Users/hubmaci7/Pictures/Hubino/Jamal/caffe/caffe-android-lib/caffe-mobile/jni/Android.mk:caffe: non-system libraries in linker flags: -lboost_random-gcc-mt-1_55 -lboost_math_tr1-gcc-mt-1_55 -lboost_system-gcc-mt-1_55 -lboost_thread-gcc-mt-1_55 -lboost_date_time-gcc-mt-1_55 \ Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES \ Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the \ Android NDK: current module \ [armeabi-v7a] Compile++ arm : caffe <= caffe.pb.cc\ [armeabi-v7a] Compile++ arm : caffe <= blob.cpp\ [armeabi-v7a] Compile++ arm : caffe <= common.cpp\ In file included from /Users/hubmaci7/Pictures/Hubino/Jamal/caffe/caffe-android-lib/caffe-mobile/jni/caffe/src/caffe/common.cpp:6:0:\ /Users/hubmaci7/Pictures/Hubino/Jamal/caffe/caffe-android-lib/caffe-mobile/jni/caffe/include/caffe/util/rng.hpp:7:45: fatal error: boost/random/mersenne_twister.hpp: No such file or directory\ #include "boost/random/mersenne_twister.hpp"\ ^\ compilation terminated.\ make: *** [/Users/hubmaci7/Pictures/Hubino/Jamal/caffe/caffe-android-lib/caffe-mobile/obj/local/armeabi-v7a/objs/caffe/caffe/src/caffe/common.o] Error 1\ Hubs-Mac-mini:caffe-android-lib hubmaci7$ \ }

It showed error on downloading a boost.
So I downloaded boost_1_55_0.tar.bz2 manually and included into caffe-android-lib directory and extracted it. again
Run the ./build.py $(NDK_PATH) script
showed the same error

build_boost.sh contains absolute path cause compile failed

in file : /caffe-android-lib/scripts/build_boost.sh
it contains :
cmake -DCMAKE_TOOLCHAIN_FILE="
/test/caffe-android-lib/android-cmake/androi..........

I think it should be :
cmake -DCMAKE_TOOLCHAIN_FILE="${WD}/android-cmake

Else, some build error will pop up like:

Make Error at /usr/local/share/cmake-3.2/Modules/CMakeDetermineSystem.cmake:104 (message):
Could not find toolchain file:
~/test/caffe-android-lib/android-cmake/android.toolchain.cmake
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: /home/zz/compile/caffe-android-lib/boost/build/CMakeFiles/3.2.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR

forwarding consumes too much memory

hello , I have a dnn model whose size is only 30M40M,but when I use your lib to do the forwarding ,the memory consumption reach an unacceptible peak 2G3G .

could it be that I may not use it in a correct way? or is it the inborn problem of caffe?

Different results in caffe-android-lib and caffe-lib

Hi, All,

I'm so sorry that I got a different result during using caffe-android-lib.

My task is Classification, and I got the result in softmax layer in my android device which is below:
Label 0, Label 1, Label2, Label3
0.00697519, 0.0600692, 0.904507, 0.0284484

But meanwhile, I got the result in softmax layer in my computer by caffe-lib, is below:
Label 0, Label 1, Label2, Label3
0.008724 , 0.04197951, 0.93302566, 0.01627085

They both use the same model and the same test image.

I don't know if the dropout layer is useful during Test period.
So if there is a bug? Does any have the same problem?

Network outputs

Heya,

Might be a bit offtopic, but I'm trying to use a model based on GoogleNet with your lib and it's giving me an error: Caffe: Check failed: net_->num_outputs() == 1 Network should have exactly one output.

Probably has little to do with the lib and moreso with me, any ideas?

Unable to run .build.py $(NDK_PATH)

I tried to clone the Caffe-Android-Lib code and build it. Running git clone --recursive

Anyway, lately I noticed that included Boost-for-Android does not support NDK version 10d - 64bit. Therefore I added the version from the repository https://github.com/MysticTreeGames/Boost-for-Android.

When running ./build.py $(NDK_PATH), I first got an error and fixed it by running make all in folder caffe-android-lib/caffe-mobile/jni/caffe/ and then copying the following files:

cp -r caffe-android-lib/caffe-mobile/jni/caffe/.build_release/src/caffe/proto/* caffe-android-lib/caffe-mobile/jni/caffe/src/caffe/proto/

Then, after running ./build.py $(NDK_PATH) I got the following error:

Android NDK: WARNING:/usr/local/caffe-android-lib/caffe-mobile/jni/Android.mk:caffe: non-system libraries in linker flags: -lboost_random-gcc-mt-1_55 -lboost_math_tr1-gcc-mt-1_55 -lboost_system-gcc-mt-1_55 -lboost_thread-gcc-mt-1_55
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK:     current module
[armeabi-v7a] Compile++ arm  : caffe <= blob.cpp
In file included from /usr/local/caffe-android-lib/caffe-mobile/jni/caffe/include/caffe/blob.hpp:4:0,
                 from /usr/local/caffe-android-lib/caffe-mobile/jni/caffe/src/caffe/blob.cpp:1:
/usr/local/caffe-android-lib/caffe-mobile/jni/caffe/include/caffe/common.hpp:5:27: fatal error: gflags/gflags.h: No such file or directory
 #include <gflags/gflags.h>
                           ^
compilation terminated.
make: *** [/usr/local/caffe-android-lib/caffe-mobile/obj/local/armeabi-v7a/objs/caffe/caffe/src/caffe/blob.o] 

I tried to fix the error by running the following:

wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make 
sudo make install

Unfortunately, I haven't managed to come any further and haven't figured out the cause of the problem.

As I couldnt build the model with modified caffe version (Caffe-Android-Lib), I built the model with official caffe version and uploaded the files to sd card:

adb shell mkdir -p /sdcard/caffe_mobile/
adb push caffe/data/ilsvrc12/imagenet_mean.binaryproto /sdcard/caffe_mobile/
adb push caffe/models/bvlc_reference_caffenet/ /sdcard/caffe_mobile/bvlc_reference_caffenet/

When I tried to run caffe-android-demo, the app crashed with the following error:

com.sh1r0.caffe_android_demo A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1250 (AsyncTask #1)

I would appreciate if anyone could help out finding the cause of the problem and solve it.

Mean image

Thanks for provide android mobile sample code. But I have a question about the mean image.
From you source code, you didn't subtract the mean image while predicting. For bvlc_reference_caffenet model, it will subtract the mean image while training. Should you do the same thing while predicting?

Error in Build (Mac)

I am also receiving a similar error as the other post. Any idea on how I should go about fixing this? Thanks
I am trying to install this on a Macbook running Yosemite.
I also manually extracted the boost file and put it inside the Boost-for-Android folder.

Traceback (most recent call last):
File "./build.py", line 111, in
main(sys.argv[1:])
File "./build.py", line 106, in main
build_protobuf(ndk_build_)
File "./build.py", line 64, in build_protobuf
ndk_build()
File "./build.py", line 55, in ndk_build
call(['ndk-build', '-j', str(jobs)])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(popenargs, *kwargs).wait()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in init
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Error during ./build.py $(NDK_PATH)

whenever i try running ./build.py $(NDK_PATH) I get the following error :

Traceback (most recent call last):
File "./build.py", line 131, in
main(sys.argv[1:])
File "./build.py", line 120, in main
setup()
File "./build.py", line 36, in setup
call(['curl', '-O', PROTOBUF_URL])
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(_popenargs, *_kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 709, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Any help to solve this would be appreciated .

About Eigen calculation speed in android

Openblas is hard to compile in the form of JNI, and I use Eigen instead to calculate matrix multiplication in android 。directly use h file I compile Eigen to so file successfully。however,when calculating theresu of two matrix with dimension of 128_2028 and 2048_900 respectively in my phone HUAWEI glory 3C,the time consuming is about 1s,which is quite slow for me. I wonder if I use Eigen properly or misuse it which leads to the long time calculation? thanks!

Estimate of work for integrating data layer, solver, etc

You advised me that the remaining portions of caffe that were not integrated into caffe-android-lib were as follows:

src/caffe/layers/data_layer.cpp \

src/caffe/layers/hdf5_data_layer.cpp \

src/caffe/layers/hdf5_output_layer.cpp \

src/caffe/solver.cpp \

src/caffe/util/db.cpp \

src/caffe/util/math_functions.cpp

My project needs image_data_layer and thus data_layer, and we also use solvers. Do you have an idea of how much work would be required to be able to include the missing files? Is it just a matter of building hdf5 for Android? Have you attempted this and run into troubles?

Thanks,
Jeff

EDIT: What changes do I need to make to start trying to build these files and seeing the proper errors? I added them to Android.mk and got errors along the lines of:

/home/jbeorse/workspace/caffe-android-lib/caffe-mobile/jni/caffe/src/caffe/layers/data_layer.cpp:20:1: error: 'DataLayer' does not name a type
 DataLayer<Dtype>::~DataLayer<Dtype>() {

Which makes me assume I haven't included everything properly.

Is there anyway to compile codes in caffe tools folder so i can do training?

hello today i tried to add this into my Android.mk file so that i can compile caffe.cpp file, because i want to be able to train a network

$(CLEAR_VARS)

OpenCV_INSTALL_MODULES := on
OPENCV_CAMERA_MODULES := off
OPENCV_LIB_TYPE := STATIC
include $(REMOTE_PATH)/../../opencv/jni/OpenCV.mk

LOCAL_MODULE := caffe_tools

PRORO_CC := caffe/src/caffe/proto/caffe.pb.cc

LOCAL_SRC_FILES := $(PRORO_CC) caffe/tools/caffe.cpp

LOCAL_C_INCLUDES := $(REMOTE_PATH)/../../eigen3 \
    $(LOCAL_PATH)/caffe/include $(LOCAL_PATH)/caffe/include/caffe/proto \
    $(REMOTE_PATH)/../../Boost-for-Android/build/include/boost-1_55 \
    $(REMOTE_PATH)/../../opencv/jni/include \
    $(REMOTE_PATH)/../../../gflags/build/include

LOCAL_STATIC_LIBRARIES += gflags
LOCAL_SHARED_LIBRARIES := caffe
LOCAL_CPPFLAGS += -pthread -fPIC -fexceptions -frtti -std=c++11 -DUSE_EIGEN -DCPU_ONLY
LOCAL_LDLIBS += -lm -llog -L$(REMOTE_PATH)/../../../gflags/build/lib/
LOCAL_ARM_MODE := arm
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
LOCAL_ARM_NEON := true
endif

include $(BUILD_SHARED_LIBRARY)

i don't know if this is the right direction to make it able to train a network, i compiled gflags by myself and tried to link to it, but i got this error:

Error:error: undefined reference to 'google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'

for the 4 functions in caffe.cpp file, i think it's because the gflags is not build with Android platform, but i don't know what should i do now, any guide towards making it able to train a network?

Feature extraction

Thanks for the library. Is it possible extract features from different layers in the network?

Error while predicting

Hi
When i'm predicting a sample image an error throwing like this. I'm using a caffe model made by Nvidia Digits and googleNet net.

11-30 10:54:52.878: D/stderr(22880): [WARNING
11-30 10:54:52.878: D/stderr(22880): ] Unknown layer name data
11-30 10:54:52.879: A/libc(22880): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 22914 (AsyncTask #1)
11-30 10:54:52.879: A/libc(22880): Send stop signal to pid:22880 in void debuggerd_signal_handler(int, siginfo_t_, void_)
11-30 10:55:03.785: D/GraphicBuffer(22880): create handle(0x6084a2e0) (w:704, h:324, f:1)
11-30 10:55:03.790: D/dalvikvm(22880): threadid=13: interp stack at 0x63807000
11-30 10:55:03.790: D/dalvikvm(22880): init ref table
11-30 10:55:03.790: D/dalvikvm(22880): init mutex
11-30 10:55:03.807: D/GraphicBuffer(22880): create handle(0x63766e10) (w:736, h:1280, f:1)
11-30 10:55:03.834: D/GraphicBuffer(22880): create handle(0x637b3c98) (w:704, h:324, f:1)

Embedding model files into apk

Is there a way to embed the prototxt and caffemodel files into the apk file? The loadModel function seems to require a full path to the files, so adding files to the assets folder didn't work.
Thanks

Error while loading .so files

I tried to build the caffe libraries (libcaffe.so and libcaffe_jni.so) using eigen. The build was successful but while loading them into an android project i am getting the following error

cannot locate library reloc_library sigfillset.

Silmilar error also occured when loading libraries from github.com/sh1r0/caffe-android-demo repository. Some blogs suggested changing the android target version to 19 . I tried that but it didn't help. Original target was 21.

Suspected RAM insufficient problem

hi , I use your lib on my robot,but the app exits without any warning or information ,the RAM of the CPU is 1G .When I test the lib on my HUAWEI mate 8 ,whose RAM is 4G,everything was fine.

I traced the error and found that when the DNN is doing the forwarding : net_->ForwardFrom(0) ,the app crashes and exits .Loading DNN model was OK.

My problem is : does this means the robot cpu RAM runs out of RAM? how could I solve it apart from changing the cpus RAM ?

I compiled the lib using openblas

Share my experience OSX 10.10 Yosemite Boost 1.55.0 NDK r10e

0, the way to build is

./build.py path_to_your_ndk_folder

1, you need to download Boost by yourself and put it inside the Boost-for-Android folder, for details of building Boost-for-Android check Boost-for-Android share my experience.

2, if Boost-for-Android is successfully built, then you have files like "libboost_xx-gcc-mt-1_55.a" in "Boost-for-Android/build/lib" folder, now when you build again, you may have

warnings:

Android NDK: WARNING:/Users/ABC/Work/Libs/caffe-android-lib/caffe-mobile/jni/Android.mk:caffe: non-system libraries in linker flags: -lboost_random-gcc-mt-1_55 -lboost_math_tr1-gcc-mt-1_55 -lboost_system-gcc-mt-1_55 -lboost_thread-gcc-mt-1_55 -lboost_date_time-gcc-mt-1_55    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module

and errors:

[armeabi-v7a] Compile++ arm  : caffe <= math_functions_eigen.cpp
[armeabi-v7a] Compile++ arm  : caffe <= upgrade_proto.cpp
[armeabi-v7a] SharedLibrary  : libcaffe.so
./boost/exception/detail/type_info.hpp:68: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
./boost/exception/detail/type_info.hpp:68: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
./boost/exception/detail/type_info.hpp:68: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
./boost/exception/detail/type_info.hpp:68: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
./boost/atomic/detail/lockpool.hpp:36: error: undefined reference to 'boost::atomics::detail::lockpool::get_lock_for(void const volatile*)'
./boost/atomic/detail/lockpool.hpp:36: error: undefined reference to 'boost::atomics::detail::lockpool::get_lock_for(void const volatile*)'
./boost/atomic/detail/lockpool.hpp:36: error: undefined reference to 'boost::atomics::detail::lockpool::get_lock_for(void const volatile*)'
./boost/atomic/detail/lockpool.hpp:36: error: undefined reference to 'boost::atomics::detail::lockpool::get_lock_for(void const volatile*)'
collect2: error: ld returned 1 exit status
make: *** [/Users/ABC/Work/Libs/caffe-android-lib/caffe-mobile/obj/local/armeabi-v7a/libcaffe.so] Error 1

The reason for the warning is because the Boost-for-Android libraries built right now are static libraries, but in "caffe-mobile/jni/Android.mk" file, it uses "LOCAL_LDLIBS += ..." to link these static libraries,

#LOCAL_LDLIBS += -lboost_random-gcc-mt-1_55 \                                      
                -lboost_math_tr1-gcc-mt-1_55 \                                     
                -lboost_system-gcc-mt-1_55 \                                       
                -lboost_thread-gcc-mt-1_55 \                                       
                -lboost_date_time-gcc-mt-1_55

which i guess could be wrong. So i comment these lines and the correct way to link static libraries in Android.mk file is first:

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := ANameYouLike                                                    
LOCAL_SRC_FILES := PathToTheStaticLibFolder/lib***.a
include $(PREBUILT_STATIC_LIBRARY)

then link to it:

include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := ANameYouLike
include $(BUILD_SHARED_LIBRARY)

Above gives an example to link to one static library, now we need to link to multiple static libraries, then have to repeat

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := ANameYouLike                                                    
LOCAL_SRC_FILES := PathToTheStaticLibFolder/lib***.a
include $(PREBUILT_STATIC_LIBRARY)

multiple times and then link to all of them

include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES += ANameYouLike1 ANameYouLike2
include $(BUILD_SHARED_LIBRARY)

So finally the corresponding part in my Android.mk file are:

# C++ full library                                                              
# =======================================================                       
## Import Protocolbuffer                                                        
include $(CLEAR_VARS)                                                           
LOCAL_MODULE := protobuf                                                        
LOCAL_SRC_FILES = $(LOCAL_PATH)/../../protobuf/obj/local/$(TARGET_ARCH_ABI)/libprotobuf.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../protobuf/jni/src                 
include $(PREBUILT_STATIC_LIBRARY)                                              

## Import Boost                                                                 
include $(CLEAR_VARS)                                                                               
LOCAL_MODULE := boost_random                                                    
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../Boost-for-Android/build/lib/libboost_random-gcc-mt-1_55.a
include $(PREBUILT_STATIC_LIBRARY)                                              

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := boost_math_tr1                                                  
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../Boost-for-Android/build/lib/libboost_math_tr1-gcc-mt-1_55.a
include $(PREBUILT_STATIC_LIBRARY)                                              

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := boost_system                                                    
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../Boost-for-Android/build/lib/libboost_system-gcc-mt-1_55.a
include $(PREBUILT_STATIC_LIBRARY)                                                                                                                             

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := boost_thread                                                    
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../Boost-for-Android/build/lib/libboost_thread-gcc-mt-1_55.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := boost_date_time                                                 
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../Boost-for-Android/build/lib/libboost_date_time-gcc-mt-1_55.a
include $(PREBUILT_STATIC_LIBRARY)                                              

include $(CLEAR_VARS)                                                           
LOCAL_MODULE := boost_atomic                                                    
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../Boost-for-Android/build/lib/libboost_atomic-gcc-mt-1_55.a
include $(PREBUILT_STATIC_LIBRARY)

and

LOCAL_STATIC_LIBRARIES += protobuf                                              
LOCAL_CPPFLAGS += -pthread -fPIC -fexceptions -frtti -std=c++11 -DUSE_EIGEN -DCPU_ONLY

# boost                                                                         
LOCAL_LDLIBS += -lm -llog -L$(LOCAL_PATH)/../../Boost-for-Android/build/lib/    
#LOCAL_LDLIBS += -lboost_random-gcc-mt-1_55 \                                   
                -lboost_math_tr1-gcc-mt-1_55 \                                  
                -lboost_system-gcc-mt-1_55 \                                    
                -lboost_thread-gcc-mt-1_55 \                                    
                -lboost_date_time-gcc-mt-1_55 \                                 
                -lboost_atomic-gcc-mt-1_55                                      
LOCAL_STATIC_LIBRARIES += boost_random boost_math_tr1 boost_system boost_thread boost_date_time boost_atomic

the correct way of linking static libraries will get rid of the warning and errors involved "type_info.hpp", adding link to "libboost_atomic-gcc-mt-1_55.a" will get rid of the error involved "lockpool.hpp".

After these steps, i can finally build successfully with "libcaffe.so" and "libcaffe_jni.so" generated in folder "caffe-mobile/libs/armeabi-v7a".

How to get the confidence of my prediction?

For example in python I do:

prediction = mNet.predict([image])
print prediction

And the output is:
[[ 0.32693869 0.20242123 0.26447725 0.20616281]]

How do I get it on caffe-mobile?

Thanks, you are doing a great work!!

Different classification result because of deploy.prototxt?

I tried to classify some imageNet image using AlexNet and it gives different result using deploy.prototxt and train_test.prototxt. Is it because in train_test.prototxt, it uses a crop_size 277 in transform_param but not used in deploy.prototxt or deploy_mobile.prototxt?

cannot install openblas through ./scripts/build_openblas_hard.sh

I am using ubuntu and run the build through ./scripts/build_openblas_hard.sh

The build went through successfully. but the script didn't generate any libraries in ./android_lib/.
Then I got the following error:

 OpenBLAS build complete. (BLAS CBLAS)

  OS               ... Android
  Architecture     ... arm
  BINARY           ... 32bit
  C compiler       ... GCC  (command line : /home/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/home/android-ndk-r10e/platforms/android-21/arch-arm)
  Fortran compiler ... GFORTRAN  (command line : gfortran)
  Library Name     ... libopenblas_armv7p-r0.2.16.dev.a (Multi threaded; Max num-threads is 8)

 Use OpenMP in the multithreading. Because of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags,
 you should use OMP_NUM_THREADS environment variable to control the number of threads.


To install the library, you can run "make PREFIX=/path/to/your/installation install".

./getarch: 1: ./getarch: Syntax error: word unexpected (expecting ")")
make: *** [config.h] Error 2
make -f Makefile.install install
make[1]: Entering directory `/android/OpenBLAS'
Generating openblas_config.h in /android/android_lib/openblas-hard/include
Generating f77blas.h in /android/android_lib/openblas-hard/include
Generating cblas.h in /android/android_lib/openblas-hard/include
Copying LAPACKE header files to /android/android_lib/openblas-hard/include
Copying the static library to /android/android_lib/openblas-hard/lib
install: cannot stat 'libopenblas_armv7-r0.2.16.dev.a': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/android/OpenBLAS'
make: *** [install] Error 2

Cannot build - boost_chrono not found

Hi

I desperately tried to build the caffe-android-lib for arm64-v8a architecture but always get this error (I tried with both master and dev branch). I build on OSX El Capitan, ndk-r10e.

`CMake Error at /usr/local/Cellar/cmake/3.5.0/share/cmake/Modules/FindBoost.cmake:1647 (message):
Unable to find the requested Boost libraries.

Boost version: 1.56.0

Boost include path:
/Users/sladomic/caffe-android-lib/android_lib/boost/include

Could not find the following Boost libraries:

      boost_chrono

Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
cmake/Dependencies.cmake:5 (find_package)
CMakeLists.txt:63 (include)

-- Found GFlags: /Users/sladomic/caffe-android-lib/android_lib/gflags/include
-- Found gflags (include: /Users/sladomic/caffe-android-lib/android_lib/gflags/include, library: /Users/sladomic/caffe-android-lib/android_lib/gflags/lib/libgflags.a)
-- Found PROTOBUF: /Users/sladomic/caffe-android-lib/android_lib/protobuf/lib/libprotobuf.a
-- Found PROTOBUF Compiler: /Users/sladomic/caffe-android-lib/android_lib/protobuf_host/bin/protoc
-- Found LMDB: /Users/sladomic/caffe-android-lib/android_lib/lmdb/include
-- Found lmdb (include: /Users/sladomic/caffe-android-lib/android_lib/lmdb/include, library: /Users/sladomic/caffe-android-lib/android_lib/lmdb/lib/liblmdb.a)
-- -- CUDA is disabled. Building without it...
-- OpenCV found (/Users/sladomic/caffe-android-lib/android_lib/opencv/sdk/native/jni)
-- Found EIGEN include: /Users/sladomic/caffe-android-lib/android_lib/eigen3
-- Python interface is disabled or not all required dependencies found. Building without it...

-- Could NOT find Git (missing: GIT_EXECUTABLE)

-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0-rc3
-- Git : unknown
-- System : Android
-- C++ compiler : /Users/sladomic/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++
-- Release CXX flags : -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -fexceptions -frtti -Wno-psabi --sysroot=/Users/sladomic/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -fopenmp -std=c++11 -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -fexceptions -frtti -Wno-psabi --sysroot=/Users/sladomic/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -fopenmp -std=c++11 -fPIC -Wall -Wno-sign-compare -Wno-uninitialized

-- Build type : Release

-- BUILD_SHARED_LIBS : ON
-- BUILD_python : OFF
-- BUILD_matlab : OFF
-- BUILD_docs : OFF
-- CPU_ONLY : ON
-- USE_OPENCV : ON
-- USE_LEVELDB : OFF
-- USE_LMDB : ON
-- ALLOW_LMDB_NOLOCK : OFF
-- USE_HDF5 : OFF

-- USE_GLOG : OFF

-- Dependencies:
-- BLAS : Yes (eigen)
-- Boost : Yes (ver. 1.56)
-- gflags : Yes
-- protobuf : Yes (ver. 3.0.0)
-- lmdb : Yes (ver. 0.9.70)
-- OpenCV : Yes (ver. 3.1.0)

-- CUDA : No

-- Install:

-- Install path : /Users/sladomic/caffe-android-lib/android_lib/caffe

-- Configuring incomplete, errors occurred!
See also "/Users/sladomic/caffe-android-lib/caffe/build/CMakeFiles/CMakeOutput.log".`

Can I somehow copy the boost_chrono from somewhere else or do I need to change something in the build script?

Thanks,
Michael

error ndk-build

Hi! After installing cygwin64 with tar and curl I still got this problem (Windows 10 64bit).

Bonaventura@Ventura /cygdrive/c/Users/Bonaventura/Desktop/caffe-android-lib-master/caffe-android-lib-master
$ ./build.py C:\Users\Bonaventura\AppData\Local\Android\sdk1\ndk-bundle
Traceback (most recent call last):
File "./build.py", line 111, in
main(sys.argv[1:])
File "./build.py", line 106, in main
build_protobuf(ndk_build_)
File "./build.py", line 64, in build_protobuf
ndk_build()
File "./build.py", line 55, in ndk_build
call(['ndk-build', '-j', str(jobs)])
File "C:\Users\Bonaventura\Anaconda\lib\subprocess.py", line 522, in call
return Popen(_popenargs, *_kwargs).wait()
File "C:\Users\Bonaventura\Anaconda\lib\subprocess.py", line 710, in init
errread, errwrite)
File "C:\Users\Bonaventura\Anaconda\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] Impossibile trovare il file specificato

My ndk-build works

$ ndk-build
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/c/Users/Bonaventura/AppData/Local/Android/sdk1/ndk-bundle/build/core/build-local.mk:143: *** Android NDK: Aborting . Arresto.

Redistribution and Licensing

I work on Open Data Kit at the University of Washington. Here's a link to our homepage and to source code for most of our projects.

We are interested in using your library in our ODK Scan project. Here's a link to the source, but be aware that this is not yet in beta. In short, ODK Scan improves data collection in the field by letting users parse paper forms with an Android device. You take a picture of the form and ODK Scan extracts responses from bubbles, number boxes, etc. It also integrates with our other ODK tools that make it easy to collect, visualize, and sync your data with the cloud.

We have written an improved number classifier that depends on the Caffe library and had great results with training and classification in a desktop environment. Now that we are transitioning classification to the Android device, we are hoping to build from the work you've done here.

If we credit you and link to this source, are you open to us packaging your code, with our modifications, in our APK? Do you use a particular license, like the one Caffe is using: https://github.com/BVLC/caffe/blob/master/LICENSE ? If we make modifications, would you like us to work together to possibly contribute back here?

Please let me know if you have any questions about us or how we would be using your code. Also, I've got some questions about what Caffe functionality has been ported, what isn't supported, and what kind of work would need to be done to add some of the unsupported features. I'd love to have a conversation about this.

Jeff Beorse
[email protected]

Error during ./build.py $(NDK_PATH)

I tried to solve the this error, but I can not find the solution for this error.
I checked the issue #8 , so I tried "g:/test/android-ndk-r10e", g:/test/android-ndk-r10e, "g:\test\android-ndk-r10e".

My Os is windows 8.1 64bit.

image

G:\test\caffe-android-lib>set NDK_ROOT=g:/test/android-ndk-r10e

G:\test\caffe-android-lib>echo %NDK_ROOT%
g:/test/android-ndk-r10e

G:\test\caffe-android-lib>build.py %NDK_ROOT%
Traceback (most recent call last):
File "G:\test\caffe-android-lib\build.py", line 111, in
main(sys.argv[1:])
File "G:\test\caffe-android-lib\build.py", line 101, in main
setup()
File "G:\test\caffe-android-lib\build.py", line 31, in setup
call(['curl', '-O', PROTOBUF_URL])
File "C:\Python27\lib\subprocess.py", line 522, in call
return Popen(_popenargs, *_kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 710, in init
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2]

G:\test\caffe-android-lib>build.py $(NDK_ROOT)
Traceback (most recent call last):
File "G:\test\caffe-android-lib\build.py", line 111, in
main(sys.argv[1:])
File "G:\test\caffe-android-lib\build.py", line 101, in main
setup()
File "G:\test\caffe-android-lib\build.py", line 31, in setup
call(['curl', '-O', PROTOBUF_URL])
File "C:\Python27\lib\subprocess.py", line 522, in call
return Popen(_popenargs, *_kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 710, in init
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2]

compile caffe-android-lib with a cv::SVM

Hey

I'm quite interested in your code, thanks for sharing it. I wanted to use a self trained opencv support vector machine (cv::SVM) for classfiying images.

I added some cv::SVM to the CaffeMobile.cpp file. However for compiling the code I need to call
./build.sh <path/to/ndk>
Unfortunately it gives me an error saying:
error: undefined reference to 'cv::ml::SVM::create()'

or more detailed:

CMakeFiles/caffe_jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function cv::Ptr<cv::ml::SVM> cv::Algorithm::load<cv::ml::SVM>(cv::String const&, cv::String const&): error: undefined reference to 'cv::ml::SVM::create()'
CMakeFiles/caffe_jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'cv::ml::SVM::create()' collect2: error: ld returned 1 exit status make[2]: *** [lib/libcaffe_jni.so] Error 1 make[1]: *** [android/CMakeFiles/caffe_jni.dir/all] Error 2 make: *** [all] Error 2
I guess I need to link opencv_ml somewhere, but I don't really understand how the compiling is done, so I don't know where I should add this library for the building process.

Can you help me / give me a hint how to do that?
Any help would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.