Real-time Face mask detection using AI
As the corona virus spread is not stopping anytime soon across the world, taking precautionary measures to curb the virus spread, is a mandate everywhere.
CloudTara Technologies is building series of Artificial Intelligence (AI) backed products which will help us to make sure the mandatory precautionary measures are taken as we pass through the unprecedented pandemic time.
Wearing masks is one of the predominant measure everywhere to safeguard ourselves from the dangerous virus. Masks are an image of the pandemic time – a visual allegory for the minuscule, inconspicuous viral adversary that could be hiding around any corner. Some select a scarf folded over their face and others manage with a shirt yanked up over their mouth. The more innovative snare beautifully handcrafted assortments around their ears, while some wear particular careful covers or, even rarer, N95 respirators etc.
AI team at CloudTara has built a real time face mask detector to help companies, schools, hospitals and public authorities ensure that the people at their place compulsorily wear mask. We love to share briefly, how we have built it with our readers.
Prepare the dataset of images with(out) mask
Train the Convolutional Neural Network (CNN)
Validating the Mask Detector Model on Images and Real-Time Video Stream
1. Prepare the dataset of images with(out) mask
To train a Convolutional Neural Network (CNN) and use binary classification to check whether a person is wearing a mask or not, an exhaustive set of images of two classes are used.
> Images with mask
> Images without mask
The "with mask dataset" was created artificially by extracting facial features and superimposing a mask on top. In such a case, the neural network should not be trained on the same images without a mask in order to avoid bias and achieve significantly higher accuracy.
2. Train the Convolutional Neural Network (CNN)
With the dataset in place, the next logical step is to use Tensorflow and Keras to train a classifier to automatically detect whether a person is wearing a mask or not.
In order to do the same, the YOLO v4 architecture was fine-tuned. YOLO v4 is a state-of-the-art model for real-time object detection. You only look once (YOLO) is a family of one-stage object detectors that are fast and accurate.
The DC-SPP-YOLO Model
Then the dataset is split into training and test sets. The images are pre-processed, converted to the Numpy array format, and the pre-trained YOLO v4 model is loaded (without the fully connected layer) and is fine-tuned on the training set.
3. Validating the Mask Detector Model on Images and Real-Time Video Stream
After saving the model, the only thing left to do is check it’s accuracy. The model was tested for several images using OpenCV, and as evident by the accuracy over 99%, it performed exceptionally well!
The model was also implemented for real-time video streams using OpenCV and was able to match and surpass expectations once again!
Implementing the mask detector for a real-time video stream
Use Cases of Real-Time Mask Detector
The real-time mask detector model can be deployed at airports to identify passengers not wearing masks. Face data of passengers can be caught in the system upon entry. If a passenger is found to be without a face mask, their photo is transmitted to the airport administrators to take swift action.
Using a real-time mask detector model, hospitals can observe if their crew/patients are donning masks throughout their stint or not. If any wellness worker is found without a mask, they will receive a notification with a reminder to wear a mask. Also, for the quarantined people who are obliged to wear a mask, the model can keep an eye, detect if the mask is present, send warning automatically, or communicate to the officials.
The real-time mask detector model can be utilized at office premises to expose if employees are sustaining safety standards at work. It observes workers without masks and sends them a warning to wear a mask.
Hotels, restaurants, retail stores, and movie theaters can use this model to identify people who are attempting to enter the premises without a mask. The entry to such people can be restricted to ensure that the safety of other customers is not compromised.
We are extensively working on extending mask detector capability to detect face along with mask. The will help companies or schools to mark attendance without requiring their people to take off their masks to mark their attendance.
If you are looking for face mask detector or artificial intelligence backed product development, please feel free to shoot an email to email@example.com
If you are a startup and willing to build an app like Uber, please read out our blog on Building apps like Uber for your business
If you are an Idea owner and willing to build a software product, feel free to read our customer success story here - How we went from an Idea to Prototype to Product?
Do you want to hire our team of experts to develop an Artificial Intelligence backed Uber-like app or an enterprise grade web application? We have the best app development team and data scientists in India, and are experts in Amazon Web Services, Microsoft Azure, Google Cloud Platform and other modern tech stacks and frameworks.
We are happy to share with our readers that we are already product development partner for global startups. Please feel free to read our customer reviews here. Plus we are headquartered in the silicon valley of India -- Bangalore! Feel free to shoot an email to us at firstname.lastname@example.org