Coder Social home page Coder Social logo

chandrikadeb7 / face-mask-detection Goto Github PK

View Code? Open in Web Editor NEW
1.5K 33.0 829.0 186.76 MB

Face Mask Detection system based on computer vision and deep learning using OpenCV and Tensorflow/Keras

Home Page: https://www.youtube.com/watch?v=AAkNyZlUae0

License: MIT License

Python 2.00% CSS 0.03% Jupyter Notebook 97.97%
python python-3 python3 keras keras-tensorflow deep-learning computer-vision face-mask-detection covid-19 ssd-mobilenet

face-mask-detection's Introduction

Hi I'm Chandrika Deb

git commit -m "Hello, I'm a Software Developer at Amdocs"

Liked my Contributions:question::point_right: Nominate Me for GitHub Stars โญ โœจ

chandrikadeb7

Banner

chandrikadeb7

Liked my GitHub:question::point_right: Sponsor me a Dollar ๐Ÿ’ฐ ๐Ÿ’ต โœจ

  • ๐Ÿ‘จโ€๐Ÿ’ป All about me is at My Website

  • ๐Ÿ“ Sometimes I write articles on Medium

  • ๐Ÿ’ฌ Ask me about var topics = [ "Java", "Spring", "Python", "CSS" ]

  • ๐Ÿ“‚ Purchase Face Mask Detection Report and Slides on Gumroad

  • ๐Ÿ“ซ How to reach me [email protected]

  • ๐Ÿ“„ Know about my work & experiences My Resume

What are my featured projects:question::rocket:

100DaysOfCodeโŒ›
Face Mask Detection๐Ÿ˜ท
GirlScript Twitter Bot๐Ÿค–

Wanna see my blogs:question::fire:

What can I help with:question::cyclone:

git commit -m "All about GitHub!" ๐Ÿ˜

Connect with me:

chandrikadeb7 chandrikadeb7 chandrikadeb7 chandrika-deb chandrikadeb7 @chandrikadeb7

Languages and Tools:

aws bootstrap c couchdb cplusplus css3 docker elasticsearch gatsby git go grafana heroku html5 java javascript jenkins kafka kibana kotlin kubernetes mysql nginx opencv php postgresql postman python scikit_learn spring tensorflow

Support:

chandrikadeb7

face-mask-detection's People

Contributors

aayush-hub avatar ameyaupalanchi avatar amit366 avatar anirudhsai20 avatar bhendiboi avatar chandrikadeb7 avatar dependabot[bot] avatar indrapaul824 avatar jatinjain001 avatar keshav340 avatar kritikaparmar-programmer avatar m-code12 avatar muthuannamalai12 avatar purvanshsingh avatar raghavmodi avatar ritikchinu avatar royshreyaa avatar sahebsunny avatar seokkim0130 avatar shubhraagarwal avatar sobhit25 avatar spursbyte avatar sreyan-ghosh avatar sthphoenix avatar tanweerulhaque avatar vaishnavi-1 avatar vilsi12 avatar vinamramunot-tech avatar vrushti24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face-mask-detection's Issues

Add Contributors.md file

Hai,
I would like to add Contributors.md file in your project in the form of a table and display a link to it in README.md

Integrate welcome bot

I can add a welcome bot config file having a proper message that will show up when any user will open up an issue or pull-request for the first time.
For reference, check out: https://github.com/apps/welcome

If you feel this is a great idea!
Please assign it to me.

model for street view

Hi @chandrikadeb7 , i need dataset or model support street view detection mask or drone view . any help you can provide would be greatly appreciated. thanks

Not Detecting Multiple Faces in Video

When i tried to detect multiple faces while running the video version, it was only able to detect one face at a time.
And when i ran the image version it was successfully able to detect multiple faces and tell whether they were wearing mask or not.
Can you tell me why this is happening? Because its suppose to detect multiple faces. And what could be it's solution.
It would be really great if you could help me on this.
Thanks

Face with Beard

In case of beard algorithm predict face with Mask but there is no mask on face

Create Code of Conduct. md

