Deep Learning Caffe Practical notes (+) Windows platform FASTER-RCNN make your own datasets

Source: Internet
Author: User

Long March the first step, is to make their own data sets, the process is more cumbersome, especially the process of labeling, this blog first introduced if the production of voc2007 own data set for FASTER-RCNN training, the next blog describes how to use FASTER-RCNN training their own data.

1. Prepare the image
Image to use. jpg or JPEG format, if it is PNG or other format, you can convert it, the image name to use 000001.jpg, only and VOC2007 data set image name consistent, in order to minimize the trouble behind the training, we may download some batch rename tool from the Internet, I am using Matla b code to achieve the conversion, I put the MATLAB code here, if you need to modify the path to use

The% implementation renames the image to the same image name as the VOC2007 DataSet%d1 is the folder where the original image is stored, the path in Imwrite is the saved folder%UPC Yongbiao Gao heroin Pau Jion%csdn Blog address: http://blog.csdn.net/gybheroinClccleard1=dir (' G:\Deep Feature extra\ by year data \2011\2011test\*.jpg '); forI=1: Length (D1) i i=imread ([' G:\Deep Feature extra\ by year data \2011\2011test\ ', D1 (i). name]); Re=imresize (i,[ -, -]);% Note, here I have the image normalized size, optionalif(i<Ten) Imwrite (re,[' G:\fasterrcnn\data\ ',[' 00000 ', Num2str (i),'. jpg ']]);End    if(Ten<=i&&i< -) Imwrite (re,[' G:\fasterrcnn\data\ ',[' 0000 ', Num2str (i),'. jpg ']]);End    if( -<=i&&i< +) Imwrite (re,[' G:\fasterrcnn\data\ ',[' a ', Num2str (i),'. jpg ']]);End    if( +<=i&&i<10000) I imwrite (re,[' G:\fasterrcnn\data\ ',[' xx ', Num2str (i),'. jpg ']]);End    if(10000<=i&&i<100000) I imwrite (re,[' G:\fasterrcnn\data\ ',[' 0 ', Num2str (i),'. jpg ']]);EndEnd

2. Image Target Box Callout
Image labeling tools online should have some, but bloggers like to own hands and clothing, so he wrote a note with C#+EMGUCV himself software, I put the VS project in Csdn Resources, want to use the software I write the students please download, the code in the image path needs to modify the line: HTTP ://download.csdn.net/detail/gybheroin/9847647
The image labeling software interface is as follows: (one hours of writing something, simple, but the function is no problem)

How to use: Enter the category label in the text box, the mouse in the image to drag the implementation of the rectangle box, save the button to save the label labels, if the box is wrong, click the Cancel button, re-annotate.
The label file format is as follows: Image name, category name, upper-left corner of the target box, and lower-right corner coordinates.

000001.jpg person 118 48 273 572000002.jpg person 106 52 291 557000003.jpg person 119 49 289 554000004.jpg person 114 45 270 566000005.jpg person 96 35 328 564000006.jpg person 104 50 316 586

3, made of XML
Do XML code I use other people's resources, if you do not abandon the trouble, you can write a, I refer to the resource address: http://download.csdn.net/detail/sinat_30071459/9531172

Put the image in a folder, put the marked files in a folder, can automatically generate XML files, the resulting XML file format is as follows:

4. Generate TXT index file
Requires four index files, respectively, Trainval.txt,train.txt,val.txt,test.txt, respectively, storage training validation set, training set, validation set, test set, VOC2007, training validation set accounted for 50%, test set accounted for 50%, Training set accounted for training validation set 50%, validation set accounted for training validation set 50. But I marked the data set a little bit smaller, so I changed the corresponding proportion, we can refer to the MATLAB code I wrote:

% implementation to generate VOC training verification test Four text files, I this is in order to achieve, no upset order, if necessary, please modify their own%trainval of 0.7,test accounted for 0.3.train of Trainval of 0.5,val of Trainval% This place is my own set, the standard voc2007 should be 50%%UPC Yongbiao Gao heroin Pau Jion%csdn Blog Address: Http://blog.csdn.net/gybheroinClccleartrain_val_percent=0.7; test_percent=0.3;D =dir (' imgg/*.jpg '); Ftrainval=fopen (' Trainval.txt ',' W '); Ftest=fopen (' Test.txt ',' W '); Ftrain=fopen (' Train.txt ',' W '); Fval=fopen (' Val.txt ',' W '); for I=1:length(D) *train_val_percent fprintf (Ftrainval,'%s\n 'DI). Name (1:End-4));End for I=length(D) *train_val_percent+1:length(D) fprintf (Ftest,'%s\n 'DI). Name (1:End-4));End for I=1:length(D) *train_val_percent*0.6fprintf (Ftrain,'%s\n 'DI). Name (1:End-4));End for I=length(D) *train_val_percent*0.6+1:length(D) *train_val_percent fprintf (FVal,'%s\n 'DI). Name (1:End-4));End

Then create a new folder Imagesets, and then create a new folder. Main, put four files in. Create a new folder Minedataset, put the imagesets,annotation (all the XML files) and Jpegimages (store all the training verification test images) in, so that data preparation is completed.

Deep Learning Caffe Practical notes (+) Windows platform FASTER-RCNN make your own datasets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.