0

I have webcam which detects faces and stores them in a image repository. In the repository only faces(image) will be stored in which i have multiple duplicate faces. Is there any option which i can detect duplicate faces ?

I tried by computing hash value of the image but it could only detect duplicate images not faces. Please suggest best possible solution.

I tried with the link https://www.tensorflow.org/api_docs/python/tf/contrib/learn/KMeansClustering but i was unable to input images and execute.

Thanks avinash

markalex
  • 8,623
  • 2
  • 7
  • 32

1 Answers1

2

Face detection = identifying the fact that a face appears in an image, and locating where it is in the image.

Face recognition = matching the face to a known person's identity, or matching multiple face images to each other based on the fact that they are images of the same person.

You say your webcam does (at least) face detection. Your question indicates that you also want to do recognition.

Both these processes require the extraction of high-level invariants in the image. Computation of these invariant feature representations is pretty much at the cutting edge of modern computer vision. Simply hashing pixel values is light-years away from this: the hash of an image will differ by an arbitrary degree as soon as the intensity of even one pixel changes by even one level in even one channel. And of course, a tiny change like that does not change the identity of the face in the image. Even much, much larger changes at the pixel level will not necessarily change the identity - they might be due to rotation of the head, different lighting conditions, beards/sunglasses/hairstyle changes, etc.

If you say that your webcam "detects faces", is that due to face-detection technology supplied by the webcam manufacturer? If so, start with their API documentation. Maybe they have support for face recognition as well? Check that out, and then google "face recognition library" to compare other software approaches to this complex problem.

One option you might decide to explore further is OpenCV, which has Python bindings and which contains tools for both detection (using the CascadeClassifier object) and recognition (using FaceRecognizer). Here is a tutorial: http://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html

Most "recognition" approaches are supervised in that they require a "training set" to be specified in advance. Maybe your application allows for this: maybe you know in advance who is going to be in the photos and already have pictures of them, each associated with an identity. (For example, Facebook's face recognition is able to exploit the fact that people have previously tagged faces in photos and thereby provided multiple training points for images that are associated with a particular identity.) If not, then you'll have to come up with some scheme of building a training set on-the-fly, and continuously or periodically updating the training. This particular subtype of face recognition problem can be described as "unsupervised face clustering" - i.e. grouping face images together without knowing a-priori the identity of any of them. Facebook also does this to some extent. This is even closer to the cutting edge of the cutting edge, and you'll probably need to delve into the computer-science literature to figure out how it's done. See here, for example: http://bitsearch.blogspot.com/2013/02/unsupervised-face-clustering-with-opencv.html

jez
  • 14,867
  • 5
  • 37
  • 64
  • Thanks jez, could u pls suggest me how to cluster the images using tensorflow – Avinaash Gollapudi May 25 '17 at 10:06
  • 2
    To get help on stackoverflow, show specifically what you have attempted, what you expected to happen and what went wrong. For specific help with a particular toolbox, I suggest doing so in a new question. – jez May 25 '17 at 15:43