Hi,
I found that this project repository is not having a code of conduct file in this repository, kindly assign me this issue and I would like to contribute a well-formatted code of conduct file as you know code of conduct is a necessary file which the contributors need to follow so that everyone follows a decorum.

Help with Working Instructions

When I run working commands, I got the following errors:

C:\Users\Ahmed Ahmed\Face-Mask-Detection>python train_mask_detector.py --dataset dataset
2020-10-30 21:33:55.095518: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
Traceback (most recent call last):
File "train_mask_detector.py", line 5, in
from tensorflow.keras.preprocessing.image import ImageDataGenerator
File "C:\Program Files\Python38\lib\site-packages\tensorflow_init_.py", line 49, in
from ._api.v2 import operators
ImportError: cannot import name 'operators' from 'tensorflow.api.v2' (C:\Program Files\Python38\lib\site-packages\tensorflow_api\v2_init.py)

C:\Users\Ahmed Ahmed\Face-Mask-Detection>python detect_mask_video.py
2020-10-30 21:34:38.028712: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
Traceback (most recent call last):
File "detect_mask_video.py", line 5, in
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
File "C:\Program Files\Python38\lib\site-packages\tensorflow_init_.py", line 49, in
from ._api.v2 import operators
ImportError: cannot import name 'operators' from 'tensorflow.api.v2' (C:\Program Files\Python38\lib\site-packages\tensorflow_api\v2_init.py)

chenge size

hello i want to change out put size in video detection in this line
frame = imutils.resize(frame, width=400)
can change width but i cant find height

0 Accuracy in CCTV footage

As the code is intended to identify the mask from any video stream, but the major issue is that it is not able to identify "FACE MASK" in the live feeds from the CCTV / DVR / NVR.

Not all images are able to process

if I process the below image it gives an error of Assertion failed in OpenCV.

Error:
File "detect_mask_image.py", line 105, in
mask_image()
File "detect_mask_image.py", line 76, in mask_image
face = cv2.cvtColor(face, cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

If you encounter this error you need to manually delete "./images/out.jpg" and save another image which can be processed e.g. "./images/pic2.jpg" as "./images/out.jpg".

pic5

accuracy

Hi all,
I tried to test this model with different sizes of dataset. What I've done is to randomly select 1, 5, 10 or 20 % of the original dataset and training the model with train_mask_detector.py, but the accuracy value that is shown in the end of training is very odd. these are my results after training the model three times ( because I thought these numbers are wrong and wanted to make sure it gave me same numbers consistent before asking here ) :

first time :
10 % :
0.974025974025974
20 % :
0.974025974025974


second time :
10 % :
0.987012987012987
20 % :
0.9675324675324676


third time :
10 % :
0.974025974025974
20 % :
0.961038961038961

and one time when I was training with 5% it gave me the accuracy of 1.0
also called the sklearn.metrics.acuuracy_score which is the same function that is called after training under "[INFO] evaluating network..."
can anyone help me understand what I'm doing wrong or something??
thank you all

typos identified and fixed and huge difference in accuracy on google colab

some errors faced and resolved

file: train_mask_detector.py

line no. 149 plt.plot(np.arange(0, N), H.history["acc"], label="train_acc")
it gives KeyError.

solution:
plt.plot(np.arange(0, N), H.history["accuracy"], label="train_acc")

similarly
line no. 150 plt.plot(np.arange(0, N), H.history["val_acc"], label="val_acc")
it also gives KeyError.

solution:
plt.plot(np.arange(0, N), H.history["val_accuracy"], label="val_acc")

Your results state that your model achieved 93% accuracy but when running on google colab, tensorflow==2.3.0, I have achieved 99% accuracy

video stops frequently with error (-215:Assertion failed) !_src.empty() in function 'cvtColor'

How can I use IP camera for streaming and video stops frequently with following error.

Traceback (most recent call last):
File "detect_mask_video.py", line 116, in
(locs, preds) = detect_and_predict_mask(frame, faceNet, maskNet)
File "detect_mask_video.py", line 55, in detect_and_predict_mask
face = cv2.cvtColor(face, cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

cpu speed

Hi
I have a quesion about inference speed. I check inference speed in cpu
Then, speed is 30~40ms. I think it is too slow while using mobilenetv2.
Is this speed correct?

Google collab

Can we do the same project in Google collab ? Implementing this in google collab will help many students to learn this project .

permission required

while executing this command python3 train_mask_detector.py --dataset dataset its showing permission denied so if possible rectify this issue

multiple faces

hi, multiple faces in the real-time video not detected?

Face Mask detection Error

Getting following error
sudo python3 detect_mask_video.py
2020-11-17 14:44:36.808007: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory
..............
Traceback (most recent call last):
File "detect_mask_video.py", line 98, in
maskNet = load_model(args["model"])
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/keras/saving/save.py", line 149, in load_model
loader_impl.parse_saved_model(filepath)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/saved_model/loader_impl.py", line 83, in parse_saved_model
constants.SAVED_MODEL_FILENAME_PB))
OSError: SavedModel file does not exist at: mask_detector.model/{saved_model.pbtxt|saved_model.pb}

