Nose Mask Detection

Note in the video illustration, there was a typo error instead of nose ; noise was mistakenly used


In 2019 the world was hit by an unexpected pandamic which caused halt in economic activities, death toll increased significantly as a result of the disease. After research work done by WHO and other stake holders, there was the need to introduce Face Mask as one of the measures to curb and prevent the spread of the pandamic. Wearing mask became very uncomfortable for the human race as it was difficult for people to put on mask where ever they had to go. In order to make sure people wore nose mask, this model is trained to detect whether a person is wearing a mask or not

What it does

In this project I trained a deep learning model on AWS ec2 dl1 Habana instance powered by Gaudi Accelerators to use computer vision to determine whether a person wears a nose mask or not

How I built it

Using tensorflow keras api and the habana tensorflow framework module i was able to train a deep learning model to detect whether a person wears a nose mask or not. For testing purposes i used only one accelerator

Summary of steps used

  1. Once our ec2 instance is running we check whether the Gaudi accelerators and drivers are properly installed and running hl-smi
  2. Next, I downloaded the docker image for ubuntu 18.04 and tensorflow version 2.7.1
  3. Next, I run the docker image downloaded in the previous step. This opens a secure shell(root)
  4. Install gdown and unzip packages using pip, gdown will be used to download the dataset from google drive and unzip will be used to extract the data set
  5. Clone my github repo and move into the nose_mask_detection folder using cd
  6. Export python path and the Habana config file to the nose_mask_detection folder
  7. Use gdown to download dataset and unzip to extract the dataset
  8. I then run the requirements.txt file just to make sure all python libraries that will be needed by file are installed
  9. Finally, I run my file to start training

Challenges I ran into

One of my major challanges was getting enough images for both training and test sets

Accomplishments that I'am proud of

I'm glad for the first time I was able to train a deep learning model on the AWS EC2 dl1 instance powered by Gaudi Accelerators and was able to get a test_accuracy of 0.9499 and lose_accuracy of 0.185

What I learned

Going through the documentation from the Habana developers site i have learnt on how to optimize my model for better performance

What's next for Face Mask Detection

I'm currently working on developing a simple flask app to use the keras api and the trained .h5 file to predict the outcome on whether a person is wearing a nose mask or not when an image is uploaded

Built With

Share this project: