Ask Your Question
0

Training Classifiers

asked 2015-11-30 23:20:13 -0600

Bhavik gravatar image

How to make the second classifier using HOG/SVM to cut out eye or eye+glass region and train the cascade.Although I have gone through http://answers.opencv.org/question/53... link and found some useful links about both SVM and HOG.But I couldn't figure out how to inplement it practically. It is far more comfusing as I couldnot run the hog.cpp in command prompt like the trainclassifier.exe.then how am I going to end up with the results Thanks in advance

edit retag flag offensive close merge delete

Comments

1

First of all, your link is NOT working, the topic does not exist. Secondly, what do you mean by second classifier? I am assuming you already have a face detector as a first stage? Thirdly you are mixing concepts up, HOG and SVM have nothing to do with cascade classifier training, which is based on the boosting learming principle. So please again put more effort into your questions!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-01 03:39:03 -0600 )edit

yea it has been removed I guess

Bhavik gravatar imageBhavik ( 2015-12-01 07:50:38 -0600 )edit

@Bhavik the problem is that the link is incomplete

LorenaGdL gravatar imageLorenaGdL ( 2015-12-01 08:11:36 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-12-01 04:00:59 -0600

thdrksdfthmn gravatar image

updated 2015-12-01 04:13:41 -0600

IMHO you should

  1. apply your detector (cascade) on images to see what it detects (and save all the detections).
  2. then you should manually classify the detections (cropped images) in true positives (eyes) and false positives (noise). Now you have a database. Be careful to use almost the same number of positives and negatives images
  3. train your SVM (based on the info here).
  4. Save your trained SVM in a file

After the train you will get a file that is the SVM classifier. Load it in your application and use it to classify your detections returned by your cascade (be careful, the samples shall be the same size as for training, so resize them first).

As a remark, using descriptors for training (dense features + extract descriptors, otherwise you will not get the same number of descriptors for each image) the SVM will be more accurate than using pixels values.

You can use the HOGDescriptors, too.

Another remark that I shall add is that you need to have a one row Mat per sample, so reshape all the samples (descriptors, or pixels values) to one row. More, for testing (predicting) you shall do the same way as for training, that is if you used pixels values, then for classifying you shall give the vector (one row Map) containing the pixels values, if you used descriptors, then extract the descriptors the same way as for training and give that as sample for prediction. In any case you shall use a one row Map, so you shall reshape it so it will have the same sample size as for training (or what SVM expects)

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-11-30 23:20:13 -0600

Seen: 23,258 times

Last updated: Dec 01 '15