Also getting following error
(fmdt1-env) pi@raspberrypi:/FMDet1 $ sudo pip3 install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement tensorflow>=1.15.2 (from -r requirements.txt (line 1)) (from versions: 0.11.0, 1.12.0, 1.13.1, 1.14.0)
ERROR: No matching distribution found for tensorflow>=1.15.2 (from -r requirements.txt (line 1))
(fmdt1-env) pi@raspberrypi:
/FMDet1 $ sudo pip3 show tensorflow

Accuracy - Mask and Withoutmask %

There is one issue with this model or prediction.

The % of the mask and withoutmask % is inconsistent. It varies to the same position pf the mask.

What is the solution for this ?...

Use case

Hello, I am a beginner web developer and I would love to create a project similar to yours.

However, because I'm a beginner, I don't know if the MIT license allows me to copy your software or if I need additional permission or something else.

If I can make a copy of your source code, do I need to include thanks, pay for something, or anything else?

Thank you :)

Creating an automated mask dispenser

Implementation of an automated mask dispenser that dispenses mask for any person who is not wearing a mask. This kind of solution can be used by shopping complexes etc.

Deployment Issues

Hi!

I have a simple question. How did you manage to deploy this on Heroku? I tried doing the same but faced a slug size issue.

Multiple Face detection

The code is working perfectly but there is one major issues that are the system is not able to detect multiple faces.
As the name suggests it should be able to detect multiple faces.

KeyError: 'acc' when saving model in Google Colab

I was using Google Colab to train a model so I could try it on my laptop, however, when saving the model this error occurs, I'm using a GPU

[INFO] evaluating network...
              precision    recall  f1-score   support

   with_mask       0.99      1.00      0.99       384
without_mask       1.00      0.99      0.99       386

    accuracy                           0.99       770
   macro avg       0.99      0.99      0.99       770
weighted avg       0.99      0.99      0.99       770

[INFO] saving mask detector model...
Traceback (most recent call last):
  File "train_mask_detector.py", line 149, in <module>
    plt.plot(np.arange(0, N), H.history["acc"], label="train_acc")
KeyError: 'acc'

Previous Steps

  • Cloned the repository

  • Downloaded requirements

  • Ran python3 train_mask_detector.py --dataset dataset

Verbose Output

2020-08-15 15:09:08.012494: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
[INFO] loading images...
/usr/local/lib/python3.6/dist-packages/PIL/Image.py:961: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images
  "Palette images with Transparency expressed in bytes should be "
