1
$\begingroup$

I am working on a small app for face detection in Python using face_recognition and opencv libraries.

I have trained the data on a number of people and used face recognition to login into the app.

If it detects the person from the picture, it allows him to log in, otherwise they are sent to the registration screen where the person has to upload his photos and other information.

So if a new registration comes in, I have to run the model again with additional data.

As the number of entries increases the model will take more time, affecting the time to identify a newly registered person.

How can I prepare for this slow-down, down the road?

Can I reduce the time taken to train the model again or train the model with incremental data?

$\endgroup$
2
$\begingroup$

If you need to re-train the model to classify new faces, this will not scale well to registering new people routinely. You may also suffer from glitches in accuracy during new registrations unless the training routines are carefully monitored.

Instead, recognition systems that need to register new items typically don't re-train. They are trained on the general task of separating objects - identifying whether they are different or what is different about them.

One common way to achieve this separation is to use the NN to map images of faces to a descriptive vector, and match each new image according to distance to stored vectors of profile pictures. The distance, even to the closest stored vector, should be small in order to consider it a successful match. Registering a new user is then a matter of saving a new vector embedding calculated from the neural network. Matches can be done with database lookups - they are still limited by how fast you can do the distance calculations looking for a match, but you only need run the NN forward once. The distance calculations can be fast and batched - it should be easy to use e.g. tensorflow or torch to calculate 1000 potential matches in a fraction of a second.

To ensure that faces are well categorised according to their differences, ignoring lighting, pose, hairstyle etc, the network needs to be trained with this objective in mind. One way to do this is to train with triplet loss using two pairs of images, one that should match, another that should not.

Andrew Ng's course on CNNs covers this approach very well, starting from this lecture.

$\endgroup$
1
$\begingroup$

I faced a similar problem. What I did was as follows.

  1. Save the features extracted for each face in a file.

  2. Load those features when running the model again.

Though it took some time to complete the successful working project, the result was satisfying.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.