@nihui , 您好,请问如何编译生成tensorflow2ncnn? 我看了所有相关的Issures,也按照其中的一些方法尝试了,但是还是没有成功编译,我不知道是不是需要有什么特殊的环境需要配置的? 请问,可否提供一下的您的编译环境配置,让我做个参考。
多谢!
+1
tools/CMakeLists.txt
add_subdirectory(caffe)
add_subdirectory(mxnet)
Add
add_subdirectory(tensorflow)
@XunChangqing ,多谢,我已经加了,可是build不通过,如下:
versions.proto:1:10: Unrecognized syntax identifier "proto3". This parser only recognizes "proto2".
tools/tensorflow/CMakeFiles/tensorflow2ncnn.dir/build.make:134: recipe for target 'tools/tensorflow/versions.pb.cc' failed
make[2]: * [tools/tensorflow/versions.pb.cc] Error 1
CMakeFiles/Makefile2:698: recipe for target 'tools/tensorflow/CMakeFiles/tensorflow2ncnn.dir/all' failed
make[1]: [tools/tensorflow/CMakeFiles/tensorflow2ncnn.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: ** [all] Error 2
@XunChangqing 您好,需要安装那个版本的protobuf,我安装了3.3的版本,还是不能build通过,.....
versions.pb.cc:(.text+0x137b): undefined reference to google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
versions.pb.cc:(.text+0x13bf): undefined reference togoogle::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
CMakeFiles/tensorflow2ncnn.dir/versions.pb.cc.o:(.data.rel.ro._ZTVN10tensorflow10VersionDefE[_ZTVN10tensorflow10VersionDefE]+0xb0): undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
collect2: error: ld returned 1 exit status
tools/tensorflow/CMakeFiles/tensorflow2ncnn.dir/build.make:435: recipe for target 'tools/tensorflow/tensorflow2ncnn' failed
make[2]: * [tools/tensorflow/tensorflow2ncnn] Error 1
CMakeFiles/Makefile2:582: recipe for target 'tools/tensorflow/CMakeFiles/tensorflow2ncnn.dir/all' failed
make[1]: [tools/tensorflow/CMakeFiles/tensorflow2ncnn.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: ** [all] Error 2
问题已经解决了,给大家分享一下:
添加
add_subdirectory(tensorflow)
然后按照正常的编译流程编译即可!
不过,虽然编译过了,大多数的tensorflow模型还是无法转换,这个工具目前还是没有做完善。
@WenguoLi 你好,我想问一下,你的可以用了吗?
我是3.4的protobuf也没编过
------ Build started: Project: caffe2ncnn, Configuration: Release x64 ------
caffe2ncnn.obj : error LNK2019: unresolved external symbol "private: static int google::protobuf::io::CodedInputStream::default_recursion_limit_" (?default_recursion_limit_@CodedInputStream@io@protobuf@google@@0HA) referenced in function "bool __cdecl read_proto_from_binary(char const *,class google::protobuf::Message *)" (?read_proto_from_binary@@YA_NPEBDPEAVMessage@protobuf@google@@@Z)
caffe.pb.obj : error LNK2019: unresolved external symbol "class google::protobuf::internal::ExplicitlyConstructed
D:projectncnnbuildtoolscaffeReleasecaffe2ncnn.exe : fatal error LNK1120: 2 unresolved externals
------ Build started: Project: onnx2ncnn, Configuration: Release x64 ------
onnx2ncnn.obj : error LNK2019: unresolved external symbol "private: static int google::protobuf::io::CodedInputStream::default_recursion_limit_" (?default_recursion_limit_@CodedInputStream@io@protobuf@google@@0HA) referenced in function "bool __cdecl read_proto_from_binary(char const *,class google::protobuf::Message *)" (?read_proto_from_binary@@YA_NPEBDPEAVMessage@protobuf@google@@@Z)
onnx.pb.obj : error LNK2019: unresolved external symbol "class google::protobuf::internal::ExplicitlyConstructed
D:projectncnnbuildtoolsonnxReleaseonnx2ncnn.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 2 failed, 5 up-to-date, 0 skipped ==========
I found an nice blog about this, see:
https://blog.csdn.net/u012477435/article/details/80765005
我用的是3.6.1版本的protobuf 不过用的是静态库,可以一下编过,不过没搞明白咋用。。。
duplicate of https://github.com/Tencent/ncnn/issues/5
Most helpful comment
问题已经解决了,给大家分享一下:
cd /usr/lib
sudo cp libproto* x86_64-linux-gnu/
add_subdirectory(caffe)
add_subdirectory(mxnet)
添加
add_subdirectory(tensorflow)
然后按照正常的编译流程编译即可!
不过,虽然编译过了,大多数的tensorflow模型还是无法转换,这个工具目前还是没有做完善。