多标签分类的数据层问题

之前做人脸属性时,使用的是h5格式的多标签进行数据载入,但是最近要求在训练过程中,要对数据进行增强处理,那h5的方法就不适用了,所以最终在同事的推荐下开始摸索使用python,在caffe中加入python层,用于数据输入时的处理;

目录

遇到的第一个问题:找不到我自己写的python层

遇到第二个问题:protobuf版本太低



 

  • 遇到的第一个问题:找不到我自己写的python层,报错如下:
ImportError:No module named facedata

(我实现的python层名字叫facedata.py,放在./caffe_refinedet/python的路径下)

然后参考:https://blog.csdn.net/jzrita/article/details/79394936

我在自己的系统中配置了如下环境,配置过程:

$ gedit .zshrc

然后在zshrc中添加: 

#caffe
export PATH=$PATH:/home/XXXXX/caffe_refinedet/include
PYTHONPATH=/home/XXXXX/caffe_refinedet/python:$PYTHONPATH

然后:

source ~/.zshrc

另开终端:

输入

$ python
>>> import facedata

没有报错就没有问题了;(也可以试验一下同路径下的其他python文件)

  • 遇到第二个问题:
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires
 version 3.6.1 of the Protocol Buffer runtime library, but the installed version is
 2.6.1.  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".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  This program requires version 3.6.1 of the Protocol Buffer runtime
 library, but the installed version is 2.6.1.  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".)

报错大意是:写的python层要使用protobuf,而且版本是要3.6.1,但是我系统版本是2.6.1,(之前安装deepin系统,为了跑通caffe,特意装的2.6.1,而且还是我下的源码,一步一步进行编译的。不能说换就换)

参考:https://blog.csdn.net/phdsky/article/details/80994090(可以仔细阅读)

我进行了以下一系列操作:

打开终端,输入:

$ pip list

也出现了:

protobuf                           3.6.1

但是真实的使用版本是2.6.1呀,这个删掉,在终端输入:

sudo pip uninstall protobuf

出现:

然后按照上面参考文献的说法,我找到protobuf2.6.1的python文件夹,把2.6.1的python接口编译安装下就OK了。

在终端执行以下语句:

$ python setup.py build
$ sudo python setup.py install
$  python setup.py test

第三句没有成功,但是已经不影响使用了;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猫猫与橙子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值