Streamlit is an open-source Python library that makes it easy to build beautiful custom web-apps for machine learning and data science. To use it, just pip install streamlit , then import it, write a couple lines of code, and run your script with streamlit run [filename]
In the present scenario due to Covid-19, there is no efficient face mask detection applications which are now in high demand for transportation means, densely populated areas, residential districts, large-scale manufacturers and other enterprises to ensure safety. Also, the absence of large datasets of ‘with_mask’ images has made this task more cumbersome and challenging.
- Static Image
- Static Video
- Realtime - Webcam
The dataset used can be downloaded here - Click to Download
This dataset consists of 3835 images belonging to two classes:
- with_mask: 1916 images
- without_mask: 1919 images
The images used were real images of faces wearing masks. The images were collected from the following sources:
- Bing Search API (See Python script)
- Kaggle datasets
- RMFD dataset (See here)
All the dependencies and required libraries are included in the file requirements.txt
See here
Also, If you want to upload to the web, you need to download OpenH264. Link ✅ (https://https://github.com/cisco/openh264)
After download openh264 dll, move it into python library.
- Clone the repo
$ git clone https://github.com/Hott-J/Face-Mask-Detection.git
- Change your directory to the cloned repo and create a Python virtual environment named 'test'
$ mkvirtualenv test
- Install the libraries required
$ pip3 install -r requirements.txt / pip install -r requirements.txt
- Go into the cloned project directory folder and type the following command:
$ python3 train_mask_detector.py --dataset dataset
- To detect face masks in a static image, type the following command:
$ python3 detect_mask_image.py --image images/pic1.jpeg
- To detect face masks in a static video streams, type the following command:
$ python3 detect_mask_video.py
- Go into the cloned project directory folder and type the following command:
$ streamlit run app.py
Feel free to mail me for any query! Thank you ❤️