Face Mask Detection using Convolutional Neural Networks - Python | Keras | Tensorflow | OpenCV

Sdílet
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

Komentáře • 527

  • @muhammadzubairbaloch3224

    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.

  • @abhilasht6471
    @abhilasht6471 Před 4 lety +1

    Your doing a great job buddy 👍, thanks for sharing your knowledge. keep up the good work 👏👏

  • @mdhabeeburrahman8884
    @mdhabeeburrahman8884 Před 3 lety

    Wonderful Tutorial bro, you earned my respect+++ , Your life long subscriber .

  • @bhaumikchaudhari1495
    @bhaumikchaudhari1495 Před 3 lety

    Thank you for your best explanation,,it is very very useful for me and it's 100%working.thank you once again ...🙏🏻🙏🏻

  • @lalunetu-thegamercat.3288

    subcribed! im gonna be waiting for more tutorials related to deep learning with live object recognition

  • @shashibhushan7161
    @shashibhushan7161 Před 4 lety

    thanks sir...providing such clear content on face mask detection on webcam

  • @myshigri12
    @myshigri12 Před rokem

    Thank you for your best explanation,,it is very very useful for me and it's 100%working.

  • @chathuranga5891
    @chathuranga5891 Před 4 lety +1

    Great work..! Thank you Sir..!

  • @subhambhattacharyya8802

    Thank you very much for this easy tutorial.

  • @m1zson
    @m1zson Před 4 lety +1

    Muy buen video pana, saludos de Colombia.

  • @ChathuraRanasingheOfficial

    Great work... will try to follow the implementation.. keep it up 👍

  • @sach2274
    @sach2274 Před 3 lety

    This video was random to me
    Now I'm subscribed thinking that i get practical knowledge on ML

  • @darshanadilhan2486
    @darshanadilhan2486 Před 4 lety

    Supperb work. Please create biginner level tutorials series.. Good luck 👍🏾

  • @ilcapitano6822
    @ilcapitano6822 Před 4 lety

    Bro u are a master your method to reach the target its a mix to easy effective end your explanation its very clear

  • @dhineshkumar4997
    @dhineshkumar4997 Před 4 lety +1

    Good video sir need many more like this

    • @karanpatel3358
      @karanpatel3358 Před 4 lety +1

      dhinesh kumar I made algorithm for same but I need feedback can you please watch and give it ?
      czcams.com/video/JtexyRC6e1Y/video.html

  • @kavindabuddhi
    @kavindabuddhi Před 3 lety

    Great work. Aiya..

  • @viralfever9159
    @viralfever9159 Před 3 lety

    Great video sir 😍😍😍😍

  • @MyMindhacker
    @MyMindhacker Před 4 lety

    thanks bro!! you're awesome

  • @Ekam873
    @Ekam873 Před dnem

    best lecture for this project

  • @ahmadkelixo7243
    @ahmadkelixo7243 Před 3 lety

    perrmission to learn sir.thank you

  • @vidhanagedhananjaya7571

    great work bro

  • @kunaldas5009
    @kunaldas5009 Před 3 lety

    Best explanation sir

  • @fitriantianti1731
    @fitriantianti1731 Před 3 lety

    Thanks so much. Its so help me

  • @worldwide8283
    @worldwide8283 Před 4 lety

    Superb. pls do more video lessons related to programming side and ML. Thank you

  • @dipeshadhikari8536
    @dipeshadhikari8536 Před 2 lety

    Best video about this

  • @savinabeysooriya7504
    @savinabeysooriya7504 Před 4 lety +45

    Could you make a full tutorial with explaining everything from the scratch what are the requirements to do this properly.

    • @aiwiththakshila6656
      @aiwiththakshila6656  Před 4 lety +16

      Sure I will soon.

    • @WinnersAttitude
      @WinnersAttitude Před 4 lety +5

      @@aiwiththakshila6656 sir when i am waiting for it

    • @mordehaym3239
      @mordehaym3239 Před 3 lety +1

      @@aiwiththakshila6656 sir can you make full tutorial as mention above please!!

    • @michalbelgorodsky4188
      @michalbelgorodsky4188 Před 3 lety +1

      @@aiwiththakshila6656 When will you do a tutorial ?

    • @sakib9527
      @sakib9527 Před 3 lety +1

      @@aiwiththakshila6656 pls hurry up brother. I am waiting for this

  • @yonaschekole832
    @yonaschekole832 Před 2 lety

    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

  • @vincentsmith1564
    @vincentsmith1564 Před 4 lety

    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.

  • @vaishnavkrishnan7996
    @vaishnavkrishnan7996 Před 3 lety +7

    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

    • @RT-kq9wr
      @RT-kq9wr Před 2 lety

      in which line exactly? please help

  • @csbdnazmul
    @csbdnazmul Před 4 lety

    good job sir

  • @sreeharinair6870
    @sreeharinair6870 Před 3 lety +2

    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 ?

    • @KHM95
      @KHM95 Před 3 lety +1

      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

  • @techtam3505
    @techtam3505 Před 4 lety +1

    Instead of using a haarcascade use a model trained with many data using keras it can give more accuracy.

  • @MsBoney123
    @MsBoney123 Před 4 lety +1

    in regarding the uploading of files, im stuck in that

  • @suvanjanprasai544
    @suvanjanprasai544 Před 3 lety +1

    sir, I do not have much space to download images. Can you please tell me how can I use image url

  • @quinjanrobertocampo8600

    Is this better compared to transfer learning (like mobileNet) so there is no need to use a cascade classifier?

  • @sheetalnikam4768
    @sheetalnikam4768 Před 4 lety

    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.

  • @sankavardhini8786
    @sankavardhini8786 Před 4 lety

    Can I know where exactly the output with mask and without mask is stored in video progran

  • @arshradhanpura8663
    @arshradhanpura8663 Před 3 lety

    Thank youuu!!!

  • @ChrisG56844
    @ChrisG56844 Před 4 lety

    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.

  • @tnn_thanhnguyenngoc7326

    Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation.
    please help me.

  • @ArunaDilshanRathnayake

    Thank you sir

  • @sadialakho0307
    @sadialakho0307 Před 4 lety

    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?

  • @issacholmes2475
    @issacholmes2475 Před 3 lety

    module 'keras.optimizers' has no attribute 'TFOptimizer' it is giving this error >> how do i remove it please help

  • @vishwasanilkumar1377
    @vishwasanilkumar1377 Před 3 lety

    There is an error coming while doing the VideoCapture part of openCV. Can you please help.

  • @renjunbias1042
    @renjunbias1042 Před 3 lety

    hi am an problem in keras "jupyter notebook's kernel keeps dying" can you help me?

  • @maksudulhaque3227
    @maksudulhaque3227 Před 3 lety

    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

  • @planetforengineers7176

    Thanks bhai

  • @prashilbison7038
    @prashilbison7038 Před 3 lety +1

    Anyone getting constant errors on OpenCV while running the face detection file?? Please help!!

  • @ruksarsheikh1727
    @ruksarsheikh1727 Před 4 lety

    Sir apke jo IN[15] me error ara h konse packages install krne h plz reply asap

  • @swapnamoybiswas929
    @swapnamoybiswas929 Před 3 lety

    model.predict(reshaped_img) this line problem
    input 0 of layer dense 2 is incompatible with the layer

  • @Bhaishorts_video
    @Bhaishorts_video Před 9 měsíci

    I'm new in machine learning, can anybody explain me which cnn model used in this video ??

  • @roshanid6523
    @roshanid6523 Před 4 lety

    any idea about dataset for detecting headphone? Can I generate similar like this ?

  • @keshavpatta9946
    @keshavpatta9946 Před 4 lety

    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

  • @perakamshashidhar1205
    @perakamshashidhar1205 Před 4 lety

    Can this program can be used for multi class classification like face recognition

  • @sobinbabu984
    @sobinbabu984 Před 4 lety +1

    Could you please create video for training the model in cloud free GPUs including the deployment also?

  • @firasoiderni8676
    @firasoiderni8676 Před 4 lety

    thank you for this tutorial . can you please upload a video explaining how to detect blood on the face.

    • @saiparichit1999
      @saiparichit1999 Před 3 lety +1

      Why do u wanna detect blood bro? What's ur project all about

  • @abhiyanshukumar9749
    @abhiyanshukumar9749 Před 3 lety

    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.

  • @saikotturu6455
    @saikotturu6455 Před 4 lety

    module 'tensorflow.python.keras.backend' has no attribute 'get_graph' getting error sir

  • @rishabhlavangad7975
    @rishabhlavangad7975 Před 4 lety

    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?

    • @hamzasuhail1512
      @hamzasuhail1512 Před 4 lety

      save your model using model.save('yourmodelname')

  • @rachanaadmane6086
    @rachanaadmane6086 Před 3 lety

    Sir , did face mask detector also detect the scarf or handkerchief use to cover our face ???

  • @jeevakumara5599
    @jeevakumara5599 Před rokem

    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.

  • @ElevateTheFacts
    @ElevateTheFacts Před 4 lety

    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.

  • @karamsahoo6852
    @karamsahoo6852 Před 3 lety

    How did you save the cnn model in your local machine?

  • @crazykatgaming5855
    @crazykatgaming5855 Před 4 lety +1

    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

    • @LMGaming0
      @LMGaming0 Před 3 lety +1

      Use this after train_test_split() :
      from keras.utils import to_categorical
      train_target = to_categorical(train_target)

  • @yannickedouardmekongo6400

    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.

  • @sachindhital4284
    @sachindhital4284 Před 4 lety +5

    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?

    • @aiwiththakshila6656
      @aiwiththakshila6656  Před 4 lety

      Did u make any changes?

    • @SoumendraBagh
      @SoumendraBagh Před 3 lety

      @@aiwiththakshila6656 none. we are getting validation accuracy around 47%. Can you rerun and verify your model's performance?

    • @vaishnavkrishnan7996
      @vaishnavkrishnan7996 Před 3 lety

      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

  • @bspuneeth9523
    @bspuneeth9523 Před 3 lety

    why did you convert it into 4d array in the beginning ???

  • @abdulqadeerrasooli3489
    @abdulqadeerrasooli3489 Před 7 měsíci

    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)

  • @atharvachennur4105
    @atharvachennur4105 Před 3 lety +1

    Can I do this as my final year project? Please reply

  • @PreetamKatti
    @PreetamKatti Před 3 lety

    after doing everything the camera is not opening ,the camera will be running but it wont open and show live as u shown above

  • @zakariaharakat7759
    @zakariaharakat7759 Před 4 lety +2

    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

    • @aiwiththakshila6656
      @aiwiththakshila6656  Před 4 lety +1

      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.

  • @walidsefiani9903
    @walidsefiani9903 Před 4 lety +7

    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.

  • @abhinavmishra2632
    @abhinavmishra2632 Před 2 lety

    What is the detection algorithm used in the training the model?

  • @Rojass760
    @Rojass760 Před rokem

    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'

  • @vietquangtran3489
    @vietquangtran3489 Před 3 lety

    i do not use the file haarcase_face.xml in project is it okey?

  • @ABDULAHAD-xr3sk
    @ABDULAHAD-xr3sk Před 4 lety +1

    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?

  • @tharunkumarbandaru2635

    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!?

  • @VirtualKnowledge
    @VirtualKnowledge Před 4 dny

    Can you guide me sir, if I want to write the same code in vizual studio then how can I do it?

  • @abdengineer6225
    @abdengineer6225 Před 4 lety

    hello how can i recogize the person with mask like if he messi or cristiano...etc

  • @abhishekbehera6950
    @abhishekbehera6950 Před 3 lety +5

    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?

    • @rupakkumardas2351
      @rupakkumardas2351 Před 3 lety

      you can use this one, github.com/rupakdas18/Face-Mask-Detection-using-Traditional-CNN

    • @venkatreddy-nv2hc
      @venkatreddy-nv2hc Před 3 lety

      hi,
      i don't know how to run the code and not to connect my webcam.please help me

    • @rupakkumardas2351
      @rupakkumardas2351 Před 3 lety

      @@venkatreddy-nv2hc What software are you using to run the code?

    • @venkatreddy-nv2hc
      @venkatreddy-nv2hc Před 3 lety

      @@rupakkumardas2351 jupyter sir

    • @rupakkumardas2351
      @rupakkumardas2351 Před 3 lety

      @@venkatreddy-nv2hc Try to use spyder

  • @adarshdash7022
    @adarshdash7022 Před 4 lety

    I m a bit confused how to implement this.Can u please help?

  • @shashankdevara6355
    @shashankdevara6355 Před 9 měsíci

    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

  • @adithyansukumar9288
    @adithyansukumar9288 Před 3 lety

    Can we use pre trained networks for this?

  • @AxaiKago
    @AxaiKago Před 3 lety +3

    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?

    • @nithyashreev3404
      @nithyashreev3404 Před 3 lety

      @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?✌✌✌

    • @yashgugaliya9276
      @yashgugaliya9276 Před 2 lety +1

      @@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.

    • @User-og1vb
      @User-og1vb Před 2 lety

      same issue here

  • @josegregorioperezmagallane3211

    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?

  • @HarryPotter-jd1dx
    @HarryPotter-jd1dx Před 2 lety

    May I know how to upload this dataset folder to google colab

  • @suryasingh425
    @suryasingh425 Před 3 lety

    export_path = os.path.join(os.getcwd(), 'model', '2016')
    I am getting this error. Can anybody please help?

  • @priyaindrakumar6679
    @priyaindrakumar6679 Před 3 lety

    I need source code for obstacle detection in railway track during night time using machine learning language..please give some idea

  • @sthitipragyansahoo2409

    if we cover the face with hands what it will show mask or no mask??

  • @harshitsingh4238
    @harshitsingh4238 Před 4 lety +3

    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

  • @TheCodingScience
    @TheCodingScience Před 3 lety

    Hello can u provide me the complete documentation report of the project so that I can step ahead to work upon it .....

  • @ilmanzidni8847
    @ilmanzidni8847 Před rokem

    hi can i use that code for more than 2 class to detect the use of mask?

  • @RuchiSharma-hv2xk
    @RuchiSharma-hv2xk Před 3 lety

    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?

  • @uguraltnsy
    @uguraltnsy Před 3 lety

    How can I solve the overfitting problem ?

  • @nikhitachikkamath2543
    @nikhitachikkamath2543 Před 2 lety

    Cascade classifier file is not available in the github code sir.. Please share

  • @xgamer2672
    @xgamer2672 Před rokem

    How to do over fitting and under fitting in computer vision

  • @karthick930
    @karthick930 Před 4 lety +1

    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

  • @user-cn1xg5cs3h
    @user-cn1xg5cs3h Před 2 lety

    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'

  • @anirudhsanga3552
    @anirudhsanga3552 Před 4 lety

    hello how to use image instead of live

  • @benedictanyarko4368
    @benedictanyarko4368 Před 4 lety

    can you share the link to get the dataset ?