Improving the recall score¶
The precision score is very high (Spoof images correctly flagged as Spoofs) but the recall score may be low (Genuine images flagged as Spoofs) if your images do not match some requirements. This section explains how to improve the recall score by controlling the kind of images the user will provide. More info about precision and recall scores at https://en.wikipedia.org/wiki/Precision_and_recall.
Our web demo at https://www.doubango.org/webapps/face-liveness/ is provided in unconstrained environment which means any kind of images could be used to test our implementation. Trying with random images you’ll find it hard to pass the liveness test. Most of your images will be rejected as being spoofs. This is normal, most images on the internet are heavily edited (photoshopped) or recaptured. Also, the face pose, lighting and expression should match ISO/IEC 19794-5 recommendations.
These kind of mistakes can be easily avoid in controlled environment. A controlled environment may be your mobile application, you have the control of the camera.
The 7 commandments¶
These are the 7 commandments to pass the liveness test. The first commandment is a must and the others are optional.
1. Face must be large and close¶
If there is one commandment you have to respect, it would be this one. We recommend having the face very close to the camera lens and occupying between 80% and 90% the surface of the image. The face should be at least 600px in width and height. To determine the liveness of the face we have to analyze the texture of your skin, the light reflection on your eyes, the direction of the edges and other parameters.
2. Do not trust online images¶
Most images on the web are heavily edited (photoshopped) or recaptured. So, don’t assume an image is spoof or genuine unless it’s yours our created in controlled environment (e.g. from a Liveness dataset).
3. Selfie-type image (front facing) with neutral expression¶
The deep learning model was trained on selfie-type images (front facing). If the face is not looking at the camera lens, then we’ll most likely flag it as spoof.
The face should have neutral expression.
4. Use high resolution images¶
Higher the resolution easier it would be to pass the liveness test. We recommend at least HD resolution (1280x 720). Off course you must not try to enlarge (resize) a small image to match the recommended resolution.
The camera should have 3MP resolution or more.
You can for example check this image or this one to see the kind of quality we expect.
5. Do not use grayscale images¶
The model was trained with RGB images, grayscale images will be rejected as spoofs. You may even not reach the liveness module as the face detector was also trained on RGB images.
6. Use reasonable compression ratio¶
Make sure your images (PNG, JPEG, BMP…) are not heavily compressed. We use the edges as a metric. Heavily compressed images are smooth and will likely be flagged as spoofs.
7. Disable “Beauty” filter¶
On most Android phones this filter is enabled on default. This is specially true with Samsung devices (e.g. Galaxy S10+). This filter smoothen the skin and the selfie may be flagged as spoof if the smoothing threshold is too high.
We recommend disabling all filters (beauty, red eye remover, background blur…).
Disabling the filters is a recommendation not a requirement.