Web-based Face Recognition Attendance System with Anti Spoofing
We have made a web-based Facial Recognition Attendance System built with Python language and Streamlit framework. We made this project for the final exam of the intelligent application systems course. This project made and tested in python 3.11.2
The system is designed to accurately identify and record attendance using facial recognition while incorporating measures to prevent spoofing attempts.
The System built with Face Recognition using Inception Resnet (V1) models in pytorch, pretrained on VGGFace2 and CASIA-Webface datasets, also Anti-Spoofing models by Minivision.
For the code, visit our Github link : https://github.com/AyuVirgiana/face-recognition-attendance-anti-spoofing.git
CHALLENGE
The difficulty in making this application is the anti-spoofing integration. That was a challenge from our lecturer because facial recognition without anti-spoofing is a common thing.
FEATURES
The application allows users to perform the following tasks:
Visitor Validation: Capture an image using the camera and perform face recognition with anti-spoof to differentiate between real and fake faces and validate visitors. The system checks the captured face against the database of known faces and identifies the person if a match is found.
Fake Face Scenario:
Real Face Scenario:
View Visitor History: View the history of visitor attendance, including their ID, name, and timestamp of the visit. Additionally, the application provides an option to search and display images of specific visitors.
Add to Database: Add new individuals to the database for future recognition. Users can input the person’s name and either upload a picture or capture one using the camera. The system maintains 2 data storage (CSV files) for visitors information.
MODELS
- Face Recognition : We use InceptionResnetV1 Models, pretrained on VGGFace2 and CASIA-Webface datasets. The datasets is aligned using MTCNN. WHY MTCNN? The Dlib face detector misses some of the hard examples (partial occlusion, silhouettes, etc). This makes the training set too “easy” which causes the model to perform worse on other benchmarks. To solve this, we use Multi-task CNN for face landmark detector that has proven to work very well in this setting.
- Anti-spoofing: MiniFASNet variants include MiniFASNetV1, MiniFASNetV2, MiniFASNetV1SE, and MiniFASNetV2SE supported by Silent-Face-Anti-Spoofing developed by Minivision.
Training for Face Recognition Model
The CASIA-WebFace dataset has been used for training. This training set consists of total of 453 453 images over 10 575 identities after face detection. Some performance improvement has been seen if the dataset has been filtered before training. Some more information about how this was done will come later. The best performing model has been trained on the VGGFace2 dataset consisting of ~3.3M faces and ~9000 classes.
Get Ayuvirgiana’s stories in your inbox
Join Medium for free to get updates from this writer.
Classifier training of inception resnet v1 page describes how to train the Inception-Resnet-v1 model as a classifier, i.e. not using Triplet Loss as was described in the Facenet paper.
Training for Anti-spoofing Model
cited from https://github.com/computervisioneng/Silent-Face-Anti-Spoofing.git
- The training set is divided into three categories, and the pictures of the same category are put into a folder;
- Due to the multi-scale model fusion method, the original image and different patch are used to train the model, so the data is divided into the original map and the patch based on the Original picture;
- Original picture(org_1_height x width), resize the original image to a fixed size (width, height), as shown in Figure 1;
- Patch based on original(scale_height x width), The face detector is used to obtain the face frame, and the edge of the face frame is expanded according to a certain scale. In order to ensure the consistency of the input size of the model, the area of the face frame is resized to a fixed size (width, height). Fig. 2–4 shows the patch examples with scales of 1, 2.7 and 4;
3. The Fourier spectrum is used as the auxiliary supervision, and the corresponding Fourier spectrum is generated online from the training set images.
References
- This project is supported by Silent-Face-Anti-Spoofing belongs to minivision technology. Special thanks to Minivision for providing the anti-spoofing models used in this test.
- Face Recognition using Pytorch by timesler.
- Pytorch model weights were initialized using parameters ported from David Sandberg’s tensorflow facenet repo.
Contributors
- Ayu Purnama Virgiana (210040171)
- I Komang Adisaputra Gita (210040017)




