caffe中使用python自定义层出现protobuf版本不对

1. 编译问题 

  1. 先执行  sudo easy_install setproctitle

  2. 打开Makefile.config, 反注释:WITH_PYTHON_LAYER := 1
  3. 执行如下命令,即可重新编译环境。(支持python自定义层的caffe环境。)
sudo make clean
sudo make -j4
sudo make pycaffe
sudo make distribute

 

2. 可能出现的问题

ImportError: No module named voc_layers

可能原因及解决方案:

  a. 编译问题, 使用上面的命令重新编译caffe环境。

  b. 指定的层在PYTHONPATH中找不到

    解决方案分两种,i. 将voc_layers.py 文件复制到PYTHONPATH其中目录之一下,

      ii. 将voc_layers.py 所在的目录添加到PYTHONPATH中。

 

 

This program requires version 3.5.0 of the Protocol Buffer runtime library

具体详细日志如下:


 

[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.2.0 of the Protocol Buffer runtime library, but the installed version is 2.5.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/descriptor.pb.cc".)


日志说明:即protobuf的版本不对,这里的protobuf版本只python中的版本和caffe里面的protobuf版本对不上。和系统中的protobuf 版本无关。 

官方issue:https://github.com/BVLC/caffe/issues/5711

解决方案: 千万不能升级!!!千万不能升级!!!千万不能升级!!!

   执行如下命令:

sudo pip uninstall protobuf

sudo pip install protobuf==2.5.0 

 

sudo pip2 uninstall protobuf

sudo pip2 install protobuf==2.5.0

python2和python3都需要卸载 上面的4行命令即:卸载python2和python3下的protobuf,同时重新安装2.5.0版本的protobuf。

可以到 /usr/local/lib/{pythonVersion}/dist-packages去查看的protobuf的版本,如果不是目标版本,再执行上面的4条命令,不同版本下都需要删掉。

 

转载于:https://www.cnblogs.com/checkway/p/8493051.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值