Smart face mask and didtance detector
After the breakout of the worldwide pandemic COVID-19, there arises a severe need of protection mechanisms, through which we can ensure the following of sops and keep an eye close to the present situation in our specific areas and for this mechanism, face mask being the primary one. The basic aim of
2025-06-28 16:35:20 - Adil Khan
Smart face mask and didtance detector
Project Area of Specialization Artificial IntelligenceProject SummaryAfter the breakout of the worldwide pandemic COVID-19, there arises a severe need of protection mechanisms, through which we can ensure the following of sops and keep an eye close to the present situation in our specific areas and for this mechanism, face mask being the primary one. The basic aim of the project is to detect the presence of a face mask on human faces on recorded videos, live streaming video as well as on images. And it will generate response to the authorities after detecting that most of the people are not wearing mask in a specific area with timing and statistics in the form of graph or percentage. Furthermore It will detect the distance in queue whether people are maintaining the social distance while they are standing in a queue it will detect if a person is not maintaining the distance which is provided on the so system. We have used deep learning to develop our face detector model. We have used yolov4 algorithm because it is twice as fast as EfficientDet (competitive recognition model) with comparable performance. In addition, AP (Average Precision) and FPS (Frames Per Second) increased by 10% and 12% compared to YOLOv3. Experimental results show that our model performs well on the test data with 100% and 99% precision and recall, respectively.
Project ObjectivesThis Smart Face Mask and Distance Detector can be use for all entrances of your company, business premises or building. The System can be used without a permanent internet connection and is therefore safe for data protection.
A Smart Solution To Every Branch
Supermarkets
Supermarkets are public spaces and require special protection. Mask detection and distance detection helps directly to contain the infection.
Retail
Here, too, the need for protection is extremely high. Crowds of people must be reminded again and again to wear masks, and follow social distancing while they are standing in queue , even in public spaces.
Healthcare
We know that we have the greatest need for protection, especially in the medical environment. On the one hand for the risk groups, but also for the personnel.
Public buildings
In every public building we have to protect ourselves equally. Especially at unguarded entrances mask detection is very useful.
Banks
Financial institutions also have unmanned premises where people enter and exit and are required to wear masks. And maintain social distance.
Project Implementation MethodLike object detection, face detection adopts the same architectures as one-stage and two-stage detectors, but in order to improve face detection accuracy, more face like features are being added.There is occasional research focusing on face mask detection. Some already existing face mask detectors have been modeled using OpenCV, Pytorch Lightning, MobileNet, RetinaNet and Support Vector Machines. Our project used Real World Masked Face Dataset (RMFD) which contains 5,000 masked faces of 525 people and 90,000 normal faces [8]. These images are 250 x 250 in dimensions and cover all races and ethnicities and are unbalanced. This project took 100 x 100 images as input and therefore transformed each sample image when querying it, by resizing it to 100x100. Moreover, this project uses Tensorflow then they convert images to Tensors, which is the base data type that Tensor can work with. RMFD is imbalanced (5,000 masked faces vs 90,000 non-masked faces).
Therefore, we kept equal ratio of the samples in tain/validation using the train test split function of sklearn. Moreover, to deal with unbalanced data they passed this information to the loss function to avoid unproportioned step sizes of the optimizer. They did this by assigning a weight to each class, according to its representability in the dataset. They assigned more weight to classes with a small number of samples so that the network will be penalized more if it makes mistakes predicting the label of these classes. They assigned to them a smaller weight while classes with large numbers of samples. This makes their network training agnostic to the proportion of classes.
To load the data efficiently this project used the data loader. For instance, in this project, they used the tensorflow, and to load them for training and validation they divided data into 32 batches and assigned the works of loading to the 4 number of workers, and this procedure allowed them to perform multi-process data loading.
To train the model we defined a model checkpointing callback where we wanted to save the best accuracy and the lowest loss. We tried to train the model for 10 epochs and after finding optimal epoch, we saved the model for 8 epochs to test on the real data. To get rid of the problem of obstruction of the face which causes trouble face detectors to detect masks in the images, we used a built-in OpenCV deep learning face detection model.
Benefits of the ProjectHere we introduced a smart mask face and distance detector model that is based on computer vision and deep learning. The model detect the faces with mask or without mask through webcam. This will also detect on images and videos and also on live streaming videos.The model is integration between deep learning and classical machine learning techniques with opencv, tensor flow and keras. We have used Yolov4 for feature extractions and combined it with three classical machine learning algorithms. We introduced a comparison between them to find the most suitable algorithm that achieved the highest accuracy and consumed the least time in the process of training and detection.
Technical Details of Final DeliverableMicrosoft Windows is a series of graphical interface operating systems developed, marketed, and sold by Microsoft.
Programming Language(s) PythonPython is a popular programming language. It was created by Guido van Rossum, and released in 1991. It is used for:
- web development (server-side),
- software development,
- mathematics,
- system scripting.
Anaconda Navigator is a desktop graphical user interface (GUI) included in Anaconda® distribution that allows you to launch applications and easily manage conda packages, environments, and channels without using command-line commands. Navigator can search for packages on Anaconda.org or in a local Anaconda Repository. It is available for Windows, macOS, and Linux.
| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 10000 | |||
| Gpu | Miscellaneous | 1 | 10000 | 10000 |