Train own HOG

asked 2017-02-25 09:51:34 -0500

Davaaron gravatar image

Hi,

how to train a HOG in openCV? As I understood it correctly, it's just, besides Haar and LBP, another algorithm that can be used for face detection (and recognitiion). I want to achieve the first, so only face detection. I got around 5000 positive samples and 3000 negative samples.

As I can't find any explanation of how to train a hog, how to generate a SVM and such, I thought I could ask some professionals in here, as the openCV docs is the worst documentation I ever met (I can't win any useable information from there doc, especially when it's about implementation docs like for Java).

So, the concrete questions are:

  1. What to do first after collecting positive and negative pictures?

  2. How to train the HOG? (What is required for training it, how to DO the training and how to save the results [for further training?!])

  3. How to use the HOG in Java?

I'd appreciate some answers :)

Last but not least: I know it's a pretty awkward place to ask, but: isn't there another, better (documented, more efficient, more explained, more intuitive) library for detecing and tracking faces (in Java or Python)?

edit retag flag offensive close merge delete

Comments

as of opencv3.2, hog cascades are no more supported, so you can either:

  • train a HOGDescriptor, or
  • a haar or lbp cascade
berak gravatar imageberak ( 2017-02-25 11:17:32 -0500 )edit

Thanks for that hint! When searching on the web for HOGDescriptor, I just get results of some C++ code, but no openCV library tool that generates a data file of the result.

When training my own haar and lbp cascades (as the face detection is not so good with the standard XML-Files), the result was pretty disappointing as it detected several other objects than faces (legs, feet, bottles, ..).

I expect HOG to give a better result, right? Do you maybe have a good link for what I'm looking for? (how to use the HOGDescriptor properly)

Davaaron gravatar imageDavaaron ( 2017-02-25 11:54:58 -0500 )edit

you can try dlib

sturkmen gravatar imagesturkmen ( 2017-02-25 17:08:44 -0500 )edit

I see it's for python. I need to use Java tho.. openCV seems to be the only possibility tho... I think I need to expand my knowledge in neural nets if I wanted to train my own SVM, it seems. Unluckily the method names and parameters of opencv SVM aren't chosen happily, but well, I got some research going on.

Davaaron gravatar imageDavaaron ( 2017-02-27 15:22:51 -0500 )edit