Face Mask Detection using Deep Learning
The Face Mask Detection module we are designing is used to detect people not wearing medical face masks in the frame. When such persons are detected, the module highlights them in the frame with a square in real time. In the present scenario due to COVID-19 there is no effective fac
2025-06-28 16:32:31 - Adil Khan
Face Mask Detection using Deep Learning
Project Area of Specialization Artificial IntelligenceProject Summary Project Summary:The Face Mask Detection module we are designing is used to detect people not wearing medical face masks in the frame. When such persons are detected, the module highlights them in the frame with a square in real time.In the present scenario due to COVID-19 there is no effective face mask detection applications which are now high demand for transportation means, densely populated area, residential district and other enterprises due to ensure safety.
In this project, I will show you how to build face recognizer using Python. Building a program that detects and recognizes faces is a very interesting and fun project to get started with computer vision. In this current scenario, medical masks are defined as surgical or procedure masks that are flat or pleated (some are shaped like cups) they are affixed to the head with straps. They are tested for balanced high filtration, adequate breathability and optionally. The study analyses a set of video streams/images to identify people who are compliant with the government rule of wearing medical masks. This can help the government to take appropriate action against people who are non-compliant.
As can be understood from the name, we will write a program that will recognize faces in an image. When I say “program”, you can understand this as teaching a machine what to do and how to do it. I like to use teaching instead of programming because that’s actually what we will be doing. The best way of learning is teaching, so while teaching a machine how to detect faces with mask or without mask.
Face Recognition using Python:Face Recognition using Python and their modules follows a well-defined pattern. When you meet someone for the first time in your life, you look at his/her face, eyes, nose, mouth, colour, and overall features. This is your mind learning or training for the face recognition of that person by gathering face data.
Then the person tells you his/her name. At this point, your mind knows that the face data it just learned belongs to the person. Now, your mind is trained and ready to do face recognition. Next time when you will see the person or his/her face in a picture you will immediately recognize.
This is how Face Recognition works. The more you will meet, the more data your mind will collect about the person and the better you will become at recognizing him/her.
Project Objectives OBJECTIVE:To identify the person on image/video stream wearing face mask or not with the help of deep learning algorithm by using the library.
Introduction:The Face Mask Detection module we are designing is used to detect people not wearing medical face masks in the frame. When such persons are detected, the module highlights them in the frame with a square in real time.In the present scenario due to COVID-19 there is no effective face mask detection applications which are now high demand for transportation means, densely populated area, residential district and other enterprises due to ensure safety.
In this project, I will show you how to build face recognizer using Python. Building a program that detects and recognizes faces is a very interesting and fun project to get started with computer vision. In this current scenario, medical masks are defined as surgical or procedure masks that are flat or pleated (some are shaped like cups) they are affixed to the head with straps. They are tested for balanced high filtration, adequate breathability and optionally. The study analyses a set of video streams/images to identify people who are compliant with the government rule of wearing medical masks. This can help the government to take appropriate action against people who are non-compliant.
Detection:Face mask detection is an AI based technology that analyses a video stream to detect and recognize a face mask worn by an individual person or a crowd of people. Our deep-site software outputs a confidence value for each detection. Every individual is classified either as ‘wearing a mask’ or flagged as ‘not wearing a mask’. If the face mask detector application identifies a user as not wearing a mask, a custom message can be delivered via a digital screen to remind all visitors to wear masks before entering the premises.
The module will be capable of detecting people not wearing face masks in the frame at the same time (if allowed by the computing capacity). The module will not recognize (identify) faces, it will cannot tell one person from the other or compare a person’s face with the faces from a database, it will only find people without face masks in the frame. When an infringement event (no mask) is detected, the module briefly highlights the person’s face with a red square in the client application and creates a corresponding event in the event log. The repeated detection of the infringement by the same person will become possible only after the disappearance of this person from the frame for three seconds minimum (e.g., when the person leaves the frame or covers his/her face completely).

The system can be used in the following places to identify people with or without masks:
- Offices.
- Hospitals/healthcare organizations
- Airports and railway stations
- Sports venues
- Entertainment and hospitality industry
- Densely populated areas
Retailers need to monitor their premises to control the current occupancy and wearing of masks. Digital screens or assistant can be used to display information for both the number of people allowed in the store and mask detection.

