Giter VIP home page Giter VIP logo

praveen76 / face-mask-detector-using-retinanet-model Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 5.0 113.76 MB

Create a reliable face mask detector with this repository, showcasing the implementation of a powerful Keras-RetinaNet model. Learn to leverage deep learning for accurate face mask detection, promoting safety in diverse environments. Enhance your skills and contribute to public health with this comprehensive solution.

Home Page: https://towardsmachinelearning.org/face-mask-detector-using-retinanet-model/

Jupyter Notebook 100.00%
deep-learning keras-retinanet object-detection object-detection-algorithms

face-mask-detector-using-retinanet-model's Introduction

Build Face-mask-detector-using-RetinaNet-model

We are grappling with a pandemic that’s operating at a never-before-seen scale. Researchers all over the globe are frantically trying to develop a vaccine or a cure for COVID-19 while doctors are just about keeping the pandemic from overwhelming the entire world. On the other hand, many countries have found social distancing, using masks & gloves a way to curb the situation a little.

Face Mask Detector

I recently had an idea to apply my deep learning knowledge to help the current situation a little. In this project, I’ll introduce you to the implementation of RetinaNet with little background & working on it.

Directory Structure

  • Data : This directory has input files that you'll need to important orginal Data. You can create your own dataset too. You can follow my this article to create your own dataset for your deep learning tasks. *maskDetectorJPEGImages: This directory contains original data.

    • maskDetectorXMLfiles: This directory contained the xml files produced after annotation of images. Each xml file contains the coordinates of the bounding box.
  • keras-retinanet: This directory is produced after installing keras-retinanet. You can check retinaNet-maskDetector.ipynb notebook to get more details on installation.

    • snapshots: This directory under keras-retinanet directory will be used to save model's weights at different checkpoints.
  • maskDetectorClasses: This file has been exporrted from the experiment . It contains the coordinates of the bounding boxes along with their classes. Please check notebook for more details.

  • maskDetectorClasses: This file contains the information about the classes involved, mask and noMask in our case study.

  • retinaNet-maskDetector.ipynb: This is the python notebook that you can run to implement face mask detector on your own.

Note: Kindly note that I've tested it on a very small Dataset with very minimal epochs. You'll need much larger dataset and epochs to get better results and accuracy.

Instructions for Installation

Dependencies: : You'll need to install below dependencies to run this project.

  • numpy: 1.18.1
  • pandas: 1.0.1
  • matplotlib: 3.1.3
  • requests: 2.22.0
  • PIL: 7.0.0
  • keras_retinanet
  • labelImg
  • shutil
  • urllib
  • glob
  • xml

Article published on Analytics Vidhya:

  • I've published a comprehensive case study on implementation of Face Mask Detector using RetinaNet Model. You can refer this link to get more details.

Important learnings from implementation of Face mask detector using RetinaNet model

  • How to clone & install the keras-retinanet repository
  • How to gather a large amount of Data for Deep learning tasks
  • Create Dataset for your model training.
  • Model Training
  • Model Testing
  • Final Notes

Important learnings from the article:

  • What is RetinaNet Model
  • Need for RetinaNet Model
  • The Architecture of RetinaNet
    • Backbone Network
    • Subnetwork for object Classification
    • Subnetwork for object Regression
  • What is Focal Loss, and why it's important in object detection algorithms?

License:

This project is open-source and distributed under the MIT License. Feel free to use and modify the code as needed.

Issues:

If you encounter any issues or have suggestions for improvement, please open an issue in the Issues section of this repository.

Contact:

The code has been tested on Windows system. It should work well on other distributions but has not yet been tested. In case of any issue with installation or otherwise, please contact me on Linkedin

About Me:

I’m a seasoned Data Scientist and founder of TowardsMachineLearning.Org. I've worked on various Machine Learning, NLP, and cutting-edge deep learning frameworks to solve numerous business problems.

face-mask-detector-using-retinanet-model's People

Contributors

praveen76 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

face-mask-detector-using-retinanet-model's Issues

not able to load model

-------------------errrorr-------------------------------------
TypeError Traceback (most recent call last)
in ()
8 #print("path:", model_paths)[-1]
9 #from keras_retinanet import models
---> 10 model = models.load_model(model_paths)
11 model = models.convert_model(model)

2 frames
/usr/local/lib/python3.7/dist-packages/h5py/_hl/base.py in is_hdf5(fname)
39 """ Determine if a file is valid HDF5 (False if it doesn't exist). """
40 with phil:
---> 41 fname = os.path.abspath(fspath(fname))
42
43 if os.path.isfile(fname):

TypeError: expected str, bytes or os.PathLike object, not list

--------------code used ----------------------

from keras_retinanet import models
from glob import glob
#model_paths = glob('/content/Face-mask-detector-using-RetinaNet-model/keras-retinanet/keras-retinanet/snapshots/_pretrained_model.h5')
#model_paths = glob('snapshots/resnet50_csv_0*.h5')
model_path='/content/keras-retinanet/snapshots/_pretrained_model.h5'

#print("path:", model_paths)[-1]
#from keras_retinanet import models
model = models.load_model(model_paths, backbone_name='resnet50')
model = models.convert_model(model)

--------------tried on this issue -------------

tried to install h5py .but still issue is not solved .
pip install h5py==2.10.0

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.