
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それを、欠落している形式のディレクトリに配置します。