Hawkeye Vision Model: AI-enabled Mask Wearing Detection

Project Introduction

If we search for COVID precautions/prevention on the web, we get a list of recommendations to stay safe. One advice that frequently appears is to “wear a mask when physical/social distancing is not possible”. In this project, our team hopes to leverage artificial intelligence (AI) to help reduce the spread of COVID-19 by encouraging mask wearing and create awareness among employee in offices.

Target Problems

This project will be used to classify those who are wearing masks and those who aren’t in offices or public places. Based on the classification report, we can find out which employees are following the rule of mask wearing in the office premises. If an employee fails to comply with these requirements, we can find out who it is and inform their respective managers and take necessary actions.


For the first and second module we can use the concepts in machine learning and deep learning. The third module is to send mail to the respective employees looping their manager for necessary action. This module can be implemented using any programming language such as Python, Java, .Net, etc. An architecture and flow diagram are attached below to explain the flow briefly.

The module files are available on our Github Repo: https://github.com/VivekAnandhangithub/Alibab_Hackathon_2020

Flow Diagram of Face Mask Detection
Architecture of Face Mask Detection
Nomask Detect (Image Source: Wikipedia)
The person has a mask (Image Source: Pinkvilla)
An email with attachment from Python

Alibaba Cloud Products Used

Technology highlights

We have used the Convolutional Neural Networks (ConvNets or CNNs) in our modules to perform image recognition and classification. ConvNets have been successful in identifying faces, objects and traffic signs. There are different architectures available in CNN and we have used MobileNet and VGG models.

We have explained algorithms used in each module below.

In the first module we detect if a person/employee is wearing a mask or not from an image. We have used predefined algorithm called Haar Cascade which is used to identify objects in an image or video. There are multiple or different types of models in the Haar cascade which can be used to detect face, mask, eye, etc in an image or video. We have used haarcascade_frontalface_alt2 model and pre-defined weight to detect the face mask in an image. The model has 160 layers and Having total parameters of 2,422,210. Out of which 164,226 parameters are trainable and the remaining 2,257,984 are non-trainable parameters. We created a user defined function in that we added the logic to check if a person in an image has a mask or not based on the result a specific output is displayed. If the person in the image has no mask then it will display the image highlighting his face and it will display the confidence or accuracy of its mask prediction.

In the Second module we are trying to classify the person from the image using VGG16, model and predefined weights of VGG are used here. We are using the SVM model to predict name of the person in an image and store the predicted name in a text file. The model has a total of 145,002,878 parameters and all are used as a trainable parameter.

In Module 3 we will be sending an email to the manager with the image showing as no mask with the level of accuracy. In the webcam we will be taking the frame and storing it in a location and will be sharing it to the respective manager. Here we configured our Gmail as the domain to send email.

Future Enhancement

About the Team

I’m skilled in Content Management System, Machine learning and deep learning, Web Applications, Digital Transformations, Automation and Cloud Technology Enthusiast and having 9 years of experience. I have published my Research Articles about Cloud Technology in many International Journals and Harvard University.

Koushik Radhakrishnan — Sr. Developer

I’m skilled in .Net, Python, SAS, Machine learning and deep learning, Web Applications. I am doing my PGP in AIML from Great Lakes Institution and University of Texas Austin and having 5 years of experience. Working on implementing projects related to Machine Learning and deep learning.

Disclaimer: The views and opinions expressed in this article are for reference only and do not necessarily represent those of Alibaba Cloud. Alibaba Cloud will not be liable for any false, inaccurate, inappropriate, or incomplete information presented on this article.

Original Source:

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store