Ask Your Question
-1

How to create our own Haarcascade.xml.

asked 2014-07-26 01:07:14 -0600

Punith K gravatar image

updated 2020-12-06 05:33:14 -0600

How to create an haar classifier, by using some set of images/trainig set.

edit retag flag offensive close merge delete

Comments

1
Haris gravatar imageHaris ( 2014-07-26 03:35:33 -0600 )edit
2
1

I do appreciate people helping out BUT PLEASE put in some effort and use the search functionality... this been asked a million times before. Therefore my -1...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-26 10:53:05 -0600 )edit
1

That is a truly apt statement Steven. Even a simple google search will pop out all solutions from our forum.

Abhishek Kumar Annamraju gravatar imageAbhishek Kumar Annamraju ( 2014-07-26 12:18:56 -0600 )edit

Thank you guys for your answers. After searching all possibilities for creating haar classifier in Ubuntu 14.04 and in windows, there were no proper solution given, i have seen so many people posting their comment saying there are lot of errors. I want at least bug free tutorials to create my Haarcascade.

Punith K gravatar imagePunith K ( 2014-07-30 00:15:39 -0600 )edit

Hi, @abhishek Kumar, I refered your opencv-haar-training from your answer, I found the following error while merging it,

./mergevec samples.txt samples.vec OpenCV Error: Assertion failed (elements_read == 1) in icvGetHaarTraininDataFromVecCallback, file cvhaartraining.cpp, line 1859 terminate called after throwing an instance of 'cv::Exception' what(): cvhaartraining.cpp:1859: error: (-215) elements_read == 1 in function icvGetHaarTraininDataFromVecCallback

Aborted (core dumped)

Punith K gravatar imagePunith K ( 2014-07-30 00:30:36 -0600 )edit
1

I do not know where people get the idea that you need the mergetool. It is not standard openCV functionality but something built by a third person. The official train cascade tutorial has every single information you need! And it works perfectly here on Ubuntu 14.04 AND Windows 7 / 8.1. I am making a step by step tutorial for my project finals, will create a link to it once it is ready!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-30 03:29:37 -0600 )edit

@steven ..... The merge is being used so that greater number of samples can be prepared. The opencv_createsamples function when applied on a set of images provides only the same number of samples as the number of images in the training. But when applied on single image multiple samples can be generated. So I have created a perl file that takes images one by one and then applies the create samples function. And the merging code to pass on every vec file to a single one.

Abhishek Kumar Annamraju gravatar imageAbhishek Kumar Annamraju ( 2014-07-31 02:05:52 -0600 )edit
1

Which is actually the WORST way for creating a cascade model. Everyone with actual applications will tell you that a model cannot be build by using the artificial example generation of the createsamples utility. It will create a terrible set of unnatural training samples which results in a model trying to capture stuff that can never happen in real life situations. I always suggest people to move on from that documented approach and just put effort in gathering training sets with actual data. State-of-the-art detection algorithms avoid these artificial translations rotations and so on at all costs!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-31 02:14:33 -0600 )edit

I think that is indeed a good idea. The merging functionality comes from the time that haartraining utility was used. I am sure that if you know exactly what you doing, it can still be usefull in some cases BUT people are using it for the wrong reasons.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-31 02:31:23 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-07-31 02:20:44 -0600

@steven will consider your comment and will update my tutorial on haar-cascades :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-07-26 01:07:14 -0600

Seen: 3,442 times

Last updated: Jul 26 '14