Caffe到Tensorflow(Ethereon的Kaffe):TypeError:描述符不应直接创建,而只能从其父级检索 [英] Caffe to Tensorflow (Kaffe by Ethereon) : TypeError: Descriptors should not be created directly, but only retrieved from their parent

查看:687
本文介绍了Caffe到Tensorflow(Ethereon的Kaffe):TypeError:描述符不应直接创建,而只能从其父级检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ethereon的出色软件包caffe-tensorflow,遇到了
已解决的问题

I wanted to use the wonderful package caffe-tensorflow by ethereon and I ran into the same problem described in this closed issue:

当我运行示例或尝试导入caffepb 我收到错误消息:

When I run the example or try to import caffepb I got the error message:

>>> import caffepb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caffepb.py", line 28, in <module>
        type=None),
  File "/home/me/anaconda/python2.7/site-packages/google/protobuf/descriptor.py", line 652, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors should not be created directly, but only retrieved from their parent.

我在具有protobuf 3.0.0b2的Linux 64位UBUNTU 14.04机器上使用Tensorflow 0.7.0。使用python 2.7和anaconda进行发布(但也发生在3.0.0a4和3.0.0b2中)。

I am using Tensorflow 0.7.0 on a linux 64 bits UBUNTU 14.04 machine with protobuf 3.0.0b2.post (but it also happened with 3.0.0a4 and 3.0.0b2) with Python 2.7 and anaconda.

我多次尝试重新安装protobuf和tensorflow,因为我发现这可能是不同protobuf安装之间的冲突(或者至少是github问题的结论)但是即使将pip install protobuf,pip卸载protobuf或直接安装protobuf .whl组合使用,我也无法使它工作。

I tried to reinstall protobuf and tensorflow numerous times as I figured it was quite possibly a conflict between different protobuf installs (or at least that was the conclusion of the github issue) but I couldn't make it work even after doing a combination of pip install protobuf, pip uninstall protobuf or directly installing protobuf .whl.

您有什么建议?

编辑:使用虚拟环境可能会解决方案,但如果可能的话,我想避免使用它。

Using a virtual environment may be a solution but I would like to avoid it if possible

推荐答案

重命名任何创建描述符的文件,使其后缀为 _pb2.py解决这个问题。

Renaming any file creating descriptors to have suffix "_pb2.py" will solve this problem.

更新(2017年4月4日):
在 caffe-tensorflow项目中,我将其重命名为 kaffe / caffe / caffepb。 py改为 caffe_pb2.py,这就解决了问题。这是我在该项目中找到的唯一创建PB描述符的文件。

UPDATE(April 4, 2017): In the "caffe-tensorflow" project, I renamed the "kaffe/caffe/caffepb.py" to "caffe_pb2.py", and this solved the problem. This is the only file I found in this project that creates PB descriptors.

这篇关于Caffe到Tensorflow(Ethereon的Kaffe):TypeError:描述符不应直接创建,而只能从其父级检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