Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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, 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)

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)