Face Mask Detection using Convolutional Neural Networks - Python | Keras | Tensorflow | OpenCV
Vložit
- čas přidán 10. 05. 2020
- This tutorial explains a method of building a Face Mask Detector using Convolutional Neural Networks (CNN) Python, Keras, Tensorflow and OpenCV. With further improvements these types of models could be integrated with CCTV or other types cameras to detect and identify people without masks. With the prevailing worldwide situation due to COVID-19 pandemic, these types of systems would be very supportive for many kind of institutions around the world. Please let me know your ideas, suggestions and concerns in the comment section and feel free to improve this project yourself and come up with better results.
Download the code (Github): github.com/aieml/face-mask-de...
Download the code and Materials (Google Drive): drive.google.com/open?id=1e2-...
Speaker: Thakshila Dasun
very good lecture. I am happy to find such kind of tutorials. please make more lectures. I am realy happy to find the link. very informative lecture. thanks sir. please upload more lectures.
Your doing a great job buddy 👍, thanks for sharing your knowledge. keep up the good work 👏👏
Wonderful Tutorial bro, you earned my respect+++ , Your life long subscriber .
Thank you for your best explanation,,it is very very useful for me and it's 100%working.thank you once again ...🙏🏻🙏🏻
subcribed! im gonna be waiting for more tutorials related to deep learning with live object recognition
thanks sir...providing such clear content on face mask detection on webcam
Thank you for your best explanation,,it is very very useful for me and it's 100%working.
Great work..! Thank you Sir..!
Thank you very much for this easy tutorial.
Muy buen video pana, saludos de Colombia.
Great work... will try to follow the implementation.. keep it up 👍
Sure, Chathura, Thanx for the motivational words!
This video was random to me
Now I'm subscribed thinking that i get practical knowledge on ML
Supperb work. Please create biginner level tutorials series.. Good luck 👍🏾
Sure! thanx for the motivation
Bro u are a master your method to reach the target its a mix to easy effective end your explanation its very clear
Thank you 😊
@@aiwiththakshila6656 are u on discord
Good video sir need many more like this
dhinesh kumar I made algorithm for same but I need feedback can you please watch and give it ?
czcams.com/video/JtexyRC6e1Y/video.html
Great work. Aiya..
Great video sir 😍😍😍😍
thanks bro!! you're awesome
best lecture for this project
perrmission to learn sir.thank you
great work bro
Best explanation sir
Thanks so much. Its so help me
Superb. pls do more video lessons related to programming side and ML. Thank you
Sure, I will, Thank u. Stay tuned with us.
Best video about this
Could you make a full tutorial with explaining everything from the scratch what are the requirements to do this properly.
Sure I will soon.
@@aiwiththakshila6656 sir when i am waiting for it
@@aiwiththakshila6656 sir can you make full tutorial as mention above please!!
@@aiwiththakshila6656 When will you do a tutorial ?
@@aiwiththakshila6656 pls hurry up brother. I am waiting for this
very good lecture please make this video again lie by line code and briefly at the begging of the juypter installation up to last running of the code i think you have get a lot view and subscribers i miss you
Will this work if I don't use the ROI and just use the camera feed. I can move my face close to the camera. I've read that lighting conditions make the face cascade better but I'm not sure exactly how to do that.
Hey guys whoever is facing the accuracy issue just change the pixels to 224 and then accuracy and val accuracy boosts up to 90 percent
in which line exactly? please help
good job sir
Hi, I'm a newbie to machine learning, I would like to know if we try to implement this on a video captured from a CCTV camera, should the dataset be changed or does the CNN still give a accurate prediction ?
Here's a paid course for this and it's worth paying.
khadymschool.thinkific.com/courses/data-science-hands-on-covid-19-face-mask-detection-cnn-open-cv
Instead of using a haarcascade use a model trained with many data using keras it can give more accuracy.
in regarding the uploading of files, im stuck in that
sir, I do not have much space to download images. Can you please tell me how can I use image url
Is this better compared to transfer learning (like mobileNet) so there is no need to use a cascade classifier?
InternalError: cudaGetDevice() failed. Status: cudaGetErrorString symbol not found.
I have installed CUDA 10.0 . I have checked my environment variable path too. How do I solve this error?
Thank you.
Can I know where exactly the output with mask and without mask is stored in video progran
Thank youuu!!!
Hi! great video! Is it possible to add an other model, for example with glases? I mean, un the dataset folder add to the mask and no mask folder one with glases.
Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation.
please help me.
Thank you sir
i want to count the number of people with and without masks and show the result on dashboard using flask.. do you have any idea how it can be done?
module 'keras.optimizers' has no attribute 'TFOptimizer' it is giving this error >> how do i remove it please help
There is an error coming while doing the VideoCapture part of openCV. Can you please help.
hi am an problem in keras "jupyter notebook's kernel keeps dying" can you help me?
can anyone help me i am trying to run the last notebook and it does not open a window for my webcam what might be the issue everything else runs fine
Thanks bhai
Anyone getting constant errors on OpenCV while running the face detection file?? Please help!!
Sir apke jo IN[15] me error ara h konse packages install krne h plz reply asap
model.predict(reshaped_img) this line problem
input 0 of layer dense 2 is incompatible with the layer
I'm new in machine learning, can anybody explain me which cnn model used in this video ??
any idea about dataset for detecting headphone? Can I generate similar like this ?
cv2.rectangle(img,(x,y),(x+w,y+h),color_dict[label],2)
TypeError: function takes exactly 4 arguments (2 given)
why i am getting this error, can any one help
NOTE:--- I am running this code on spyder
Can this program can be used for multi class classification like face recognition
Could you please create video for training the model in cloud free GPUs including the deployment also?
thank you for this tutorial . can you please upload a video explaining how to detect blood on the face.
Why do u wanna detect blood bro? What's ur project all about
all the dataset contains only white colored mask i had used black mask but it did't showed the label mask with green color. It shows correct when i am without mask. But with mask it did't show anything.
module 'tensorflow.python.keras.backend' has no attribute 'get_graph' getting error sir
sir how did you extracted/downloaded "model-017.model" file ?...
in my case 19th epoch gives least validation loss value and best accuracy , so i need to use "model-019.model" file, but from where to get that file?
save your model using model.save('yourmodelname')
Sir , did face mask detector also detect the scarf or handkerchief use to cover our face ???
bro iam facing
ModuleNotFoundError: No module named 'google' this error when i try to compile keras.utils to import np_utils. kindly help me in this bro.
Hey sir nice work but why we r using keras nd one more doubt its like u have saved the modules of video but if we want to test it live like when we execute and run the code at that time webcam open show so that there is no need to save the models .......nd yes then how what changes i have to do.Can we implement without neural network.
How did you save the cnn model in your local machine?
Error when checking target: expected dense_2 to have shape (2,) but got array with shape (1,) sir im getting this error when i try to fit the model
Use this after train_test_split() :
from keras.utils import to_categorical
train_target = to_categorical(train_target)
Please sir, if I use three records in my dataset: "with mask", "incorrect worn mask" and "without mask". What changes should I make in this case? You have not shown us how to do this if we are using several folders.
I made this change: model.add (Dense (3, activation = 'softmax')). The model training is going well but I get an error at the end that says: Shapes (None, 1) and (None, 3) are incompatible.
And when I launch the program, it's only the face with NO MASK that are recognized.
Bro do you finish it
I tried to implement the same but my accuracy is not increasing its around 0.5.. only
why is it?
how to solve this problem?
Did u make any changes?
@@aiwiththakshila6656 none. we are getting validation accuracy around 47%. Can you rerun and verify your model's performance?
hey try increasing the ROI or the pixels 100 100 (Mostly wont work) u can push it to max 50 in validation
I think none will work as the training samples are less so we need more training samples
why did you convert it into 4d array in the beginning ???
Hello sir i getting this error how to solve it
ImportError: cannot import name 'np_utils' from 'keras.utils' (C:\Anacond3\Lib\site-packages\keras\utils\__init__.py)
Can I do this as my final year project? Please reply
after doing everything the camera is not opening ,the camera will be running but it wont open and show live as u shown above
Sir please how can be detect the face and maskes , i download the datasets and i run your program ,it not detect the the face and mask , please help me
I have used cascade classifier to detect the face. When the mask is on, some of the features in the face are not visible, therefore sometimes the face is not detected when the mask is on. If you try with a better camera and better light conditions (day light), it may work well.
Hi, thanks you for the code, it works well, sure it is written no mask without mask, but the problem is that with mask it isn't written anything. what should I do.
Can you plz send code harishdasari963@gmail.com
yeah i had this problem too
same issue
What is the detection algorithm used in the training the model?
I have a problem in the last part, im using colaboratory: penCV(4.6.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
i do not use the file haarcase_face.xml in project is it okey?
Thanks for the video, it show around 95 percent accuracy but while testing the system doesnt detect my face with a mask. is it a problem with haarcascade?
Same problem here, did you find out a solution?
Why is that you have takes categorical cross entropy
As there are only 2
Why can't we take binary cross entropy can't we take in that manner!?
Can you guide me sir, if I want to write the same code in vizual studio then how can I do it?
hello how can i recogize the person with mask like if he messi or cristiano...etc
Hi,
I tried running your code. The model is only detecting NO MASK. When I wear a mask, it's not detecting. Can you please help with probable reasons?
you can use this one, github.com/rupakdas18/Face-Mask-Detection-using-Traditional-CNN
hi,
i don't know how to run the code and not to connect my webcam.please help me
@@venkatreddy-nv2hc What software are you using to run the code?
@@rupakkumardas2351 jupyter sir
@@venkatreddy-nv2hc Try to use spyder
I m a bit confused how to implement this.Can u please help?
error: OpenCV(4.6.0) C:\b\abs_f8n1j3l9l0\croot\opencv-suite_1691622637237\work\modules\highgui\src\window.cpp:1267: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage' , i am getting the error like this what should i do know
Can we use pre trained networks for this?
While training the model, it is only considering 31 images instead of 990. Can you suggest me something how can I proceed?
While debugging the all data is loading perfectly and it is also getting divided correctly into train data and test data. Does anyone also faced the same issue?
@Akshay Kagwade,I am also facing the same.In the video here,all 990 images are taken but when i tried it only 31 images were taken.
@AI with Thakshila,can you please help me fix this?✌✌✌
@@nithyashreev3404 I am having the same issue it is because haar cascade can only detect patterns of black and white and it seems the project works fine only if simple plain mask is worn.
same issue here
Great solution, Great explanation
where do the model is stored? Is it possible to have a file to use it later without the training phase?
Yes. The 3rd code does what you asked
May I know how to upload this dataset folder to google colab
export_path = os.path.join(os.getcwd(), 'model', '2016')
I am getting this error. Can anybody please help?
I need source code for obstacle detection in railway track during night time using machine learning language..please give some idea
if we cover the face with hands what it will show mask or no mask??
Hello sir' great explanation but there is problem because, it cannot detect face after applying mask and I this problem is because I don't have object classifier.ipynb file
Pls solve this problem
Hello can u provide me the complete documentation report of the project so that I can step ahead to work upon it .....
hi can i use that code for more than 2 class to detect the use of mask?
can you please explain that how did you write the code in color_dict at 13:30 in video? please sir......!!! and sir have you write this complete code by yourself?
How can I solve the overfitting problem ?
Cascade classifier file is not available in the github code sir.. Please share
How to do over fitting and under fitting in computer vision
Thanks for your video, i have one query. If I am loading an image with four persons, for example 2 wearing masks and 2 not wearing mask. I need to figure out who is wearing mask and who is not wearing mask by bounding box using the same deep learning(with minor change with your existing code). is it possible, if so please help. Thanks in advance
I have a problem in 3.0 detecting masks in the last cell, which I can't fix, please help me.
error: OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
hello how to use image instead of live
can you share the link to get the dataset ?