solrex / caffe-mobile

Optimized (for size and speed) Caffe lib for iOS and Android with out-of-the-box demo APP.
Other
317 stars 121 forks source link

读Resnet.prototxt错误 #11

Closed dimens66 closed 7 years ago

dimens66 commented 7 years ago

你好,请教一个问题。我在读Resnet.prototxt时发生了错误。我编的是arm-v7a的so,另外采用新版本的工具转换成binayproto也没有成功。目前读cifar10.prototxt可以,但是读resnet不行。在pc上读同样的模型都没有问题,只要放在android上就不行。请问这是什么原因?

错误定位: net_.reset(new Net(param_file, caffe::TEST)); 这一句跑不过。 进net构造函数中,定位到是最后一个函数Init(param);中crash。目前暂未找到问题在哪。

solrex commented 7 years ago

@ChangyeGuo 把 prototxt 文件作为附件上传上来吧,我试着看下。

dimens66 commented 7 years ago

@solrex 附件没法上传,我分享到了百度网盘了。麻烦看一下。 链接:http://pan.baidu.com/s/1c2zRuy0 密码:mhd0

solrex commented 7 years ago

@ChangyeGuo 抱歉,我当初只关注了 layer_factory.cpp 里列出的 layer,遗漏了一些 resnet 依赖的 layer。我已补充这些 layer https://github.com/solrex/caffe-mobile/commit/326fe37f02f9e25789a2545e34ae101c398a5195 ,自测是没问题了,麻烦更新代码再试一下。

dimens66 commented 7 years ago

@solrex resnet已经能读取,谢谢。 现更新最新的repo后,编译时发生错误。信息如下: make[1]: Leaving directory `/home/guocy/caffe-mobile-511/third_party/OpenBLAS-0.2.19' CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:99 (message): Could not find toolchain file: ../third_party/android-cmake/android.toolchain.cmake Call Stack (most recent call first):

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/guocy/caffe-mobile-511/build_armeabi/CMakeFiles/2.8.12.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 CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER CMake Error: Could not find cmake module file: /home/guocy/caffe-mobile-511/build_armeabi/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!

问题分析:初步分析应该是build-protobuf-3.1.0.sh的136行: ln -sf ../../protobuf-Linux/bin/protoc protoc 没有软链接成功。我把这一句comment,再把/Linux-protobuf/bin/protoc拷贝到android-protobuf文件夹下,然后就可以编译了。 请修复。 BEST LUCK!!!

xueyedamo commented 7 years ago

build-protobuf-3.1.0.sh脚本里面function build-Android 里面缺少了个cd ..造成cmake路径不对,还有这个软连接不对,文件夹名字错了,正确的是ln -sf ../../Linux-protobuf/bin/protoc protoc

solrex commented 7 years ago

Fixed in https://github.com/solrex/caffe-mobile/commit/ca1ac2c9d134d5f14dea7f65193b190846df52eb