sudo를 사용하여 Caffe 가져오기가 작동하지 않습니다.

sudo를 사용하여 Caffe 가져오기가 작동하지 않습니다.

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양식이 누락된 디렉토리에 넣으세요.

관련 정보