Ubuntu v16.04 LTS
caffe v1.0.0-rc3
cuDNN v5.1.5
cuda v8.0
cuda patch v8.0
(02) 下載Caffe_SSD
$ git clone https://github.com/weiliu89/caffe.git caffe_SSD
$ cd ~/caffe_SSD
$ git checkout ssd
(03) 修改caffe的Makefile.config
$ cd ~/caffe_SSD
$ cp Makefile.config.example Makefile.config
$ sudo gedit Makefile.config
a. 啟用CUDNN,去掉"#"
USE_CUDNN := 1
b. 啟用GPU,將CPU_ONLY開頭加上"#"
# CPU_ONLY := 1
c. 搜尋lib位置
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s libhdf5_serial.so.8.0.2 libhdf5.so
$ sudo ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so
(04) 編譯Caffe_SSD
$ cd ~/caffe_SSD
$ mkdir build
$ cd build
$ cmake -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF -D OpenCV_DIR=/usr/local/share/OpenCV ..
$ make all -j8
$ make install -j8
$ make pytest -j8
$ make pycaffe -j8
$ make runtest -j8
(05) 下載VggNet放在~/caffe_SSD/models/VGGNet/
https://gist.github.com/weiliu89/2ed6e13bfd5b57cf81d6
(06) 下載VOC2007和VOC2012的資料
$ cd
$ mkdir data
$ cd ~/data
$ wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
$ wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
$ wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar
$ tar -xvf VOCtrainval_11-May-2012.tar
$ tar -xvf VOCtrainval_06-Nov-2007.tar
$ tar -xvf VOCtest_06-Nov-2007.tar
(07) 設置環境變數
$ sudo gedit /etc/profile
在/etc/profile 最底下添加
export PYTHONPATH=$PYTHONPATH:$HOME/caffe_SSD/python
$ source /etc/profile
$ sudo reboot
(08) 創建LMDB檔案
$ cd ~/caffe_SSD
$ ./data/VOC0712/create_list.sh
$ ./data/VOC0712/create_data.sh
(09) 訓練與測試
$ sudo gedit ~/caffe_SSD/examples/ssd/ssd_pascal.py
修改gpus = "0,1,2,3"這一行,來決定使用的gpu數量
$ cd ~/caffe_SSD$ python examples/ssd/ssd_pascal.py
如果出現cudasuccess(2vs0)問題,則說明顯示卡計算量有線,再次打開caffe/examples/ssd/ssd_pascal.py修改batch_size = 32這一行
$ python examples/ssd/score_ssd_pascal.py
$ python examples/ssd/ssd_pascal_webcam.py
請問一下在09訓練與測試沒有gpu的話有cpu版本嗎?
回覆刪除因為Caffe SSD用CPU測試速度緩慢,所以關於那方面我沒有實際測試過。故CPU的測試方法,需要您上網另外找答案,我就不方便在這邊提出可能造成誤導的步驟了。
刪除可以請問一下在make pytest -j8出現錯誤,上網找了很久都找不到解決方法
回覆刪除請問這個問題如何排除?或提示可能哪裡出錯,感謝!
EEEEEEEE
ERROR: test_python_layer_with_param_str (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_python_layer_with_param_str
Traceback (most recent call last):
File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests
module = self._get_module_from_name(name)
File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
__import__(name)
File "/home/user/caffe_SSD/python/caffe/test/test_python_layer_with_param_str.py", line 6, in
import caffe
File "caffe/__init__.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: No module named _caffe
Ran 8 tests in 0.001s
FAILED (errors=8)
CMakeFiles/pytest.dir/build.make:57: recipe for target 'CMakeFiles/pytest' failed
make[3]: *** [CMakeFiles/pytest] Error 1
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/pytest.dir/all' failed
make[2]: *** [CMakeFiles/pytest.dir/all] Error 2
CMakeFiles/Makefile2:106: recipe for target 'CMakeFiles/pytest.dir/rule' failed
make[1]: *** [CMakeFiles/pytest.dir/rule] Error 2
Makefile:175: recipe for target 'pytest' failed
make: *** [pytest] Error 2