sh1r0 / caffe-android-demo Goto Github PK
View Code? Open in Web Editor NEWAn android caffe demo app exploiting caffe pre-trained ImageNet model for image classification
Home Page: https://github.com/sh1r0/caffe-android-lib
License: MIT License
An android caffe demo app exploiting caffe pre-trained ImageNet model for image classification
Home Page: https://github.com/sh1r0/caffe-android-lib
License: MIT License
I push another model to my android device and change the 'synset_words.txt' file . But after i reinstall the app and try to launch it . It crashed. The error log is as follows:
11-10 10:57:39.464 2589-2589/? E/NativeLibraryUtils: Unable to locate gmscore in dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/com.android.location.provider.jar", zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/data/app/com.google.android.gms-2/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.gms-2/lib/arm, /vendor/lib64, /system/lib64]]]
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.google.android.gms-2/lib/arm/libgmscore.so" is 32-bit instead of 64-bit
at java.lang.Runtime.loadLibrary(Runtime.java:383)
at java.lang.System.loadLibrary(System.java:997)
at hyb.b(:com.google.android.gms:885)
at com.google.android.gms.common.security.ProviderInstallerImpl.a(:com.google.android.gms:202)
at com.google.android.gms.common.security.ProviderInstallerImpl.insertProvider(:com.google.android.gms:1170)
at com.google.android.gms.common.security.ProviderInstallerImpl.insertProviderGated(:com.google.android.gms:101)
at com.google.android.gms.common.app.GmsApplication.onCreate(:com.google.android.gms:203)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
at android.app.LoadedApk.makeApplication(LoadedApk.java:615)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2728)
at android.app.ActivityThread.access$2100(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5669)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
In Run of studio:
$ adb shell am start -n "com.sh1r0.caffe_android_demo/com.sh1r0.caffe_android_demo.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Connected to process 12290 on device Galaxy_Nexus_API_22 [emulator-5554]
Connected to process 12290 on device Galaxy_Nexus_API_22 [emulator-5554]
Connected to process 12290 on device Galaxy_Nexus_API_22 [emulator-5554]
Connected to process 12290 on device Galaxy_Nexus_API_22 [emulator-5554]
Connected to process 12290 on device Galaxy_Nexus_API_22 [emulator-5554]
Application terminated.
In Android Monitor:
05-11 11:52:07.474 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 fc6 does not need backward computation.
05-11 11:52:07.474 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 pool5 does not need backward computation.
05-11 11:52:07.474 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 relu5 does not need backward computation.
05-11 11:52:07.474 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 conv5 does not need backward computation.
05-11 11:52:07.474 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 relu4 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 conv4 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 relu3 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 conv3 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 norm2 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 pool2 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 relu2 does not need backward computation.
05-11 11:52:07.475 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 conv2 does not need backward computation.
05-11 11:52:07.476 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 norm1 does not need backward computation.
05-11 11:52:07.497 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 pool1 does not need backward computation.
05-11 11:52:07.498 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 relu1 does not need backward computation.
05-11 11:52:07.499 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:230 conv1 does not need backward computation.
05-11 11:52:07.499 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:272 This network produces output prob
05-11 11:52:07.500 12630-12630/com.sh1r0.caffe_android_demo I/native: net.cpp:285 Network initialization done.
05-11 11:52:21.038 12630-12630/com.sh1r0.caffe_android_demo I/native: upgrade_proto.cpp:42 Attempting to upgrade input file specified using deprecated transformation parameters: /data/caffe_mobile/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
05-11 11:52:21.042 12630-12630/com.sh1r0.caffe_android_demo I/native: upgrade_proto.cpp:45 Successfully upgraded file specified using deprecated data transformation parameters.
05-11 11:52:21.042 12630-12630/com.sh1r0.caffe_android_demo W/native: upgrade_proto.cpp:47 Note that future Caffe releases will only support transform_param messages for transformation fields.
05-11 11:52:21.045 12630-12630/com.sh1r0.caffe_android_demo I/native: upgrade_proto.cpp:51 Attempting to upgrade input file specified using deprecated V1LayerParameter: /data/caffe_mobile/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
after this, the app stops, and I can not find any prompt of error, so what happened? I run this demo is KVM.
Thank you!
Hi
I am trying to test the caffe-android-demo app, but it's giving me this error. Any idea what's the root cause for this?
03-26 20:21:53.548 6416-6416/? E/art: dlopen("/data/app/com.sh1r0.caffe_android_demo_1_garbage-1/lib/arm64/libcaffe_jni.so", RTLD_LAZY) failed: dlopen failed: could not load library "libcaffe.so.1.0.0-rc3" needed by "/data/app/com.sh1r0.caffe_android_demo_1_garbage-1/lib/arm64/libcaffe_jni.so"; caused by library "libcaffe.so.1.0.0-rc3" not found 03-26 20:21:53.548 6416-6416/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.sh1r0.caffe_android_demo_1_garbage, PID: 6416 java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libcaffe.so.1.0.0-rc3" needed by "/data/app/com.sh1r0.caffe_android_demo_1_garbage-1/lib/arm64/libcaffe_jni.so"; caused by library "libcaffe.so.1.0.0-rc3" not found at java.lang.Runtime.loadLibrary(Runtime.java:371) at java.lang.System.loadLibrary(System.java:989) at com.sh1r0.caffe_android_demo.MainActivity.<clinit>(MainActivity.java:147) at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.Class.newInstance(Class.java:1572) at android.app.Instrumentation.newActivity(Instrumentation.java:1065) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2204) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363) at android.app.ActivityThread.access$800(ActivityThread.java:147) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5234) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
I am new to Android development and I've been trying to run the demo on eclipse.
I get the following err:
08-06 13:55:34.822: E/AndroidRuntime(23010): FATAL EXCEPTION: main
08-06 13:55:34.822: E/AndroidRuntime(23010): Process: com.sh1r0.caffe_android_demo, PID: 23010
08-06 13:55:34.822: E/AndroidRuntime(23010): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.sh1r0.caffe_android_demo/com.sh1r0.caffe_android_demo.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.sh1r0.caffe_android_demo.MainActivity" on path: DexPathList[[zip file "/data/app/com.sh1r0.caffe_android_demo-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.sh1r0.caffe_android_demo-1, /vendor/lib, /system/lib]]
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2131)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2255)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.ActivityThread.access$800(ActivityThread.java:142)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.os.Handler.dispatchMessage(Handler.java:102)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.os.Looper.loop(Looper.java:136)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.ActivityThread.main(ActivityThread.java:5118)
08-06 13:55:34.822: E/AndroidRuntime(23010): at java.lang.reflect.Method.invokeNative(Native Method)
08-06 13:55:34.822: E/AndroidRuntime(23010): at java.lang.reflect.Method.invoke(Method.java:515)
08-06 13:55:34.822: E/AndroidRuntime(23010): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
08-06 13:55:34.822: E/AndroidRuntime(23010): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
08-06 13:55:34.822: E/AndroidRuntime(23010): at dalvik.system.NativeStart.main(Native Method)
08-06 13:55:34.822: E/AndroidRuntime(23010): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sh1r0.caffe_android_demo.MainActivity" on path: DexPathList[[zip file "/data/app/com.sh1r0.caffe_android_demo-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.sh1r0.caffe_android_demo-1, /vendor/lib, /system/lib]]
08-06 13:55:34.822: E/AndroidRuntime(23010): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-06 13:55:34.822: E/AndroidRuntime(23010): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
08-06 13:55:34.822: E/AndroidRuntime(23010): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
08-06 13:55:34.822: E/AndroidRuntime(23010): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
08-06 13:55:34.822: E/AndroidRuntime(23010): ... 11 more
Hi! I wanted to take a look at your app but i have some problem with the model files. It looks like I'm using the wrong ones. Could you link the files you are using?
Thanks!
EDIT: It seems that it's not the model files. The caffe version doesn't have the AddImagesAndLabels method.
I can use the demo, but when I changed the net architecture(also changed the caffemodel) like:
layer {
name: "conv1_v"
type: "Convolution"
bottom: "data"
top: "conv1_v"
convolution_param {
num_output: 8
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0.0
}
pad_h: 3
pad_w: 0
kernel_h: 7
kernel_w: 1
stride_h: 1
stride_w: 1
}
}
The demo failed,and show that:
layer {
name: "conv4_h"
type: "Convolution"
bottom: "conv4_v"
top: "conv4"
convolution_param {
num_output: 384
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
pad_h: 0
05-26 14:08:53.387 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 1216512
05-26 14:08:53.388 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 15814656
05-26 14:08:53.388 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 30412800
05-26 14:08:53.389 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 37863168
05-26 14:08:53.389 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 41588352
05-26 14:08:53.390 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 43140512
05-26 14:08:53.392 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 53074336
05-26 14:08:53.393 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 63008160
05-26 14:08:53.393 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 68076960
05-26 14:08:53.393 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 70611360
05-26 14:08:53.401 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 71205360
05-26 14:08:53.411 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 75006960
05-26 14:08:53.411 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 78808560
05-26 14:08:53.411 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 80786928
05-26 14:08:53.412 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 81776112
05-26 14:08:53.422 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 82033712
05-26 14:08:53.430 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 83022896
05-26 14:08:53.430 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 84012080
05-26 14:08:53.456 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 84527280
05-26 14:08:53.469 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 85186736
05-26 14:08:53.469 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 85846192
05-26 14:08:53.490 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 86361392
05-26 14:08:53.503 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 87020848
05-26 14:08:53.503 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 87680304
05-26 14:08:53.505 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 87803952
05-26 14:08:53.505 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 88133680
05-26 14:08:53.506 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 88463408
05-26 14:08:53.506 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 88587056
05-26 14:08:53.507 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 88916784
05-26 14:08:53.508 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 89246512
05-26 14:08:53.508 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 89259392
05-26 14:08:53.508 5263-5263/com.sh1r0.caffe_android_demo I/native: net.cpp:167 Memory required for data: 89308336
What happened?I changed the kernel size(pad and stride) not be square,and can run in PC caffe,but failed in your demo. Thank you for your help.
I'm getting a file not found error..
Check failed: fd != -1 (-1 vs. -1) File not found: /storage/emulated/0/caffe_mobile/plantClassification/weights.caffemodel
I have a model file, the file cannot be loaded. Model file look like this
layer {
name: "data"
type: "MemoryData"
top: "data"
top: "label"
include {
phase: TEST
}
memory_data_param {
batch_size: 1
channels: 3
height: 48
width: 64
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1.0
}
param {
lr_mult: 2.0
}
convolution_param {
num_output: 20
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
I passing path from android to jni. Path look like /storage/emulated/0/Download/smile_deploy.prototxt.
I have an issue in that line:
caffe_net = new Net(model_path, caffe::TEST);
Thank you
hi:
I build libcaffe.so and libcaffe_jni.so with cmake 3.5.2 ,ndk r11c,and master branch of caffe-android-lib. I set $ANDROID_ABI=x86_64, and finally get the .SO compiled.
Then I copy libcaffe.so and libcaffe_jni.so to the path caffe-android-demo/app/src/main/jniLibs/x86_64, and debug the app with androidStudio 2.1 and a x86_64 emulator (api level 22). I use ndk r11c in androidStudio by setting the path of ndk in project structure.
I use jdk1.8.0_101 in both compile tasks.
When then CNNTask start,in function
public int[] predictImage(String imgPath) {
//return predictImage(imgPath, 1);
return predictImage("/storage/sdcard/Pictures/Caffe-Android-Demo/cat.jpg",1);
}
I get a JNI error like this:
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: jarray argument has non-array type: java.lang.String
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] in call to GetByteArrayElements
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] from int[] com.sh1r0.caffe_android_lib.CaffeMobile.predictImage(java.lang.String, int)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] "AsyncTask #1" prio=5 tid=15 Runnable
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x12c07fa0 self=0x7f5333ca5800
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] | sysTid=11287 nice=10 cgrp=default sched=0/0 handle=0x7f532a449000
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] | state=R schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] | stack=0x7f52ddafe000-0x7f52ddb00000 stackSize=1036KB
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #00 pc 00006f79 /system/lib64/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned long, ucontext_)+57)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #1 pc 00399a20 /system/lib64/libart.so (art::DumpNativeStack(std::_1::basic_ostream<char, std::1::char_traits >&, int, char const, art::mirror::ArtMethod)+96)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #2 pc 003682e7 /system/lib64/libart.so (art::Thread::Dump(std::1::basic_ostream<char, std::1::char_traits >&) const+215)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #3 pc 0010ff62 /system/lib64/libart.so (art::JniAbort(char const, char const)+946)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #4 pc 001109ec /system/lib64/libart.so (art::JniAbortF(char const, char const, ...)+220)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #5 pc 00114ddc /system/lib64/libart.so (art::ScopedCheck::Check(bool, char const, ...) (.constprop.133)+1196)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #6 pc 00119f1a /system/lib64/libart.so (art::CheckJNI::GetByteArrayElements(JNIEnv, jbyteArray, unsigned char*)+74)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #7 pc 0000c0c3 /data/app/com.sh1r0.caffe_android_demo-2/lib/x86_64/libcaffe_jni.so (imgbuf2mat+51)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #8 pc 0000c344 /data/app/com.sh1r0.caffe_android_demo-2/lib/x86_64/libcaffe_jni.so (getImage+132)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #9 pc 0000c925 /data/app/com.sh1r0.caffe_android_demo-2/lib/x86_64/libcaffe_jni.so (Java_com_sh1r0_caffe_1android_1lib_CaffeMobile_predictImage+69)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #10 pc 000013a4 /data/data/com.sh1r0.caffe_android_demo/cache/slice-slice_7-classes.dex (Java_com_sh1r0_caffe_1android_1lib_CaffeMobile_predictImage__Ljava_lang_String_2I+216)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] native: #11 pc 00100e7f stack:11287
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at com.sh1r0.caffe_android_lib.CaffeMobile.predictImage(Native method)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at com.sh1r0.caffe_android_lib.CaffeMobile.predictImage(CaffeMobile.java:35)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at com.sh1r0.caffe_android_demo.MainActivity$CNNTask.doInBackground(MainActivity.java:173)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at com.sh1r0.caffe_android_demo.MainActivity$CNNTask.doInBackground(MainActivity.java:162)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at android.os.AsyncTask$2.call(AsyncTask.java:292)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65] at java.lang.Thread.run(Thread.java:818)
09-21 22:57:50.069 10464-11287/com.sh1r0.caffe_android_demo A/art: art/runtime/check_jni.cc:65]
09-21 22:57:50.089 10464-11287/com.sh1r0.caffe_android_demo A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1c in tid 11287 (AsyncTask #1)
But when I use the x86_64 lib shipped with caffe-mobile-demo, it works well.
Can you describe how you build the .SO in this demo project?
I have met this error,but I can't fix it.
D/dalvikvm: Trying to load lib /data/app-lib/com.sh1r0.caffe_android_demo-1/libcaffe.so 0x4187f858
W/linker: cannot locate symbol "sigfillset" referenced by "libcaffe.so"...
W/linker: error:
E/dalvikvm: dlopen("/data/app-lib/com.sh1r0.caffe_android_demo-1/libcaffe.so") failed: dlopen failed:
W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/sh1r0/caffe_android_demo/MainActivity;
W/dalvikvm: Class init failed in newInstance call (Lcom/sh1r0/caffe_android_demo/MainActivity;)
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41581c50)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sh1r0.caffe_android_demo, PID: 6843
java.lang.UnsatisfiedLinkError: dlopen failed:
at java.lang.Runtime.loadLibrary(Runtime.java:364)
at java.lang.System.loadLibrary(System.java:555)
at com.sh1r0.caffe_android_demo.MainActivity.(MainActivity.java:57)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1064)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2264)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2397)
at android.app.ActivityThread.access$1100(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5398)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
We added a loop around the call to the NN in MainActivity.java, and switched the NN call to getConfidenceScore in order to get the NN vector back into the Java.
We found that the values returned by the NN are sometimes inconsistent from a previous call with the same input data.
This behaviour is very frequent on HTC One M9 which uses Snapdragon chipset.
On other devices it sometimes occurs but to a lesser degree.
After several calls to the NN, the output vector is sometimes quite far from its correct value.
Sometimes the network starts returning NaN. At this point it is in a state where it does not return to processing correctly, and only returns NaN thereafter. We have only observed the NaNs on HTC One M9. Other devices have shown less frequent deviations in the output vector values, however they haven't returned NaN.
@Override
protected Integer doInBackground(String... strings) {
startTime = SystemClock.uptimeMillis();
float[] lastScores = new float[0];
for (int i = 0; i < 20; i++) {
System.out.println("Iteration " + i);
float[] scores = caffeMobile.getConfidenceScore(strings[0]);
for (int j = 0; j < lastScores.length; j++) {
if (scores[j] != lastScores[j]) {
System.out.println("Found inconsistency: " + i + " " + j + ", " + scores[j] + " " + lastScores[j] + " " + Arrays.asList(scores) + " " + Arrays.asList(lastScores));
}
}
lastScores = scores;
}
return caffeMobile.predictImage(strings[0])[0];
}
Here is the output that comes from the network over a few loops:
Iteration | Value of first index of vector |
---|---|
0 | 3.1437678E-5 |
1 | 2.0848423E-5 |
2 | 3.1718344E-5 |
3 | 3.204372E-5 |
4 | 3.1441232E-5 |
5 | 3.11287E-5 |
6 | 3.1445536E-5 |
7 | 3.0625208E-5 |
8 | 3.1417538E-5 |
9 | 3.1448155E-5 |
10 | NaN |
11 | NaN |
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load caffe: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
I just download your project and run it .
I'm trying another model but app crashes.
Error is below.
08-29 00:37:35.500 16776-17047/com.sh1r0.caffe_android_demo A/caffe_jni: F0829 00:37:35.500212 17047 syncedmem.hpp:25] Check failed: *ptr host allocation of size 568295424 failed
08-29 00:37:35.500 16776-17047/com.sh1r0.caffe_android_demo A/caffe_jni: terminating.
08-29 00:37:35.500 16776-17047/com.sh1r0.caffe_android_demo A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 17047 (AsyncTask #1)
I think that the cause is out of memory and I should modify deploy.prototxt such that the mini batch size.
How to modify batch size?
Thank you in advance.
looking at your demo code. it looks like you take the picture directly from the phone camera and send it to caffe to predict. in my case, the image size from my camera on nexus 6 is 4160 x 3120, but the crop size is only specified as 227.
so how does this work? does caffe automatically resize the image from 4160 x 3120 to something smaller?
if there is no resize, how does the crop of 227 happens? i assume that's 227 x 227. is that in the middle of the image?
my concern is that if it's in the middle and there is no resize, then 227 x 227 is a really small part of the entire image of 4160 x 3120.
any comment is much appreciated.
10-28 15:43:55.966 26041-26041/com.sh1r0.caffe_android_demo D/MainActivity﹕ /storage/emulated/0/Pictures/Caffe-Android-Demo/IMG_20151028_154348.jpg
10-28 15:43:55.966 26041-26041/com.sh1r0.caffe_android_demo D/MainActivity﹕ 4160
10-28 15:43:55.966 26041-26041/com.sh1r0.caffe_android_demo D/MainActivity﹕ 3120
transform_param {
crop_size: 227
mean_value: 104
mean_value: 117
mean_value: 123
mirror: false
}
I have tried to run this demo on a new project,but failed......
The error message is:
E/art: No implementation found for int caffe_android_lib.CaffeMobile.loadModel(java.lang.String, java.lang.String) (tried Java_caffe_1android_1lib_CaffeMobile_loadModel and Java_caffe_1android_1lib_CaffeMobile_loadModel__Ljava_lang_String_2Ljava_lang_String_2)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: yishan.opencv_test, PID: 24033
java.lang.UnsatisfiedLinkError: No implementation found for int caffe_android_lib.CaffeMobile.loadModel(java.lang.String, java.lang.String) (tried Java_caffe_1android_1lib_CaffeMobile_loadModel and Java_caffe_1android_1lib_CaffeMobile_loadModel__Ljava_lang_String_2Ljava_lang_String_2)
at caffe_android_lib.CaffeMobile.loadModel(Native Method)
at yishan.opencv_test.MainActivity.onCreate(MainActivity.java:104)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I/Process: Sending signal. PID: 24033 SIG: 9
Application terminated.
Ask for help,thanks.
Hi,
First of all, thanks for this amazing app!
I have trained a caffe model with CIFAR-10 data set and would like to see it's performance using the mobile app.
The prototxt file was like:
name: "CIFAR10_quick_test"
input: "data"
input_shape {
dim: 1
dim: 3
dim: 32
dim: 32
}
layer { ...// layers ....}
I modified the header according to the deploy_mobile.prototxt as:
name: "CIFAR10_quick_test"
input: "data"
layer {
name: "data"
type: "MemoryData"
top: "data"
top: "label"
memory_data_param {
batch_size: 1
channels: 3
height: 32
width: 32
}
transform_param {
crop_size: 32
mean_value: 104
mean_value: 117
mean_value: 123
mirror: false
}
}
layer { .... // layers ...}
But then I got this fault running the app:
10-05 00:53:46.930 16636-16636/com.sh1r0.caffe_android_demo A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 16636 (fe_android_demo)
10-05 00:53:46.930 16636-16636/com.sh1r0.caffe_android_demo W/libc: Security Level: (1), Debug inforamtion is controlled by the DUMPABLE flag.
What am I missing?
Thank you so much for your help!
Is it possible to store the deploy.prototxt file and the caffemodel file within the app, instead of having the user store them in a directory in the phone's external memory?
Hi Guys,
I'm trying to predict objects in a video. How do I modify the current demo app for video input?
Should I extract frames from the video using ffmpeg and give the frame input to caffe?
Please suggest If you have more comments on the design and the possible ways of implementation in Android.
Thanks,
Poornima
I can install this app, but when i try to open the app by clicking the icon. It doesn't working. The error information is as follows:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "sigfillset" referenced by "libcaffe.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:361)
at java.lang.System.loadLibrary(System.java:525)
at com.sh1r0.caffe_android_demo.MainActivity.(MainActivity.java:55)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2282)
at android.app.ActivityThread.access$600(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5265)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:760)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)
Can this suit every mobilephones?
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)
I would like to use Caffe builded version in my Android application.for this purpose I downloaded https://github.com/sh1r0/caffe-android-demo demo project from this given link. But while run the corresponding downloaded project in Android Studio It showed the error as below
03-26 14:46:35.697 2800-3042/com.sh1r0.caffe_android_demo A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 3042 (AsyncTask #1)
please help me to run the demo application successfully.
I used
File file = new File(modelProto);
if(file.exists())Log.e("DEVX", "ok.");
else Log.e("DEVX", "NOT");
And I watched ok in Android Log Monitor. It means Android can find the file. It exists.
But I got
F1107 18:01:28.624402 16834 io.cpp:36] Check failed: fd != -1 (-1 vs. -1) File not found: /storage/emulated/0/Download/caffe_mobile/bvlc_reference_caffenet/deploy.prototxt
when the execution arrived to
caffeMobile.loadModel(modelProto, modelBinary);
It means that Android find the file but io.cpp can't find the file.
I doubled checked the path and I added
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
And I updated the code using the external storage SD card
pull /storage/278E-8716/caffe_mobile/bvlc_reference_caffenet/deploy.prototxt
but I can't solve this issue.
I have
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.sh1r0.caffe_android_demo"
minSdkVersion 15
targetSdkVersion 23
versionName "1.0"
}
And I don't know what is the problem.
Please, help
Hi,
How can we achieve a similar application for other caffe networks?
Please,I want to know whether this applies to googlenet model. I replace the model with the googlenet ,and I encounter problems.
I used the previous version (4140a53) of this demo on Samsung Note 1 (GT-N7000), everything worked fine.
After pulling the latest version (5a80ac6) the app crashes while starting up.
What's more interesting is that the new version works fine on other devices (LG G3, Samsung S4)
Do you have any idea what changed between these commits that might have suce an affect?
Thanks
The size of libcaffe.so in caffe-android-demo is 6.9Mb (call it demo:libcaffe.so), and the one build by caffe-android-lib is about 8.8Mb(call it source:libcaffe.so), and I found something different.
Q1:
I tried to edit the CaffeMobile class, so as to support using two or more models (since the original one is singleton). When running the predict function in a new thread using source:libcaffe.so, there was an error:
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 22937 (Thread-1670)
The error disappeared when using demo:libcaffe.so or running the predict function in the main thread of Android(for both libcaffe.so files).
Q2:
So I replaced the source:libcaffe.so with demo:libcaffe.so, the problem in Q1 solved. But a new problem appeared:
When using CascadeClassifier::detectMultiScale function in OpenCV, there was an error in the OpenCV image resize function:
E/cv::error(): OpenCV Error: Bad argument (Unknown interpolation method) in void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int), file /Users/shiro/caffe-android-lib/opencv/modules/imgproc/src/imgwarp.cpp, line 3374
There was no such error when using source:libcaffe.so.
I don't know what to do with the files in caffe-android-lib to solve the problem in Q1? Please give me help. Thank you very much~~~
hi. i'm looking at your example. it looks like during training in train_val.prototxt you use mean_file (mean image), while on mobile in deploy_mobile.prototxt you use mean_value (mean pixel). why is that? why don't you use both mean image at both places? thanks.
Hi, How are you?
I have an issue in my project and I was wondering if you could help me .
I'm trying to integrate your libcaffe.so files for each architecture armeabi armeabi-v7a x86 arm64-v8a x86_64 in own jni folder
Here is our Application.mk
APP_STL := gnustl_static APP_CPPFLAGS := -std=c++11 -frtti -fexceptions APP_ABI := armeabi armeabi-v7a x86 arm64-v8a x86_64 APP_PLATFORM := android-8 NDK_TOOLCHAIN_VERSION := 4.9
We load it in the Android.mk
include $(CLEAR_VARS) LOCAL_MODULE := caffe LOCAL_SRC_FILES := ../caffe/$(TARGET_ARCH_ABI)/libcaffe.so LOCAL_C_INCLUDES += include/boost include/caffe include/gflagas include/glog include/google/protobuf include $(PREBUILT_SHARED_LIBRARY)
I load the caffe module this way
LOCAL_SHARED_LIBRARIES += caffe
after run ndk-build
we get the error message
missing cblas.h
then we include openBlas headers from the official site
now we have this error:
*jni/OpenBLAS/lapack-netlib/CBLAS/include/cblas.h:27:28: fatal error: cblas_mangling.h: No such file or directory
#include "cblas_mangling.h"
*
The question is :
could you tell me which are the correct headers that we must to include to make it work.
Thanks
sorry.. this is not an issue, but i wans't sure how to post this question. this library is great. thank you.
do you know a similar library for iOS? we're trying to port caffe onto iOS too.
thanks!
I try to run this app in my android device, but it crashed. So i want to change the mini batch to 1 in deploy.prototxt, but i i can't find a parameter that called mini batch.
Kindly let me know what this function does.
Demo app crashes out of the box with no logcat errors. Last log is upgrade_proto.cpp:52 Attempting to upgrade input file specified using deprecated V1LayerParameter: /sdcard/caffe_mobile/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
Any help?
Error when I try to configure the next repository: https://github.com/BVLC/caffe.git
in the command: ./scripts/download_model_binary.py models/bvlc_reference_caffenet/
launch the next error:
Traceback (most recent call last):
File "./scripts/download_model_binary.py", line 5, in <module>
import yaml
I trained a VGGnet and i set the batch size from 10 to 1. Then i put the file to the sdcard and change the code to find the corresponding VGGnet . But it crashed when i try to run the app(when i click the app icon). I don't know what' s the reason . My guess is the model is too big , because it's size is 350+M.
I test on Android 4.4 but it failed. Does't it support android 4.4 ?
0.3134 - "n02123045 tabby, tabby cat" 0.2380 - "n02123159 tiger cat"0.1235 - "n02124075 Egyptian cat" 0.1003 - "n02119022 red fox
I would like to show probabilities above,instead of labels.And I am a newbie so that I don't know how to use "getConfidenceScore".
can anybody help me?Many thanks.
private class CNNTask extends AsyncTask<String, Void, Integer> {
private CNNListener listener;
private long startTime;
public CNNTask(CNNListener listener) {
this.listener = listener;
}
@Override
protected Integer doInBackground(String... strings) {
startTime = SystemClock.uptimeMillis();
return caffeMobile.predictImage(strings[0])[0];
}
@Override
protected void onPostExecute(Integer integer) {
Log.i(LOG_TAG, String.format("elapsed wall time: %d ms", SystemClock.uptimeMillis() - startTime));
listener.onTaskCompleted(integer);
super.onPostExecute(integer);
}
}
I use openblas and in the demo, the code that:
caffeMobile.setNumThreads(4);
and in the jni:
openblas_set_num_threads(num_threads);
I seems that this change the number of cores that we use. However, when I change the number in setNumThreads(), from 1-6. It changes nothing. For example, it cost me 5s to run a image when the number is 1, and 5s as the number is 4(or others).
My arm has 6 cores.
So, would you tell me something about the function setNumThreads()?
Thank you!
I am able to build and run the demo code caffe-android-demo with the armeabi-v7a caffe binary as part of the demo distribution. However when I try to build my own caffe-android-lib the demo fails with the output.
upgrade_proto.cpp:68 Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /storage/6A60-09E3/caffe/models/bvlc_reference_caffenet/deploy.prototxt
com.sh1r0.caffe_android_demo A/native: terminating.
The protobuf version as specified in the caffe-android-lib does not seem to parse the file deploy.prototxt file. I have confirmed that the file is available in the said location and the file descriptor is open. It is failing when google::protobuf is trying to parse the file.
Besides this I also tried to run the same cpp_classification example as given in the location http://caffe.berkeleyvision.org/gathered/examples/cpp_classification.html
and get the same error as above in the logcat.
Does anyone know about this issue, and a way to overcome this?
How can I get confidence scores? I use your get confidence scores function, but it return an array with only one 1.0 element, others is 0. So it's not helpful. Can you help me please? Thank you very much!
hi. i got the imagenet sample model works fine. but when i tried to plug in my own model, i got the following error, and the prediction isn't correct as supposed. any idea what this error is? thanks.
10-28 13:56:52.274 8767-8840/com.sh1r0.caffe_android_demo D/stderr﹕ [ 10-28 13:56:52.274 8767: 8840 D/stderr ]
[
10-28 13:56:52.274 8767-8840/com.sh1r0.caffe_android_demo D/stderr﹕ ERROR
10-28 13:56:52.274 8767-8840/com.sh1r0.caffe_android_demo D/stderr﹕ ]
10-28 13:56:52.274 8767-8840/com.sh1r0.caffe_android_demo D/stderr﹕ (k) <= (probs.size())
10-28 13:56:52.274 8767-8840/com.sh1r0.caffe_android_demo D/stderr﹕ [ 10-28 13:56:52.274 8767: 9244 D/MiRA-CNN ]
Will this work on an Android device, like the Nexus 5, which doesn't have an sdcard? It doesn't seem to be working on mine, even though I made the change in the deploy.prototxt file, so I assume the issue could be because of the non-existence of an SD card.
I use your demo and try to run in eclipse, but I got an error that : A/native(21720): upgrade_proto.cpp:75 Check failed: ReadProtoFromBinaryFile(param_file, param) Failed to parse NetParameter file: /sdcard/caffe_mobile/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
I don't change anything in your code. So what should I do to solve the problem?
By the way, I check the code and find it created on 3/26/15.
Thank you for your help and your code.
The app runs on the device (Nexus 6), but when I select an image or take a photo I see the (Predicting ..) dialog, but then the app exits and I get a (Unfortunately, Caffe-Android-Demo has stopped).
Any help on what's going wrong?
hey,I have some trouble in running the application.The android version of my phone is 4.4.4,I've moved the .caffemodel and deploy.prototxt under /sdcard/caffe_mobile/bvlc_reference_caffenet,and installed the apk on my phone successfully.But when I ran the app,it crashed...Here is my logcat,any suggestion will be appreciated!
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sh1r0.caffe_android_demo, PID: 7466
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "sigfillset" referenced by "libcaffe.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:364)
at java.lang.System.loadLibrary(System.java:526)
at com.sh1r0.caffe_android_demo.MainActivity.(MainActivity.java:57)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2109)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2241)
at android.app.ActivityThread.access$800(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5049)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Application terminated.
I had load my own modelProto, modelBinary. I use extractFeatures function to get result. but app crashed aboute tens of seconds later. this test.caffemodel works on Windows. I don't get any error log. if I can't use the libcaffe.so directly? What should I do to make my test model works?
Hi,
I'm facing issue when the call goes to caffeMobile.LoadModel(). Below is the fatal error popped up.
05-13 05:00:22.214 12017-12017/com.sh1r0.caffe_android_demo A/native: io.cpp:36 Check failed: fd != -1 File not found: /storage/emulated/0/caffe_mobile/bvlc_reference_caffenet/deploy.prototxt
05-13 05:00:22.214 12017-12017/com.sh1r0.caffe_android_demo A/native: terminating.
05-13 05:00:22.214 12017-12017/com.sh1r0.caffe_android_demo A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 12017 (fe_android_demo)
Has anyone encountered the same issue?.
Files are present in sdcard and I confirmed by putting prints in JNI file and below is path shown.
05-13 05:00:22.213 12017-12017/com.sh1r0.caffe_android_demo I/caffe_jni: /storage/emulated/0/caffe_mobile/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
05-13 05:00:22.213 12017-12017/com.sh1r0.caffe_android_demo I/caffe_jni: /storage/emulated/0/caffe_mobile/bvlc_reference_caffenet/deploy.prototxt
Note:
I have compiled the lib in https://github.com/sh1r0/caffe-android-lib for x86 platform.
Thanks in advance.
Regards,
Poornima
Hi
I use your example in my face recognition project. The bvlc model works on my Sony Xperia Z3 Compact. But the VGG Face Descriptor model (which is twice as big) needs too much RAM, so I needed to switch to another phone with more memory.
Now I got the problem, that on the Samsung Galaxy Note Edge I cannot get further than this point:
I/native: upgrade_proto.cpp:43 Attempting to upgrade input file specified using deprecated transformation parameters: /storage/emulated/0/Pictures/facedetection/data/VGG/bvlc_reference_caffenet.caffemodel
I/native: upgrade_proto.cpp:46 Successfully upgraded file specified using deprecated data transformation parameters.
W/native: upgrade_proto.cpp:48 Note that future Caffe releases will only support transform_param messages for transformation fields.
I/native: upgrade_proto.cpp:52 Attempting to upgrade input file specified using deprecated V1LayerParameter: /storage/emulated/0/Pictures/facedetection/data/VGG/bvlc_reference_caffenet.caffemodel
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 6635 (Thread-2990)
I first thought that the architecture (arm64-v8a vs. armeabi-v7a) could cause the issue but your demo works (well it runs out of memory while rendering but the prediction works).
So it should be another issue. Do you have any ideas?
Thanks,
Michael
A month ago, I downloaded your code and was able to sucessfully use it in the android device. Then few days back, I updated the android/gradle version from 2.1.0 to 2.1.2. Then onwards the following error is coming : java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "sigfillset" referenced by "libcaffe.so"...
After that I even re downloaded it and compiled but no success. The android studio version that I am trying is the following. Could you tell me if I am using a higher version. Also, did you create the jnilibs using caffe-android-libs git repo?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.