I'm working on developing an face authentication system using Convolution Neural Network (CNN). I know that the CNN can be used to classify two classes. However, my problem is how can I train the CNN as the training set in the face authentication system should be only for the clients users?. In other words, how can I train my CNN using only one type of data? My dataset consists of 106 persons, each one has 50 images. Is there any idea on how can I divided my dataset to be suitable for the face authentication system? your help in this regard is highly appreciated.
One possible and simple approach in your case is the one-shot recognition. The idea is to use the pre-trained library that extracts the feature vector from the face images. So, you compile a DB with the unique vectors for each of your client faces. These vectors are in Euclidian space, meaning that you can simply calculate the distance between the images, and determine whether they are close enough to call it a match.
I used an old library called FaceNet, look it up in Interweb. The steps were in my case:
- find the face on image, and cut it out
- remove the background and possibly hair
- create 3d model of the face and turn it en face
- use FaceNet to extract Euclidian vector representing a face
Once you have the vectors, you put them in DB of recognized faces. The above procedure would be executed every time a picture is received. There is dedicated software for each of the steps above, or you can compile your own using the open source libraries
I wouldn't do this kind of DIY approach if there's any kind of liability involved. For instance, if you're building a security authorization to a prison. Reliable face recognition is a serious project. I'd buy commercial hardware/software systems for it.
Assuming your face authentication system is supposed to only detect users from the client database and reject those who aren't, the best way to train the model would be to use few images of all clients in the database and then test the model on the remaining images of those clients. For example,
Number of users = 106
Number of images per user = 50
Total amount of available data = 106 x 50 = 5300 images
Training Data: 35 images of all users => 35 x 106 = 3710 images
Testing Data: 15 images of all users => 15 x 106 = 1590 images
You could go ahead and also use a validation set and cross validation to better train your model.
You could try a siamese network approach.
The way to do that is to build a network that receives two faces and processes them in parallel, then concatenating/summing activations to obtain a single probability.
Instead of classifying faces as belonging to each person (106 classes), you reduce your problem to solely two classes: matching persons or mismatched persons.
Then, with new faces you can test them against the training data (ideally, you could store activations from training data, greatly accelerating the processing of new data).