Open In App
Related Articles

Face Mask detection and Thermal scanner for Covid care – Python Project

Improve Article
Save Article
Like Article


The coronavirus COVID-19 pandemic is triggering a worldwide health catastrophe, hence the World Health Organization recommends wearing a face mask in designated areas. Face Mask Detection and Hand Sanitization have been a well-known subject in recent times, as well as in image preparation and computer vision. Many new computations are being devised that use convolutional architectures to make the computation as exact as possible. These convolutional architectures have made it possible to extract even pixel nuances. I propose to design a dual face classifier that can recognize every face in the edge, independent of its arrangement. We offer a method for generating precise face division veils from any subjectively sized input image. Preparation is carried out using Fully Convolutional Networks to semantically segment out the faces in the image.

This is accomplished by adding a microprocessor such as the Raspberry Pi 3 Model B, a Pi-camera, a Relay, an Infrared Non-contact Temperature sensor, and other sensors, and thereafter developing a model by connecting each of these components.


  1. Using Live Streams / Model, identify the person’s face.
  2. To create a model in Tensor Flow to detect whether a person is wearing a Face Mask or not.
  3. Using a thermal camera, measure the person’s body temperature.
  4. If the individual is wearing a mask and his body temperature is normal, the sanitizer machine should switch on automatically; otherwise, a buzzer will sound and an alarm message should be sent to the appropriate authority by E-mail / Text Message.

What does the Project do?

In my concept, I’ve utilized the Raspberry Pi microcontroller, which will be coupled to a camera and a display. The major goal of the concept is to monitor and care for the current pandemic crisis, COVID19. This sickness is becoming a threat to people’s lives on a daily basis. In the current scenario, it is critical to eradicate this sickness and preserve our lives. In this concept, I am primarily verifying two conditions: if the individual is wearing a mask or not, and the temperature of the body. If the individual is not wearing, our suggested machine learning algorithm must forecast and verify the message’s correctness, or an email must be delivered to the authorized person. Similarly, the temperature will be checked; if either condition does not match, an alarm will be issued to the person involved. If both the mask forecast and the temperature are correct, the sanitizer machine will automatically sanitize the person’s body. The authentication will be transmitted to the individual in the form of an ID, a name, or any other facts about that individual.

Technologies used in this Project

  • Artificial Intelligence
  • Machine Learning
  • Deep Learning
  • OpenCV
  • Python

Required Skillset to Build the Project

One must be capable of writing programs in Python and work with microprocessors and sensors. They should be well-versed in areas such as Artificial Intelligence, Machine Learning, Deep Learning, and OpenCV.

Step-by-Step Implementation

The Face Mask Detection model is created in four steps:

  1. Specifying the model : (layer node, the activation function is applied to those nodes)
  2. Compile : (loss function, Optimizer)
  3. Fit : (make model learn)
  4. Predict : (use the model to predict)

To train a customized face mask detector, we must divide our project into two unique stages, each with its own set of sub-steps (as seen in Figure below):

Two Phases COVID-19 Face Detector

Training: Here we’ll focus on loading our face mask detection dataset from disk, training a model (using Keras/Tensor Flow) on this dataset, and then serializing the face mask detector to disk.

Deployment: Once the face mask detector is trained, we can then move on to loading the mask detector, performing face detection, and then classifying each face as with _mask or without_ mask.

Model Description

  1. Face Recognition
  2. Face Mask Detection
  3. Temperature Check
  4. Alert System & Hand Sanitizer

1) Face Recognition:

Face detection is a sort of computer vision technology that can recognize people’s faces in digital photographs. 

  • Facial recognition entails recognizing the face in a picture as belonging to person X rather than person Y. It is frequently used for biometric applications, like unlocking a smartphone. 
  • Facial analysis attempts to learn something about people based on their facial features, such as their age, gender, or the emotion they are displaying.
  • Facial tracking technique is commonly used in video analysis and attempts to follow a face and its features (eyes, nose, and lips) from frame to frame.

2) Face Mask Detection:

Data At Source: OpenCV was used to increase the size of the images. At the time, the images were titled “cover” and “no veil.” The images available were of various sizes and goals and were most likely extracted from various sources or from machines (cameras) of various goals.

Data Processing: Ventures, as indicated below, were applied to all the raw data images to convert them into clean forms that could be handled by a neural organization AI model.

  • Resizing the information picture (256 x 256).
  • Applying the shading sifting (RGB) over the channels (Our model MobileNetV2 underpins 2D 3 channel picture).
  • Scaling/Normalizing pictures utilizing the standard mean of PyTorch work in loads.
  • Center trimming the picture with the pixel estimation of 224x224x3.
  • Finally Converting them into tensors (Similar to Numpy exhibit).
  • Training and,
  • Deployment.

3) Temperature Check:

Although no thermal cameras can detect or diagnose the coronavirus, FLIR cameras can be used as an addition to existing body temperature screening methods in high-traffic public venues to identify higher skin temperature through swift individual screening. If the temperature of the skin in crucial places (particularly the corner of the eye and the forehead) is higher than normal, the individual may be chosen for extra screening.

4) Alert System & Hand Sanitizer:

The buzzer and sprinkler motor will be linked to the microcontroller. If the temperature threshold is exceeded and the face mask is not detected, the alarm will be activated. If both the face mask and the temperature are set to normal, the automatic sanitizer will activate.

Block Diagram

Block diagram of Face Mask Detector and Thermal Scanner for COVID care


Face Mask Detection

Application in Real-Life

This application can be used in various institutes like – 

  • College
  • Hospitals
  • Airports
  • Shops
  • Railway stations
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 23 Sep, 2021
Like Article
Save Article
Similar Reads