accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.48k stars 1.99k forks source link

Question: Face recognition with tracking #1018

Open rover886 opened 6 years ago

rover886 commented 6 years ago

What would you like to submit? (put an 'x' inside the bracket that applies)

By using accord sample (accord-vision-face-tracking-(camshift)) I have implemented face detection and tracking in my project and it's great. Now, I want to perform face recognition along with tracking. Like, if say in frame if my face has come then along with rectangle it should display my name below and track it using Camshift.

Does accord support face recognition? How I should start towards it? Any tutorial/sample for accord?

cesarsouza commented 6 years ago

Hi @rover886,

Thanks for opening the issue!

(Edit: I had initially misread the question, so I am updating this answer with hopefully more useful information!)

Indeed, as you have mentioned, the framework supports face recognition and tracking as demonstrated in the face tracking sample application from the project's official website:

This sample application demonstrates how to initialize an object tracker (Camshift) using a face region (detected using the Haar / Viola-Jones object detector).

However, in order to achieve face recognition instead of pure detection, it would be necessary to first create a database of faces you would like to recognize and later learn a classifier to recognize them. One way to do so is to leverage the BagOfVisualWords class to obtain fixed-length features for each face in your dataset (irrespective of the image dimensions of the actual faces) and then classify them using a Kernel Support Vector Machine. This is actually demonstrated in one of the examples in the aforelinked page for the BagOfVisualWords class.

@blaisexen thanks for the help in answering! It has been much appreciated! I just wanted to ask if, in the next time, you would could please point to official samples whenever it is possible. The point is that most people might not want to download projects/executables from untrusted sources like mediafire.com. But other than that, many thanks!

Regards, Cesar

cesarsouza commented 6 years ago

Ooops, sorry @rover886 and @blaisexen, now I realize I had misread the question. The framework does not offer a standalone sample application for face recognition yet, but it should be possible to do it using BagOfVisualWords and SVMs after having collected sufficient training samples for each face to be recognized.

Regards, Cesar

cesarsouza commented 6 years ago

@blaisexen Thanks again for helping me recognize the mistake ;-) I have updated my answer with more practical information about the problem - and thanks again for your code example!

blaisexen commented 6 years ago

@cesarsouza no problem, your welcome :dancer:

rover886 commented 6 years ago

Oh! so much discussion in a night. Thanks @cesarsouza for putting lights on how we can achive recognition using BoW and SVM, also @blaisexen thanks sharing code as I am done with detection and tracking I wanted to know about recognition.

Before trying with Accord.NET i have tried with EmguCv in C# application. I have prepared dataset of 130 images (each with frontal face) and trained LBPH, EigenFace recognizers. But, I am no satisfied with the result which I am getting. Both the classifiers trying to recognize face by most nearest face found in training database also I am not be able understand how should I get threshold value from FaceRecognizer.PredictionResult, by which I can decide the confidence of matched face and that's the reason I started exploring about accord and aforge.

Anyways, that's a long story :p. I will start exploring about BoV and how I can achieve this. Thanks for putting light on this.

blaisexen commented 6 years ago

@rover886 we have the same problem, emgucv face recognizers are only good in static pictures, if only I can build my own sdk then I would but I have no enough information how to do it.

I have already done ALSO a face recognition using BOW with svm and hmm, but failed, and now trying backpropagation deep neural network, but I'm tired trying, ill do it soon.

good luck on your experiment.

steentottrup commented 6 years ago

Are anybody working on this? I would love to help, not that I have any idea on how to do it, but....