An Android based implementation to recognize human faces without needing an internet connection. The app uses deep learning Mobile Facenet model which is fast yet light enough to be used in a mobile device. The key features of this mobile application are
– Uses state of art deep learning architecture
– Works both offline and online– Stores face data locally on device
– Accurate in recognizing faces (With and Without Liveliness)
A working boilerplate code for Face Recognition for Android devices. Use the source code as base and build applications that needs face recognition features like attendance, access rights etc.
There are many ways to implement face recognition. One can use Machine learning models or use other algorithms based on facial geometry or a standard template in order to recognize faces. There are libraries, OpenCV being the widely used that implements Machine learning based models and even non-Machine learning based algorithms. Specifically, OpenCV has libraries like DLIB, FACE_RECOGNITION that makes it quite easy to implement face recognition. However we won’t be using OpenCV based methods in the current implementation as they don’t perform so well on mobile devices due the size of the models and the frame processing speed. Further, accuracy is also a concern.There are other Machine learning models like FaceNet (https://github.com/davidsandberg/facenet). with tempting accuracy. This model can be converted to be used on Mobile devices using TensorFlow Lite. The experiments have shown that the accuracy is higher than other models however it takes slightly more than 3 seconds to recognize faces. If your users are happier with the latency then it’s a good fit. But there is a better model available that is accurate and also fast enough. It’s called MobileFaceNet. It’s designed with an extremely efficient CNN (Convoluted Neural network) and is specifically designed for high precision real time face recognition on mobile devices. The model has achieved an impressive speed with high accuracy with a just over 5MB of model file size. We will be using MobileFaceNet model in this project.
MORE ABOUT THE APPs
There are 2 apps given
- Face Recognition without liveliness check
- Face Recognition with liveliness check.Liveliness refers to the concept where we check if a live person and not a photo/image is shown to fool the algorithm.
When you run either of the apps with or without liveliness, you will be presented with
-Register option allows users to register a new face.
-Recognition option recognizes an already registered face.
On Clicking Register option, the a screen will be shown with the following options
1. Camera switching button on the top left of the screen to switch from back camera to front camera and vice versa. When you load the app first time we need to give access rights to front camera. For the app that checks liveliness, in some mobile phones the option to allow access may be obscured by the apps message “Please wait. Verifying whether you are a live person”. All you need to here is to wait for the apps message to disappear and the ALLOW option will be visible.You need to click the camera switch option for the camera to be ON and then allow access rights.
2. The + sign on the top right of the screen allows the app to register a new person. Click that and input box to input a name for the person in front camera will appear.