Wearing face masks in public transport will be mandatory in many parts of the world. Public transport organizations can use the software to automate the checking process with very little resources needed.

With many office buildings opening up and employees coming back to work, face mask detection can be used to maintain a safe environment for everyone. The mask detection system can also be combined with facial recognition which uses employee database information to match an individual at the office entrance.

Our face mask detector can be very effectively used at airports mainly for entrance flow management and monitoring. The software can be added to any access gate or entrance to make sure that all passengers follow the safety rules when boarding a plane.

Hotels, restaurants and bars are opening their doors to the public with certain regulations. In many cases, visitors will be required to wear masks when checking in or interacting with the staff.

The wearing of face masks is especially important in hospitals and healthcare facilities. Our face mask system can monitor staff and patients to see if they are wearing masks during their stay in the hospital.

Step 1: Load face mask.
Step 2: Train face mask classifier with libraries.
Step 3: Serialize face mask classifier to disk.
Step 4: Load face mask classifier from disk into detection code.
Step 5: Detect faces in image/video stream.
Step 6: Extract each face Region Of Interest (ROI).
Step 7: Apply face mask classifier to each face. ROI to determine mask or no mask.
Step 8: Observe the result.
Step 9: Show result.

Our libraries detect specific area on required image/video stream wearing face mask or not.

Automated Face Mask Identification
- Retail:
Retailers need to monitor their premises to control the current occupancy and wearing of masks. Digital screens or assistant can be used to display information for both the number of people allowed in the store and mask detection.
- Public transport:
Wearing face masks in public transport will be mandatory in many parts of the world. Public transport organizations can use the software to automate the checking process with very little resources needed.
- Corporate buildings:
With many office buildings opening up and employees coming back to work, face mask detection can be used to maintain a safe environment for everyone. The mask detection system can also be combined with facial recognition which uses employee database information to match an individual at the office entrance.
- Airports:
Our face mask detector can be very effectively used at airports mainly for entrance flow management and monitoring. The software can be added to any access gate or entrance to make sure that all passengers follow the safety rules when boarding a plane.
- Hospitality:
Hotels, restaurants and bars are opening their doors to the public with certain regulations. In many cases, visitors will be required to wear masks when checking in or interacting with the staff
- Hospitals:
The wearing of face masks is especially important in hospitals and healthcare facilities. Our face mask system can monitor staff and patients to see if they are wearing masks during their stay in the hospital.
Technical Details of Final Deliverable Technical Details of Final DeliverableVideo Stream:
Optimum resolution for the module’s operation:
- HD or Full HD. Framerate: 10 fps or more.
- No mirrored (horizontally flipped) stream.
Illumination and image quality
Illumination of faces in the frame must be uniform and constant. If the camera is installed opposite a bright source of light (sun behind the entrance door, etc.), it is required to adjust the exposure or brightness in such a way that the face in the frame is light. The overexposed background is acceptable. The image quality must be medium or better. Significant compression artefacts are not acceptable. No blurring of moving people’s faces is allowed. The image must be in colour.
Scene and camera position:
- The faces must be fully seen in the frame.
- There must be no mirror surfaces giving reflections in the frame (glass, mirrors, etc.).
- Strong lateral illumination (e.g., sunlight from the window) resulting in the overexposure of one part of the face is not acceptable.
- The camera may be placed above the face level, directly facing the people to be recognized. In such a case, the camera elevation angle must not exceed 35°.
- The distance between the pupils of a face to be recognized must be at least 30 pixels.
- The camera must directly face the people to be recognized. The camera angle between the face direction and the lens axis must not exceed 30°.
The face mask recognition system uses AI technology to detect the person with or without a mask. It can be connected with any surveillance system installed at your premise. The authorities or admin can check the person through the system to confirm their identity. The system sends an alert message to the authorized person if someone has entered the premise without a face mask. The accuracy rate of detecting a person with a face mask is 95-97% depending on the digital capabilities. The data has been transferred and stored automatically in the system to enable reports whenever you want.
Final Deliverable of the Project HW/SW integrated systemCore Industry ITOther IndustriesCore Technology Artificial Intelligence(AI)Other TechnologiesSustainable Development Goals Peace and Justice Strong Institutions, Partnerships to achieve the GoalRequired Resources| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 35000 | |||
| Wifi Camera | Equipment | 1 | 35000 | 35000 |