在ubuntu14.04上运行deepdream时出错

2024-06-01 08:52:31 发布

您现在位置:Python中文网/ 问答频道 /正文

当我在ubuntu14.04上运行deep dream时,会出现以下错误:

Traceback (most recent call last):
  File "dream.py", line 7, in <module>
from google.protobuf import text_format
ImportError: No module named google.protobuf

当我运行python --version时,我会得到:

Python 2.7.10 :: Anaconda 2.3.0 (64-bit)

我已确保按照安装说明进行操作,并已安装了所有依赖项。我不知道为什么我会犯这个错误,但任何帮助都是感激的。在


Tags: pymost错误googlelinecallfilelast
1条回答
网友
1楼 · 发布于 2024-06-01 08:52:31

protobuf用于在deploy.prototxt文件中添加一行。 您只需添加一行: force_backward: truedeploy.prototxt并删除该依赖关系。在

您必须从以下位置更改代码:

model = caffe.io.caffe_pb2.NetParameter()
text_format.Merge(open(net_fn).read(), model)
model.force_backward = True
open('tmp.prototxt', 'w').write(str(model))

net = caffe.Classifier('tmp.prototxt', param_fn,
                       mean = np.float32([104.0, 116.0, 122.0]), # ImageNet mean, training set dependent
                       channel_swap = (2,1,0)) # the reference model has channels in BGR order instead of RGB

收件人:

^{pr2}$

然后拆下管路

^{3}$


如果你只是想试试深梦,看看deepdreamer

相关问题 更多 >