In past few weeks, I have learned a lot about Neural Networks. Now, I am looking forward to create a Neural Network program that can recognize individual human faces. I tried searching it online but was able to find only small pieces of information.
What are the steps for implementing such a program from scratch?
-
$\begingroup$ What exactly do you want? A program that tracks a human face OR a program that can detect a human face and the person that face belongs to? $\endgroup$– UgnesCommented Apr 28, 2017 at 12:47
-
$\begingroup$ I want exactly the second kind of program. $\endgroup$– Gianmarco6000Commented Apr 28, 2017 at 19:53
3 Answers
I am assuming that you are new to all this. You can start with making a basic human face detection. Train the program to detect a human face with very good accuracy. This will help you to get familiar with the coding ground related to image processing and basic machine learning.
After that train your program to identify faces of only 2-3 people. Trying for too many in the beginning won't be a good idea. Test your program's accuracy in different situation, with a different number of crowd, etc.
If it's working fine then you can train your program for more individuals. In addition to this leave room for learning from experience in your code. Some codes only learn once and they implement the same thing for their whole life. A nice example of this kind is OCR. If a face is detected wrongly OR your program detects a new face about which it doesn't know anything. Then you should be able to tell the program and it should include that in its database. I think some form of reinforcement learning will help. Not much sure about it though.
Now the Implementation
I will highly recommend you to learn python and get familiar with OpenCV. You can think of OpenCV as a collection of libraries. I find them very helpful for image processing and machine learning. Another good thing about it is that you can import OpenCV in python, Java or C++ according to your need.
OpenCV has an inbuilt function that allows it train a neural network for positive and negative images. The success of your program depend highly on your choice of positive and negative images, so choose them wisely. The result of the training is stored as a haar cascade file. This cascade file can be used in your program to use the trained data and function accordingly.
For basic human face detection, you can find the cascade file online and implement a code like this
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml');
For detecting individual faces you will need to make different classes. The number of classes will represent the number of individual faces you want to detect in the beginning.
You can find OpenCV tutorials here.
DLIB has AA-class face detector based on ResNet model. Here is C++ example. The accuracy is much better compared to HAAR/LBP but performance is worse (but much depends on parameters passed to HAAR/LBP detector)
The latest version of OpenCV also contains face detector based on ResNet model, but I did not try this.
If you want to implement recognition you've just to train a convnet or CNN on a lot of images in which there are faces, and then you classify it 1 if there are faces and 0 if there aren't. If you want to do detection you have to use different approaches like a cascade classifier whit CNN or an object detection network like YOLO or SSD.
-
$\begingroup$ Thanks for the information, my purpose is to find a particular face in images. Let's say i have a particular person's face image, i would like to achieve all the images with that face. What's the best way to face up the problem? $\endgroup$ Commented Apr 25, 2017 at 20:50