Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the method to detect whether a given picture is human face or not?

Is there any simple algorithm to judge whether a given image is face or something else (without training hopefully)?

My thought is to construct the eigenvectors of each image, then apply some clustering method (for example k-means with k = 2). But I'm not sure what will be the best criteria to distinguish face/non-face even if a good clustering result is obtained?

like image 594
ChuNan Avatar asked Oct 23 '25 19:10

ChuNan


1 Answers

Eigen decomposition reduces dimensionality in continues domain by finding directions in data space with high variance. K-means finds clusters in space with high density of points. You kind of mixing them together while completely ignoring how would you arrive at the face features on the first place (how would you scale, rotate and crop whatever you want to inspect either).

You don’t need to train Haar detectors since they are already trained for faces. They detect a face, not recognize its identity. ALl you need is to port the code together with a little file with parameters obtained after training (that was already performed) as Shiva suggested above.

Thoughtless copy-pasting of the code doesn’t make much sense though. Read a bit about Haar. Try to understand

  1. Why they work - faces have features most pronounced on the intermediate spatial scale such as eyes, nose, brows. Too small (size of the pupil) or too large (size of the whole face) features are less useful.
  2. why Haars are preferred to wavelets or Gabors - Haars are just raw (boxy) approximations of Gabors but since they can be quickly calculated with Integral images they are preferred to more precise but slower counterparts;
  3. what are the restrictions - Haars have their own spatial scale and orientation but can be quickly recalculated for another scale.
  4. How to train Haar classifier (the most exciting topic you are trying to avoid). Ada boost is the one way to train a more complex classifier consisting of several Haars. Finally to speed up processing you can ask a slightly different question instead of find me a face. Namely, you can try to quickly eliminate the areas in the image that cannot be a face. This is called a cascade classification. Study these aspects in a systematic way and you will learn more about face detection than you’d do from the code pasting.
like image 174
Vlad Avatar answered Oct 26 '25 16:10

Vlad