私はカフェのフレームワークを使用して、私は、Python言語を使用してこのコードを持っている:PythonでCaffe Refrenseをsysの後に実行する必要があるのはなぜですか?
import numpy as np
import os
import matplotlib
import sys
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
caffe_root = '/home/jackson/caffe/' # this file should be run from {caffe_root}/examples (otherwise change this line)
sys.path.insert(0, caffe_root + 'python')
import caffe
model_def = caffe_root + 'models/bvlc_reference_caffenet/deploy.prototxt'
model_weights = caffe_root + 'models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel'
net = caffe.Net(model_def, # defines the structure of the model
model_weights, # contains the trained weights
caffe.TEST) # use test mode (e.g., don't perform dropout)
問題がある、私はsys.path.insert(0、caffe_root + 'のpython')前輸入カフェを移動すると、私はこのエラーを取得:
F0612 09:44:35.476567 5443 upgrade_proto.cpp:928]チェックに失敗しました: /ホーム/ jackso: ReadProtoFromTextFile(param_file、paramが)NetParameter ファイルの解析に失敗しましたN /カフェ/モデル/ bvlc_reference_caffenet/deploy.prototxt *障害スタックトレースを確認してください:*中止(コアダンプ)
ドゥカフェとSYSライブラリの衝突のいくつかの並べ替えを持っていますか?なぜこれが起こったのですか?それとも、モジュールディレクトリをsys.pathと変更したのでしょうか?あなたは後にそれを移動すると、このコードは、あなたのPythonのimportパスの先頭にあなたの/ home /ジャクソン/カフェ/フォルダを置く