Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.33k stars 4.15k forks source link

有人试过在arm或者android上用ncnn跑sphereface20吗? #286

Closed ctgushiwei closed 5 years ago

Pinnh commented 6 years ago

I have run sphereface20-on android with ncnn last year,any problem you met?

ctgushiwei commented 6 years ago

@Pinnh i want to known the time you cost on android

Ivan6666 commented 6 years ago

@Pinnh run sphereface on android with ncnn load_model(bin_files.data()) faile ,but run sphereface on ubuntu is ok;

Pinnh commented 6 years ago

sorry, I saw you comment email on phone but forgot to reply. sphereface20 run android is about 360±20ms I not met this issue when run sphereface20 on android, android code is not the same as pc , and init params should from asset

pc: ncnn::Net net; net.load_param_bin("ncnn.param.bin"); net.load_model("ncnn.bin");

android: JNIEXPORT jboolean JNICALL Java_com_tencent_ncnn_Ncnn_1Init(JNIEnv env, jobject thiz, jbyteArray param, jbyteArray bin){ { int len = env->GetArrayLength(param); param_vec.resize(len); env->GetByteArrayRegion(param, 0, len, (jbyte)param_vec.data()); int ret = net_model.load_param(param_vec.data()); } { int len = env->GetArrayLength(bin); bin_vec.resize(len); env->GetByteArrayRegion(bin, 0, len, (jbyte*)bin_vec.data()); int ret = net_model.load_model(bin_vec.data()); } return JNI_TRUE; } android java: private void initNcnn() throws IOException { byte[] param = null; byte[] bin = null; { InputStream assetsInputStream = getAssets().open("ncnn.param.bin"); int available = assetsInputStream.available(); param = new byte[available]; int byteCode = assetsInputStream.read(param); assetsInputStream.close(); } { InputStream assetsInputStream = getAssets().open("ncnn.bin"); int available = assetsInputStream.available(); bin = new byte[available]; int byteCode = assetsInputStream.read(bin); assetsInputStream.close(); } Ncnn_Init(param, bin); }

EngineeringBoy commented 6 years ago

兄弟,你搞定了没有,我现在在做这一块,从caffe转成ncnn有需要注意的吗?我feature提取出来的数值不对啊,你有遇到这样的问题吗?

ctgushiwei commented 6 years ago

搞定了,直接调用作者给的那个函数就行了,检查下param是否正确

EngineeringBoy commented 6 years ago

我现在遇到的是这样的问题,用特定的一张图片,在matlab中测试的时候提取出feature,然后我把这个feature保存,然后把网络转换成ncnn,再写c++代码提取出feature,两者对比,不一样,请问你又遇到这样的问题吗?

Pinnh commented 6 years ago

cosine similarity?