The process of data processing of Caffe run Alxnet

Source: Internet
Author: User

Environment:Windows

Recently ran a alxnet network with caffe, now summarize the data processing part: (processed Data packaging link: HTTP://PAN.BAIDU.COM/S/1SL8M5AD password: ph1y)

(1) to obtain a data set , the way is:

1.Benchmark (database) AFLW FDDB

2. Latest Papers (2016)

3.Thinkface Forum

Data volume: A large amount of data support, at least 1w (positive, negative sample each 10,000), the format is as Follows:

Xxxx.jpg x1,y1,x2,y2 (label label), which is the coordinate of the rectangle where the face is.

Xxxx.jpg x1,y1,w,h

I am the cut-out face data downloaded directly from the Thinkface forum;

(2) Use the downloaded data set to produce positive and negative samples as well as. txt files :

Here's my method, which may be a bit awkward:

1. First set up the Imageset_2 folder as the total project folder, and then create a new two folder in it, a named 0, a named 1, respectively put the cut face data and Non-human face data, and then rename the picture (face picture named face_xxxx, Non-human face picture named non_face_xxxx);

2. Create a new mix, val, train folder (two new folders in train folder, one named 0, one named 1), write a Python applet, mix the pictures in 0 and 1 into the mix folder, and take 10% in the mix file Put the Val folder as the test data, and then take the remaining 90% of the face picture into the train folder in the 0 folder, non-human face images into 1 folders (5800 samples, negative samples 20000 or so);

3. First make train.txt, write A. Bat file in the 0 folder in train, with the following contents:

dir/b/s/p/w *.jpg > Train_0.txt

The above command writes the absolute path of each picture in 0 in the new Train_0.txt file, and then uses the TXT replacement function to remove the absolute path, followed by a label value, as Follows:

For 1 is also done as above, the contents of the Train_1.txt are as Follows:

Then the contents of the two files are integrated into the Train.txt file, we need to get the Train.txt file;

We do the same for Val.txt files, but we also want to divide the pictures in the Val folder into 0 and 12 folders (because Val has both face images and Non-human face images, cannot use the Replace function), and then make Val.txt files;

(3) Convert the positive and negative samples to the Lmdb format :

There is a convert_imageset.exe file in Build->x64->debug under the Windows downgrade Caffe install root directory to make Lmdb files (some people may only Have. cpp, Then you will need to build The. exe via vs Compilation)

Under linux, call the create_imagenet.sh file in examples->imagenet and rewrite it (see related blog online)

Here I describe how to convert lmdb format under Windows (to Write your own. bat file, full of Tears ...). )

First write a create_imageset_2.bat file in the Imageset_2 folder, which reads as Follows:

Then execute will create the Lmdb file in the corresponding path later;

(4) Image preprocessing

Use the Compute_image_mean.exe in build to subtract the mean from the image, and The. bat file reads as Follows:

Get the Corresponding. Binaryproto file

(5) Modify solver.prototxt and Train.prototxt files

Simply put, we only need to modify the path ( note that the path with \ \ or/, never use \!!!!!!!!

With the CPU, Solver:cpu,gpu words can be modified accordingly.

(6) Training Network :

Write the Train.bat file and start training with the Following:

Double-click to start the Training:

Configuration: I7,8G,CPU training, has been a day has not been good, highly recommended gpu!!!!

The process of data processing of Caffe run Alxnet

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.