Caffe to Tensorflow (Kaffe by Ethereon) : TypeError: Descriptors should not be created directly, but only retrieved from their parent
Caffe to Tensorflow (Kaffe by Ethereon) : TypeError: Descriptors should not be created directly, but only retrieved from their parent
我想使用 ethereon 的精彩软件包 caffe-tensorflow,我 运行 遇到了中描述的相同问题
this closed issue:
当我 运行 示例或尝试 import caffepb
我收到错误消息:
>>> 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.
我在 linux 64 位 UBUNTU 14.04 机器上使用 Tensorflow 0.7.0,protobuf 3.0.0b2.post(但它也发生在 3.0.0a4 和 3.0.0b2 上) Python 2.7 和蟒蛇。
我多次尝试重新安装 protobuf 和 tensorflow,因为我认为这很可能是不同 protobuf 安装之间的冲突(或者至少这是 github 问题的结论)但我无法做到即使结合使用 pip install protobuf、pip uninstall protobuf 或直接安装 protobuf .whl,它也能正常工作。
你有什么建议?
编辑:使用虚拟环境可能是一种解决方案,但我想尽可能避免使用它
我也遇到了同样的问题。我的解决方案(解决方法)与问题中的评论之一相同 - install/run tf and protobuf3 (and anything) in virtualenv.
我不知道到底是什么问题。这只是您可以尝试的一种解决方法。
将任何创建描述符的文件重命名为后缀“_pb2.py”将解决此问题。
更新(2017 年 4 月 4 日):
在"caffe-tensorflow"项目中,我将"kaffe/caffe/caffepb.py"重命名为"caffe_pb2.py",问题就解决了。这是我在这个项目中找到的唯一创建 PB 描述符的文件。
凯宇的解决方案对我也有效。但是,我也建议删除 caffe-tensorflow/kaffe/caffe 中的 "caffepb.pyc" 文件,以确保代码的 none 仍然可以使用旧名称的 caffe_pb2 模块。
我相信这个模块只用在文件 caffe-tensorflow/kaffe/caffe/resolver.py.
通过使用降级 protobuf 版本
“pip install protobuf~=3.19.0”
我想使用 ethereon 的精彩软件包 caffe-tensorflow,我 运行 遇到了中描述的相同问题 this closed issue:
当我 运行 示例或尝试 import caffepb
我收到错误消息:
>>> 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.
我在 linux 64 位 UBUNTU 14.04 机器上使用 Tensorflow 0.7.0,protobuf 3.0.0b2.post(但它也发生在 3.0.0a4 和 3.0.0b2 上) Python 2.7 和蟒蛇。
我多次尝试重新安装 protobuf 和 tensorflow,因为我认为这很可能是不同 protobuf 安装之间的冲突(或者至少这是 github 问题的结论)但我无法做到即使结合使用 pip install protobuf、pip uninstall protobuf 或直接安装 protobuf .whl,它也能正常工作。
你有什么建议?
编辑:使用虚拟环境可能是一种解决方案,但我想尽可能避免使用它
我也遇到了同样的问题。我的解决方案(解决方法)与问题中的评论之一相同 - install/run tf and protobuf3 (and anything) in virtualenv.
我不知道到底是什么问题。这只是您可以尝试的一种解决方法。
将任何创建描述符的文件重命名为后缀“_pb2.py”将解决此问题。
更新(2017 年 4 月 4 日): 在"caffe-tensorflow"项目中,我将"kaffe/caffe/caffepb.py"重命名为"caffe_pb2.py",问题就解决了。这是我在这个项目中找到的唯一创建 PB 描述符的文件。
凯宇的解决方案对我也有效。但是,我也建议删除 caffe-tensorflow/kaffe/caffe 中的 "caffepb.pyc" 文件,以确保代码的 none 仍然可以使用旧名称的 caffe_pb2 模块。
我相信这个模块只用在文件 caffe-tensorflow/kaffe/caffe/resolver.py.
通过使用降级 protobuf 版本 “pip install protobuf~=3.19.0”