> For the complete documentation index, see [llms.txt](https://co-vision.gitbook.io/co-vision-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://co-vision.gitbook.io/co-vision-eng/direction/training-your-own-mask-dataset.md).

# 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>

```bash
├── 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.

![](https://1421990027-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MKsz21tq9tKvhQzpAmJ%2F-ML1P7QjS_06oeZ-qaDG%2F-ML1Q4u02npjBCtDkO4b%2Fimage.png?alt=media\&token=cfdd0b8e-ff18-48bd-b74f-3420392afcbb)

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.

![](https://1421990027-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MKsz21tq9tKvhQzpAmJ%2F-ML1P7QjS_06oeZ-qaDG%2F-ML1R6OH0z7DU4bKdsrb%2Fjunha2.PNG?alt=media\&token=61184a28-8b26-4d8c-8599-cba9e4d322b5)

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.

```bash
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.

![](https://1421990027-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MKsz21tq9tKvhQzpAmJ%2F-ML1P7QjS_06oeZ-qaDG%2F-ML1SAfaB1IgJxuUAoGe%2Fimage.png?alt=media\&token=44079dba-d241-4e7f-89b5-2b7dc4690885)

![New model!](https://1421990027-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MKsz21tq9tKvhQzpAmJ%2F-ML1WpyTZXsdNgZVjYtO%2F-ML1X6AqkuiH7-bpp9gr%2Fimage.png?alt=media\&token=7f7bfd2c-6a58-4ad9-ad9f-28753aff34da)
