This is an official implementation of blog: website-under-construction
We use a small dataset Mask Detection, found available on Kaggle. In this dataset, we have 853 images belonging to 3 classes ('with mask', 'without mask' and 'masks worn incorrectly'). And the whole dataset is stored in data_augmentation/input
.
With files(images and annotations) to augment put in input/
(in two sub folders). Create a output
folder under directory of '../data_augmentation' with two sub-folders images
and annotations
in it. The relative locations of files are as follows:
|--data_augmentation
|--util
|--augment.py
|--input
|--output
|--images
|--annotations
Change the INPUT_DIR and OUTPUT_DIR in augment.py
to corresponding paths. AUGMENT_SIZE decides how many augmented images will be produced from one original image.
INPUT_DIR = '../data_augmentation/input'
OUTPUT_DIR = '../data_augmentation/output'
AUGMENT_SIZE = 4
Run script:
python ../data_augmentation/augment.py
Augmented images and annotations are generated in output/
.
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7
. To install run:
pip install -r requirements.txt
Open mask-fasterrcnn.ipynb with Colab.
Change data_path and output_path in augment.py
to corresponding paths, and run blocks in the notebook.
data_path = r'../data_augmentation/output'
output_path = r'../results'
Since colab cannot connect to the local camera on your computer, you have to build a local environment. After that, change model_path to corresponding local path:
model_path = r'C:\Downloads\Epoch_24_model.pt'
Run script:
python C:\Downloads\Medical-Mask-Detection-Based-on-Faster-RCNN\realtime\camera.py
However, the processing speed is much slower than our expectation, which only achieves to detect one frame for each five seconds. The way for feeding frame into the model have a lot of room to be optimized. For more details, please check the source code.
EDUCATION:
- Bachelor of Communication Engineering (2022.7 Expected)
- Qiushi Honor College, Tianjin University (TJU)
CONTACT ME:
- E-mail: rongboxiang@tju.edu.cn
- Address: 92 Weijin Road, Tianjin, P.R. China