運行環境:Linux+caffe
步驟:
Step 0: Compile master branch of caffe
本代碼運行的前提是,配置過caffe。因爲配置caffe的過程中會出現一些依賴庫,正是本代碼所需要的。http://blog.csdn.NET/u011204487/article/details/51596471是配置caffe的過程。注意Makefile.config中的CPU_ONLY := 1設置。
Step 1: Compile the deconv-deep-vis-toolbox branch of caffe
以下運行是在caffe根目錄下
$ Git remote add yosinski https://github.com/yosinski/caffe.git
$ git fetch --all
$ git checkout --track -b deconv-deep-vis-toolbox yosinski/deconv-deep-vis-toolbox
#這個地方很有可能報錯,提示你更新代碼會覆蓋本地
#$ git checkout --track -b yosinski/deconv-deep-vis-toolbox
#$ git checkout --track -b deconv-deep-vis-toolbox
#只需將兩個工具包分開下載就好
$ < edit Makefile.config to suit your system if not already done in Step 0 >
#編輯Makefile.config以適合自己的caffe
$ make clean
$ make -j
#這將會是一個漫長的等待,$ make -j4 可以稍微加快一下速度
$ make -j pycaffe
Step 2: Install prerequisites
這是要安裝三個Python-OpenCV scipy python-skimage東西,在安裝 scipy 的時候可能會出現問題,只說可能,可以通過先安裝pip來解決。
$ sudo apt-get install python-opencv scipy python-skimage
Step 3: Download and configure Deep Visualization Toolbox code
$ git clone https://github.com/yosinski/deep-visualization-toolbox
$ cd deep-visualization-toolbox
$ cp models/caffenet-yos/settings_local.template-caffenet-yos.py settings_local.py
$ < edit settings_local.py >
#在打開的setting_local.py文件中,有幾處要修改成自己的文件路徑,一定要看清楚有幾處,這個特別重要
$ cd models/caffenet-yos/
$ ./fetch.sh
#這將會是一個極其漫長的等待
$ cd ../..
Step 4: Run it!
$ ./run_toolbox.py
運行結果: