Main reference HTTPS://GITHUB.COM/WEILIU89/CAFFE/TREE/SSD get SSD code, download complete with a Caffe folder
git clone https://github.com/weiliu89/caffe.git
cd caffe
git Checkout SSD
Go to the downloaded Caffe directory and copy the configuration file
CD Caffe
CP Makefile.config.example Makefile.config
Compiling Caffe
Make all-j8 //-j16 according to the processor configuration of this machine, 16 is the meaning of 16 nuclear processors make
pycaffe-j8 make test-j8 make
runtest- J8 (This step is not necessary)
Download the pre-training model link: Link: https://pan.baidu.com/s/1o9c0GGU password: fucx, put it in the caffe/models/vggnet/directory
Download VOC2007 and VOC2012 datasets, put them under/caffe/data, and unzip
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
Convert picture to Lmdb file for training, in Caffe directory
CD..
CD Caffe
./data/voc0712/create_list.sh
./data/voc0712/create_data.sh
Training model
The following commands are trained in the downloaded Caffe root directory, and there are several. py files under EXAMPLES/SSD for a longer training period.
Python examples/ssd/ssd_pascal.py
Experimental results
(1) test on the picture test set
Python examples/ssd/score_ssd_pascal.py
2 Test on the video
3) test on the camera head
Python examples/ssd/ssd_pascal_webcam.py
Error problem resolution and landfills notes:
1. Error: No module named Caffe errors
This is because Caffe's Python environment variable is not configured and can be resolved as follows:
Make sure the next Pycaffe is reset first, and then configure the Python path to the environment variable
Make Pycaffe-j8
Vim ~/.BASHRC
Add to export PYTHONPATH=/SSD directory/caffe/python
SOURCE ~/.BASHRC
2. "Check Failed:error = = cudasuccess (0) Invalid device ordinal" resolved when configuring Ssd-caffe tests
Run Python examples/ssd/ssd_pascal.py times wrong
Solution: This is due to the number of GPU mismatch, if the training of their own data, then we only need to change the device_id item in the Solver.prototxt file to their own GPU block number, a piece is 0, two is 1, and so on.
But the example of SSD configuration is the integration of training statements into a Python file ssd_pascal.py, so you need to change this code. Related Configuration training Methods please refer to reprinted blog: http://blog.csdn.net/xunan003/article/details/78427446
Workaround: The No. 332 line in the ssd_pascal.py file GPUs = "0,1,2,3" GPU selection to GPUs = "0", after the 1,2,3 are deleted. You can train again.
Of course, because the blogger has only one GPU and the computer runs a limited amount of memory, it is also necessary to ssd_pascal.py files in the 337 lines Batch_size = 32 and 338 lines Accum_batch_size = 32 are changed smaller, that is, change the batch size, or it will appear " Check Failed:error = = cudasuccess (2 vs. 0) Invalid ... "error.
3. Configuration Ssd-caffe appears "Attributeerror: ' Module ' object has no attribute ' labelmap '" solution
This is because Caffe's Python environment variable is not configured and can be resolved as follows:
Vim ~/.BASHRC
Add to export PYTHONPATH=/SSD directory/caffe/python
SOURCE ~/.BASHRC