Comments (4)
I added to caffe_jni.cpp the following lines:
JNIEXPORT jfloatArray JNICALL
Java_com_sh1r0_caffe_1android_1lib_CaffeMobile_getConfidence(JNIEnv *env,
jobject thiz,
jstring imgPath) {
CaffeMobile *caffe_mobile = CaffeMobile::Get();
vector confidence = caffe_mobile->GetConfidence(jstring2string(env, imgPath));
jfloatArray result;
result = env->NewFloatArray(4);
if (result == NULL) {
return NULL; /* out of memory error thrown */
}
// move from the temp structure to the java structure
env->SetFloatArrayRegion(result, 0, 4, &confidence[0]);
return result;
}
Then added to caffe_mobile.cpp
vector CaffeMobile::GetConfidence(const string &img_path) {
const vector probs = Forward(img_path);
return probs;
}
And created a native method on android. But it returns the following code ( I have 4 classes):
label 0 = 0.0
label 1 = 1.0
label 2 = 0.0
label 3 = 0.0
Another prediction:
label 0 = 0.0
label 0 = 0.0
label 0 = 0.0
label 0 = 1.0
So, it gives not gives to me the confidence that I want. Am I doing something wrong? Or is not possible?
from caffe-android-lib.
Hi,
We are trying to build an app which requires to classify objects based on whether the confidence value is higher than a threshold. This work of yours looks really promising and we would like to go forward with using it. Problem is that we really need the individual confidence values. Please see if this functionality can be added asap.
Else, it seems that only the .so is accessible in the recent commits and not the .cpp code which we can ourselves modify. See if you can re-add in the upcoming commits.
from caffe-android-lib.
I have updated the dev branch with GetConfidenceScore
function in caffe_mobile module. The source files are right here.
Please have a try and kindly let me know if there is any problem. Thanks.
from caffe-android-lib.
I can see the changes in the .cpp files. But, how to get them reflected in the java class?
Please update the caffe-android-demo project with these changes. Also, please add some documentation on how to get the functionality from .cpp to .java.
from caffe-android-lib.
Related Issues (20)
- Performance become very slow when using multiple threads to do net_->Forward();
- OpenBlas Build failed HOT 1
- Error while running ./build.sh HOT 1
- make: *** No rule to make target 'clean'. Stop. Failed to build OpenBLAS
- How to make pycaffe and build _caffe module HOT 1
- Failed to build OpenBLAS HOT 2
- hi, Failed to build OpenBLAS,libopenblas_atom-r0.2.18.a HOT 1
- Failed to build OpenBLAS: cannot stat 'libopenblas_armv8p-r0.3.0.dev.so': No such file or directory HOT 3
- can not use asset manager HOT 1
- Failed to build OpenBLAS? HOT 29
- Is it suitable for all network?
- Is trainning available on Android?
- Failed to find header file, during [make] process HOT 1
- armeabi-v7a with: command not found HOT 1
- libtool: error: unrecognised option: '-DHAVE_CONFIG_H' HOT 2
- Build error when linking libopenblas.a to libcaffe.so
- find: '/caffe-android-lib/toolchains/armeabi/bin/': No such file or directory
- Porting an exisiting caffe net for text recognition?
- run caffee demo error HOT 3
- Compilation failed at ndk-r19c
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caffe-android-lib.