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
    评论
Caffe是一个深度学习框架,它依赖于protobufProtocol Buffers)。目前,Caffe可以使用protobuf 3.6.0来编译。因此,如果你想将Caffe与TensorFlow一起使用,你需要调整依赖项版本,确保使用的是protobuf-3.6.0版本来编译Caffe。 关于protobuf版本,你提到了一个问题与相关的引用内容。你提到Caffe装了3.3.0版本,但你需要的是3.6.0版本。你通过pip的list命令查看了已安装的包,发现安装了protobuf 3.6.0。为了满足你的需求,你打算卸载protobuf 3.6.0。 综上所述,Caffeprotobuf版本相关。Caffe可以使用protobuf 3.6.0来编译,并且你可以通过卸载安装了的protobuf 3.6.***<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Caffe,protobuf 编译安装](https://blog.csdn.net/Tosonw/article/details/91043145)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [【深度学习】CaffeProtobuf版本问题](https://blog.csdn.net/phdsky/article/details/80994090)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值