Ask Your Question
0

how to creating cascade classifiers or improving them

asked 2015-04-24 07:17:01 -0500

215 gravatar image

updated 2015-04-24 07:17:25 -0500

How do i using openCV create or improve on an a already existing cascade classifier. I have a ROI consisting of of the object which i want to track (positive image) and the rest of the frame is what i don't want to detect (negative image). I just read somewhere that OpenCV provides an application which is capable of training these classifiers, but i am more interested in using an already existing one, like the haarcascades_Frontal_face_alt2, and improve it such it is capable of tracking only my face from different angles, poses and so on, is it possible to code such a solution?, and how would one do so.

I am thinking making the learning unsupervised or semi supervised. but I am not sure on how to handle this issue code wise.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-04-24 07:28:19 -0500

For the creating of a cascade classifier you should read up on

  1. The principle
  2. The training interface
  3. The example detection software

All the software is found in the application folder. There you have annotation, sample creation and training software.

Updating an existing model is not possible in OpenCV. It will require you to re-engineer the training software to pick an already trained model and continue on that. Also multiple angles will be a problem for the cascade classification since it is NOT rotation invariant.

edit flag offensive delete link more

Comments

Thank you for your response. It is very much appreciated.

The trained classifier was intended to be used part application being able to detect a face, and track its movement. The/a face can easily be detected using a Haarcascades, and using Lukas kanade optical flow, a mask can be created where the Face is known to be. The problems occurs though when i Move outside of this mask, i need to redetect the face, and since the pose won't be frontal, i will get a problem on getting a fluent detection.. Thats why i while i was thinking while i was tracking it, I could learn the object, such that next time i have to detect, it would be easier.. But it doesn't seem to be that learning isn't as easy as i thought it would be...

215 gravatar image215 ( 2015-04-24 08:04:01 -0500 )edit

Hi Steven, for a research project I would also need the opportunity to update some of the included models (e.g., haarcascade_frontalface_alt.xml). Do you think it would be possible to use exactly the same settings and dataset by which the haarcascade_frontalface_alt.xml file was generated, complement the dataset with my own images, and run it again? Are these settings and dataset available somewhere?

TechWizard gravatar imageTechWizard ( 2015-05-19 03:58:40 -0500 )edit

OpenTLD.. Try and google it, might be what you are searching for

215 gravatar image215 ( 2015-05-19 14:40:09 -0500 )edit

@215 OpenTLD is far from the same as retraining a cascade model. It is basically an online feature learning tracker and quite the overkill if you do not need it, thus being terribly slow. @TechWizard updating a model by adding more data and retraining should work since training data is used sequentially by the process. However it depends on what you are aiming to achieve, it might be better to just retrain a complete new model rather than updating it.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-05-27 08:17:27 -0500 )edit

@StevenPuttemans I tried to train a cascade classifier by using only my dataset. The problem is that it produces an awful lot of false positives (while the haarcascade_frontalface_alt.xml has max. 1-2 false positives, my custom classifier has sometimes 40-50 false positives) during detection. Do you have any suggestions how could I make it more accurate? Here is my current setup: I have 6 fullHD videos (400 frames each) together with their ground-truth. I extracted all faces based on the ground-truth and scaled them to 24x24 pixel images. From this I have ~760 positive samples. Furthermore, I extracted ~1300 fullHD (1920x1080 pixel) frames, where nothing is going on (no annotation in the ground-truth), these are my background/negative samples. I created a 20 layer cascade.

TechWizard gravatar imageTechWizard ( 2015-06-02 03:55:50 -0500 )edit

@StevenPuttemans I've just realised that some of my positive samples are really dark and of really bad quality. Could this be the reason for the lot of false positives? Another thing: the training with 700 positive/1200 negative images of a 20-layer cascade takes only ~40 minutes on a 4-core i5 laptop. Isn't that too fast? Could it be that the training is not performed properly?

TechWizard gravatar imageTechWizard ( 2015-06-02 03:58:39 -0500 )edit

Yes it could be the reason. Also it kind of depends how specific your application is, as far as I know the vec file used to train the face models contains multiple thousand faces. So 700 is not that much. False positives can be reduced by adding more negative samples. False negatives can be solved by adding more positive samples and make your cascade more descriptive for the model class. As to the training being fast, that is probably because 20 stages is not enough for your problem and seperating them to that level is quite straightforward. Try increasing the stages and you will notice that it will slow down rather soon.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-02 08:18:08 -0500 )edit
Login/Signup to Answer

Question Tools

3 followers

Stats

Asked: 2015-04-24 07:17:01 -0500

Seen: 801 times

Last updated: Apr 24 '15