当我使用 sudo 运行该文件时,它说找不到它:
veli@veli:~/deepdream$ sudo python video-convert.py
Traceback (most recent call last):
File "video-convert.py", line 16, in <module>
import caffe
ImportError: No module named caffe
当我在没有 sudo 的情况下运行它时,它确实找到了它,但不幸的是需要文件中稍后的权限:
veli@veli:~/deepdream$ python video-convert.py
Traceback (most recent call last):
File "video-convert.py", line 81, in <module>
open('tmp.prototxt', 'w').write(str(model))
IOError: [Errno 13] Permission denied: 'tmp.prototxt'
我已经跑完了export PYTHONPATH=/home/veli/caffe/python:$PYTHONPATH
,所以我真的不知道现在还能做什么。
答案1
解决了!(部分)
我跑了:
cd
chgrp adm ./caffe
chmod g+rwx ./caffe
然后:
sudo chgrp adm ./deepdream
sudo chmod g+rwx adm ./deepdream
(^由于某种原因,它不允许我运行这些非 sudo ^)
那么现在就可以了:
cd deepdream
python video_convert.py
它成功运行直到我收到以下错误:
Traceback (most recent call last):
File "video-convert.py", line 85, in <module>
channel_swap = (2,1,0)) # the reference model has channels in BGR order instead of RGB
File "/home/veli/caffe/python/caffe/classifier.py", line 26, in __init__
caffe.Net.__init__(self, model_file, caffe.TEST, weights=pretrained_file)
RuntimeError: Could not open file /home/veli/caffe/models/bvlc_googlenet/bvlc_googlenet.caffemodel
答案2
(无法评论其他答案所以我必须在这里发布)
修理:
Traceback (most recent call last):
File "video-convert.py", line 85, in <module>
channel_swap = (2,1,0)) # the reference model has channels in BGR order instead of RGB
File "/home/veli/caffe/python/caffe/classifier.py", line 26, in __init__
caffe.Net.__init__(self, model_file, caffe.TEST, weights=pretrained_file)
RuntimeError: Could not open file /home/veli/caffe/models/bvlc_googlenet/bvlc_googlenet.caffemodel
下载bvlc_googlenet.caffemodel
自https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet并将其放入缺少的目录中。