Training custom dataset
You can train your own mask dataset with your own pictures!
Shown below is our dataset used in this project. You can find dataset in this link - https://github.com/prajnasb/observations
├── dataset
│ ├── with_mask [690 entries]
│ └── without_mask [686 entries]
├── examples
│ ├── example_01.png
│ ├── example_02.png
│ └── example_03.png
├── face_detector
│ ├── deploy.prototxt
│ └── res10_300x300_ssd_iter_140000.caffemodel
├── detect_mask_image.py
├── detect_mask_video.py
├── mask_detector.model
├── plot.png
└── train_mask_detector.py
We used 690 images with mask and 686 images without mask.

You can make your own custom dataset in training custom dataset folder. If your model is not working good enough, you can upgrade your model by re-training. Bring your images to create more accurate model.
To do that you need images with mask and without mask.
More image, more accurate model it will be. Once your images are ready create folder name "without_mask" and "with_mask" in dataset folder. And then, put images that wear mask to "with_mask" folder and that dose not wear mask to "without_mask" folder. If your done, type command below.
cd src/training custom dataset
pip install sklearn imutils
python train_mask_detector.py --dataset dataset
you will get "plot.png" and in face_detector folder, the "mask_detector.model" will be upgraded.


Last updated
Was this helpful?