A framework for SSD target detection –2017.3
References: official website: HTTPS://GITHUB.COM/WEILIU89/CAFFE/TREE/SSD Blog: http://blog.csdn.net/wizardna521/article/details/53463348 Introduction to SSDs
SSD is Dr. Weiliu's deep learning framework for real-time target detection based on Caffe. Compared with the faster rcnn, the speed of the target detection has been significantly improved, and the accuracy has been increased, but the accuracy is much higher than that of YOLO. In the tradeoff aspect of precision and speed, SSD can be said to be the advantage combination of YOLO and faster rcnn.
The traditional target detection (faster RCNN series) requires the region proposal process, which means that the candidate areas need to be extracted beforehand, and then the area is sorted. SSD does not need to region proposal, but adopts the method of using default mask to detect the target at last. SSD generates thousands of default box for forecasting. Each feature map produces 6 aspect ratio different default box, each layer output contains K feature map, each feature map has m x n pixels, each layer can produce 6kmn default box Different layers of output can produce different scale of feature map, shallow output produces small scale (small target) default box, deep output produces large scale (large target) default box. In the VOC2007 experiment, he used the conv11_2 map of Conv4_3,conv7,conv8_2, Conv9_2, Conv10_2, and feature. Make Data
The data that you need to train to make Pascal format, MATLAB code is as follows:
% Create skeleton detection label like PASCAL% Huahui Chen, 2017.3.24 source_data_dir = '/home/chh/icme/data/detection/p
Ku_skeleton_renew ';
Source_label_dir = '/home/chh/icme/data/detection/train_label_pku_final ';
Dest_label_dir = '/home/chh/icme/data/detection/detection_label ';
Source_label_total_filename = Dir ([source_label_dir '/*.txt ']);
Pic_height = 512;
Pic_width = 512;
Pic_channel = 3;
Parfor i = 1:length (source_label_total_filename) I filename = Source_label_total_filename (i). Name;
[A, filename_nopost, post] = fileparts (filename);
Fid_dest = fopen ([dest_label_dir '/' filename_nopost '. xml '], ' w ');
Fid_source = fopen ([source_data_dir '/' filename_nopost '. txt ']);
Frame_num = 0;
while (Fgetl (Fid_source) ~=-1) frame_num = frame_num + 1;
End fprintf (fid_dest, ' \ n ');
fprintf (fid_dest, ' \t%s.png\n ', filename_nopost);
fprintf (fid_dest, ' \tskeleton\n ');
objects = Csvread ([source_label_dir '/' filename_nopost '. txt ']);for j = 1:length (objects) fprintf (fid_dest, ' \t\n ');
fprintf (fid_dest, ' \t\t%d\n ', objects (J, 1));
fprintf (fid_dest, ' \t\t\n ');
fprintf (fid_dest, ' \t\t\t%d\n ', UInt16 (Objects (J, 3)/frame_num * pic_width));
fprintf (fid_dest, ' \t\t\t%d\n ', UInt16 (Objects (J, 2)/frame_num * pic_width));
fprintf (fid_dest, ' \t\t\t%d\n ', pic_height);
fprintf (fid_dest, ' \t\t\t%d\n ', 1);
fprintf (fid_dest, ' \t\t\n ');
fprintf (fid_dest, ' \t\n ');
End fprintf (fid_dest, ' \t\n ');
fprintf (fid_dest, ' \t\t%d\n ', pic_channel);
fprintf (fid_dest, ' \t\t%d\n ', pic_height);
fprintf (fid_dest, ' \t\t%d\n ', pic_width);
fprintf (fid_dest, ' \t\n ');
fprintf (Fid_dest, "");
Fclose (fid_dest);
End
Creating Lmdb Data
Copy the resulting data to the following directory:
*.xml--> $ (SSD)/data/vocdevkit/voc2007/annotations
*.jpg-–> $ (SSD)/data/vocdevkit/voc2007/jpegimages
Place Trainval.txt and Test.txt in $ (SSD)/data/vocdevkit/voc2007/imagesets/main/. Note that the content is a filename with no suffix. such as 0002-l
Modify Labelmap_**.prototxt Content
CD $ (SSD)
Modify create_list.sh path, etc.
./data/voc0712/create_list.sh
Generate Trainval.txt test.txt test_name_size.txt in data/voc0712
Modify create_data.sh path, etc.
./data/voc0712/create_data.sh
In Data/vocdevkit/voc0712/lmdb/voc0712_test_lmdb trainval_lmdb training Modify ssd_pascal.py path etc
Python examples/ssd/ssd_pascal.py
$ (SSD)/models/vggnet/voc0712/ssd_300x300/generation Network and model weights
$ (SSD)/jobs/vggnet/voc0712/ssd_300x300/generate job file, log file, Python script test
The Python examples/ssd/score_ssd_pascal.py that the official web gives will produce score and Bndbox, the corresponding label is the filename, not very applicable
Ssd_detect.bin can produce lable, the source file is Ssd_detection.cpp
Results saved in Test_detect.txt
./build/examples/ssd/ssd_detect.bin Models/vggnet/voc0712/ssd_1000x300/deploy.prototxt Models/VGGNet/VOC0712/SSD _1000x300/vgg_voc0712_ssd_1000x300_iter_40000.caffemodel data/voc0712/test_detect.txt--out_file jobs/VGGNet/ Voc0712/ssd_1000x300/test_detect.txt
Graphic display:
Python examples/ssd/plot_detections.py jobs/vggnet/voc0712/ssd_1000x300/test_detect.txt/--labelmap-file data/ Voc0712/labelmap_voc.prototxt--save-dir jobs/vggnet/voc0712/ssd_1000x300/--visualize-threshold 0.1
A job is equivalent to a project in which you have scripts and logs for training, testing, and scripts or programs that are generated by these steps to run independently of the script or program.