Caffe: Caffe的Python接口
官方參考:http://caffe.berkeleyvision.org/installation.html
官方介紹是這樣的:
Python
The main requirements are numpy and boost.python (provided by boost).pandas is useful too and needed for some examples.
You can install the dependencies with:
for req in $(cat requirements.txt); do pip install $req; done
but we suggest first installing the Anaconda Python distribution, which provides most of the necessary packages, as well as thehdf5 library dependency.
To import the caffe Python module after completing the installation, add the module directory to your$PYTHONPATH byexport PYTHONPATH=/path/to/caffe/python:$PYTHONPATH or the like. You should not import the module in thecaffe/python/caffe directory!
1. 對(duì)于:for req in $(cat requirements.txt); do pip install $req; done
這句shell,可能會(huì)運(yùn)行無(wú)效,要把requriments 里面的軟件要求順序變更一下,安裝完其他包后,依次安裝ipython和h5dy;
2. 添加caffe的python包含路徑:
你所添加的路徑是:export PYTHONPATH=/home/wishchin/caffe-master/python:$PYTHONPATH
??????????????????????? 而非:export PYTHONPATH=/home/wishchin/caffe-master/python/caffe:$PYTHONPATH
修改后update一下,或者重啟,可以在任一項(xiàng)目中import caffe
3.對(duì)于Eclipse,可以在preference-python-Interpretor里面直接添加路徑
注意事項(xiàng): 若是第一次在Eclipse中引用出現(xiàn)錯(cuò)誤。Don't panic! 重啟一下eclipse就可以了。
若想在一個(gè)工程中引用Caffe,暫時(shí)沒(méi)有想到可行的方法.....................................................
后記: 在eclipse工程中添加引用目錄,直接import caffe
總結(jié)
以上是生活随笔為你收集整理的Caffe: Caffe的Python接口的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 孩子比赛输赢不重要的句子72句
- 下一篇: 念奴娇过洞庭翻译赏析