
當我使用 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並將其放入缺少表格的目錄中。