OPENCV Cascade Classifier Training

Source: Internet
Author: User

This blog is written in a very detailed https://blog.csdn.net/qq_30028077/article/details/50483205

Now, let's write about the course of my training.

1. Training Sample Image search: You can refer to my previous article, through the URL to download Web images quickly find positive samples, here I do is strawberry recognition

https://blog.csdn.net/qq_35971623/article/details/79684219

Negative sample Collection I am a total of 5,000 links downloaded online:

2. The sample description file (TXT) is generated after the positive and negative samples are prepared.

Using the cmd command to enter the corresponding sample folder, the CD path name

Then enter Dir/s/b>info.txt to generate the sample description file, minus the last line

Note that the description file of the positive sample needs to be added 1 0 0 width height, where width,height refers to the positive sample width and height, negative samples do not need to do so, but need to be generated in front of the description file with the absolute path of the picture, or may error


3. In the generation of positive samples need to be normalized the size of the picture, which can be used in the United States 美图秀秀, bulk modification size









4. In the downloaded OpenCV folder, locate the Opencv_createsamples.exe and Opencv_traincascade.exe and paste the two EXE files into the training folder.


5. Create two BOS command files as shown in figure. bat usage and cmd command line are the same, the advantage is that you can save the view

The Create_vec.bat file is used to generate the Pos.vec file, and the content command inside of me is C:\Users\Administrator\Desktop\xml-strawberry\pos\opencv_ Createsamples.exe-vec C:\Users\Administrator\Desktop\xml-strawberry\pos\pos.vec-info C:\Users\Administrator\ Desktop\xml-strawberry\pos\info\pos.txt-w 100-h 100-num 850

Pause

Note that it is best to write absolute path, otherwise error prone

6. After generating the Pos.vec, use the Data.bat file to produce the trained. xml file, my command C:\Users\Administrator\Desktop\xml-strawberry\pos\opencv_ Traincascade.exe-data C:\Users\Administrator\Desktop\xml-strawberry\pos\data-vec C:\Users\Administrator\Desktop\ XML-STRAWBERRY\POS\POS.VEC-BG C:\Users\Administrator\Desktop\xml-strawberry\neg\bg_pic\neg.txt-numPos 600-numneg 2400-numstages 15-featuretype hog-mem 600-w 100-h 100-minhitrate 0.99-maxfalsealarmrate 0.4-mode All

Pause

Note here that the folder behind-data is used to store the generated. xml file, this folder needs to be created by itself or it will be an error

6. Back to show me the training situation


Training is slow, patient wait, I trained only 13 floor spent the hours

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.