Code Monkey home page Code Monkey logo

face-mask-detection's Introduction

face-mask-detection ๐Ÿ˜ท

A face mask detection app using a custom trained YOLOv4 model from Darknet converted to TensorFlow.

Dataset Used ๐Ÿ“

The dataset used for training was taken from Kaggle. It consists of 853 images belonging to the 3 classes, as well as their bounding boxes in the PASCAL VOC format which was later converted to text format (.txt) to be used in the Darknet framework.

It consists of 3 classes:

  1. With mask
  2. Without mask
  3. Mask Weared Incorrect

Detection Model Used ๐Ÿง™

The detection model used was YOLOv4. Yolo (You Only Look Once) is one of the fastest objection detection algorithms. It can provide object detections in real-time.

These were the config and metrics of the custom YOLOv4 model trained in Darknet.

  • Used the baseline weights used in the COCO dataset.
  • Number of Epochs: 3000
  • Learning Rate: 0.001
  • Width and Height: 416x416
  • Number of classes: 3
  • Mean Average Precision (mAP): 87.02% on the dataset.

Metrics by classes ๐Ÿ“‰

Class Average Precision (AP) True Positive (TP) False Positive (FP)
With wask 94.80 % 299 37
Without mask 84.53 % 42 9
Mask weared incorrect 81.73 % 152 0

ย 

Usage ๐Ÿงฉ

Install requirements or use Conda

Conda

# Tensorflow CPU
conda env create -f conda-cpu.yml
conda activate yolov4-cpu

# Tensorflow GPU
conda env create -f conda-gpu.yml
conda activate yolov4-gpu

Pip

#If you have CUDA 10.1 Toolkit you can use the GPU requirements.txt
pip install -r requirements-gpu.txt

#For CPU only machines used this
pip install -r requirements-cpu.txt

To Run

# Run detections on a webcam
python detect_video.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --video 0 --output ./detections/results.avi

#Run detections on an image
#Put image on /data/images and replace kite.jpg
python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --images ./data/images/kite.jpg

Samples ๐Ÿ“ท

References ๐ŸŽ–๏ธ

My project is based on these previous fantastic YOLOv4 implementations:

face-mask-detection's People

Contributors

tkmanabat avatar

Stargazers

 avatar

Watchers

 avatar

face-mask-detection's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.