tcmalloc: large alloc 2315722752 bytes == 0x91b80000 @  0x7f2a8385e1e7 0x7f2a8007a5e1 0x7f2a800dee88 0x7f2a800e1fc8 0x7f2a800e25a5 0x7f2a8017984d 0x50a7f5 0x50cfd6 0x507f24 0x50b053 0x634dd2 0x634e87 0x63863f 0x6391e1 0x4b0dc0 0x7f2a8345bb97 0x5b26fa
tcmalloc: large alloc 1852096512 bytes == 0x11bbf2000 @  0x7f2a8385e1e7 0x7f2a8007a5e1 0x7f2a800dee88 0x7f2a800defa3 0x7f2a8016a0c6 0x7f2a8016a528 0x50c4de 0x507f24 0x509c50 0x50a64d 0x50cfd6 0x507f24 0x509c50 0x50a64d 0x50c1f4 0x58e809 0x4c9306 0x588114 0x58834e 0x5517c1 0x5a9eec 0x50a783 0x50c1f4 0x507f24 0x509c50 0x50a64d 0x50cfd6 0x507f24 0x50b053 0x634dd2 0x634e87
WARNING:tensorflow:`input_shape` is undefined or non-square, or `rows` is not in [96, 128, 160, 192, 224]. Weights for input shape (224, 224) will be loaded as the default.
2020-08-15 15:09:31.941657: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-08-15 15:09:32.004988: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:32.005892: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:00:04.0 name: Tesla K80 computeCapability: 3.7
coreClock: 0.8235GHz coreCount: 13 deviceMemorySize: 11.17GiB deviceMemoryBandwidth: 223.96GiB/s
2020-08-15 15:09:32.005987: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-08-15 15:09:32.260469: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-08-15 15:09:32.402794: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-08-15 15:09:32.430120: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-08-15 15:09:32.701520: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-08-15 15:09:32.728638: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-08-15 15:09:33.266461: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-08-15 15:09:33.266776: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:33.267816: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:33.268607: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-08-15 15:09:33.286410: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2300000000 Hz
2020-08-15 15:09:33.286728: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1f08d80 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-08-15 15:09:33.286778: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-08-15 15:09:33.373932: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:33.374835: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1f08bc0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-08-15 15:09:33.374876: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Tesla K80, Compute Capability 3.7
2020-08-15 15:09:33.376571: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:33.377366: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:00:04.0 name: Tesla K80 computeCapability: 3.7
coreClock: 0.8235GHz coreCount: 13 deviceMemorySize: 11.17GiB deviceMemoryBandwidth: 223.96GiB/s
2020-08-15 15:09:33.377428: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-08-15 15:09:33.377501: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-08-15 15:09:33.377562: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-08-15 15:09:33.377609: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-08-15 15:09:33.377653: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-08-15 15:09:33.377702: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-08-15 15:09:33.377751: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-08-15 15:09:33.377909: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:33.378782: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:33.379553: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-08-15 15:09:33.383743: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-08-15 15:09:37.202833: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-08-15 15:09:37.202895: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      0 
2020-08-15 15:09:37.202914: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:   N 
2020-08-15 15:09:37.207175: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:37.208107: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-15 15:09:37.208872: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:39] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0.
2020-08-15 15:09:37.208930: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10630 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7)
Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/mobilenet_v2/mobilenet_v2_weights_tf_dim_ordering_tf_kernels_1.0_224_no_top.h5
9412608/9406464 [==============================] - 0s 0us/step
[INFO] compiling model...
[INFO] training head...
Epoch 1/20
2020-08-15 15:09:42.573008: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-08-15 15:09:44.011634: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
96/96 [==============================] - 39s 408ms/step - loss: 0.3189 - accuracy: 0.8561 - val_loss: 0.0953 - val_accuracy: 0.9766
Epoch 2/20
96/96 [==============================] - 37s 390ms/step - loss: 0.1159 - accuracy: 0.9599 - val_loss: 0.0671 - val_accuracy: 0.9805
Epoch 3/20
96/96 [==============================] - 37s 389ms/step - loss: 0.0820 - accuracy: 0.9708 - val_loss: 0.0646 - val_accuracy: 0.9779
Epoch 4/20
96/96 [==============================] - 37s 381ms/step - loss: 0.0666 - accuracy: 0.9773 - val_loss: 0.0505 - val_accuracy: 0.9857
Epoch 5/20
96/96 [==============================] - 36s 378ms/step - loss: 0.0577 - accuracy: 0.9816 - val_loss: 0.0436 - val_accuracy: 0.9870
Epoch 6/20
96/96 [==============================] - 37s 388ms/step - loss: 0.0547 - accuracy: 0.9793 - val_loss: 0.0441 - val_accuracy: 0.9883
Epoch 7/20
96/96 [==============================] - 37s 385ms/step - loss: 0.0489 - accuracy: 0.9826 - val_loss: 0.0432 - val_accuracy: 0.9883
Epoch 8/20
96/96 [==============================] - 37s 381ms/step - loss: 0.0472 - accuracy: 0.9855 - val_loss: 0.0407 - val_accuracy: 0.9896
Epoch 9/20
96/96 [==============================] - 37s 380ms/step - loss: 0.0443 - accuracy: 0.9846 - val_loss: 0.0364 - val_accuracy: 0.9909
Epoch 10/20
96/96 [==============================] - 37s 388ms/step - loss: 0.0362 - accuracy: 0.9872 - val_loss: 0.0357 - val_accuracy: 0.9896
Epoch 11/20
96/96 [==============================] - 38s 391ms/step - loss: 0.0393 - accuracy: 0.9878 - val_loss: 0.0337 - val_accuracy: 0.9909
Epoch 12/20
96/96 [==============================] - 36s 378ms/step - loss: 0.0342 - accuracy: 0.9898 - val_loss: 0.0375 - val_accuracy: 0.9883
Epoch 13/20
96/96 [==============================] - 36s 378ms/step - loss: 0.0324 - accuracy: 0.9895 - val_loss: 0.0329 - val_accuracy: 0.9896
Epoch 14/20
96/96 [==============================] - 37s 386ms/step - loss: 0.0288 - accuracy: 0.9905 - val_loss: 0.0314 - val_accuracy: 0.9909
Epoch 15/20
96/96 [==============================] - 37s 383ms/step - loss: 0.0246 - accuracy: 0.9928 - val_loss: 0.0292 - val_accuracy: 0.9922
Epoch 16/20
96/96 [==============================] - 37s 381ms/step - loss: 0.0238 - accuracy: 0.9931 - val_loss: 0.0301 - val_accuracy: 0.9909
Epoch 17/20
96/96 [==============================] - 36s 375ms/step - loss: 0.0259 - accuracy: 0.9918 - val_loss: 0.0373 - val_accuracy: 0.9883
Epoch 18/20
96/96 [==============================] - 37s 386ms/step - loss: 0.0236 - accuracy: 0.9924 - val_loss: 0.0282 - val_accuracy: 0.9909
Epoch 19/20
96/96 [==============================] - 37s 388ms/step - loss: 0.0256 - accuracy: 0.9898 - val_loss: 0.0314 - val_accuracy: 0.9896
Epoch 20/20
96/96 [==============================] - 37s 384ms/step - loss: 0.0240 - accuracy: 0.9924 - val_loss: 0.0289 - val_accuracy: 0.9922
[INFO] evaluating network...
              precision    recall  f1-score   support

   with_mask       0.99      1.00      0.99       384
without_mask       1.00      0.99      0.99       386

    accuracy                           0.99       770
   macro avg       0.99      0.99      0.99       770
weighted avg       0.99      0.99      0.99       770

[INFO] saving mask detector model...
Traceback (most recent call last):
  File "train_mask_detector.py", line 149, in <module>
    plt.plot(np.arange(0, N), H.history["acc"], label="train_acc")
KeyError: 'acc'

Limited mask detection

The code is only able to detect the mask which is of white color and the mask similar to lighter colors.
I would suggest you to use more dataset of factual images as the data set used was created by an AR program which placed white mask vector file on the images provided to it.

You should seek to this problem in order to say it a perfect model of "Face Mask Detection"

Addition to that I recommend you change the model to a compressed .h5 model

Tensorflow-lite

Any way to get the detect_mask_video.py or detect_mask_image.py working with Tensorflow lite? I don't need to train the model - I just want to run it.

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.