Build a Deep Face Detection Model with Python and Tensorflow | Full Course

Поделиться
HTML-код
  • Опубликовано: 19 июн 2024
  • Learn how to build a face detection model using an Object Detection architecture using Tensorflow and Python!
    Get the code here: github.com/nicknochnack/FaceD...
    Links
    github.com/wkentaro/labelme
    albumentations.ai/docs/gettin...
    www.tensorflow.org/api_docs/p...
    Chapters
    0:00 - START
    0:38 - Explainer
    1:38 - PART 1 - COLLECt IMAGES & ANNOTATE
    2:22 - Breakdown Board
    8:51 - Setting up and Getting Data
    32:47 - PART 2 - PARTITION & AUGMENT DATA
    34:11 - Review dataset and build Image Loading Function
    45:32 - Partition Unaugmented Data
    53:08 - Apply Image Augmentation on Images and Labels
    1:07:10 - Build and Run Augmentation Pipeline
    1:15:10 - Prepare Labels
    1:19:04 - Combine Label and Image Samples
    1:24:57 - PART 3 - BUILD & TRAIN THE DEEP LEARNING MODEL
    1:26:09 - Build a Deep Learning Model using the Functional API
    1:41:20 - Defining a Custom Loss Function & Optimizer
    1:45:51 - Train a Neural Network
    2:03:25 - PART 4 - TEST AND PERFORM REAL TIME DETECTIONS
    2:18:28 - Final Results
    2:25:42 - Ending
    Oh, and don't forget to connect with me!
    LinkedIn: bit.ly/324Epgo
    Facebook: bit.ly/3mB1sZD
    GitHub: bit.ly/3mDJllD
    Patreon: bit.ly/2OCn3UW
    Join the Discussion on Discord: bit.ly/3dQiZsV
    Happy coding!
    Nick
    P.s. Let me know how you go and drop a comment if you need a hand!
    #deeplearning #python
  • НаукаНаука

Комментарии • 356

  • @dikshyakasaju7541
    @dikshyakasaju7541 Год назад +9

    This is great, Nick! Appreciate all the effort you put in to make all the tutorials amazing.

  • @kailashbalasubramaniyam230
    @kailashbalasubramaniyam230 Год назад +10

    1 hour through the video and i can already feel that this video has got a lot more clarity, simplicity and less errors(of-course) than the last object detection video

  • @ianthompson6608
    @ianthompson6608 Год назад +1

    Just came across your channel. Mad props for working through your mistakes instead of editing them out. Keep it up! 👏👏

  • @python-programming
    @python-programming 2 года назад +5

    This video could not have come at a better time for me. I jumped through it and will be returning next week to watch it all. Thanks for this! You also got a sub from me.

  • @karthikeyanradhakrishnan3219
    @karthikeyanradhakrishnan3219 6 месяцев назад

    Thanks Nick! A very great video on Object detection, I have also followed your previous TFOD course. Great effort in making a lengthy video that helps us a lot! Kudos!

  • @DrShaikAhmad
    @DrShaikAhmad 2 года назад +4

    You are awesome Nick. This is what precisely what I need and the whole community is need.

  • @UICNetworksGuy
    @UICNetworksGuy Год назад +1

    tysm! i've been trying to create a model like this for a while now, and this is the first one i found that works! you're a life saver!👊

  • @OmaraAJ
    @OmaraAJ 4 месяца назад

    I like the video, explanations are clear and to the point. But I've to admit, I like it when people type out the code from scratch instead of reviewing code. Thanks for the tutorial.

  • @divelix2666
    @divelix2666 Год назад

    Awesome tutorial, man! I especially appreciate part where you show you debug process, really useful.

  • @aoiharu5976
    @aoiharu5976 3 месяца назад

    thank you!! it helped a lot to build face detector from stratch and i've learned tons of things from you, really appericiated

  • @ironclad8994
    @ironclad8994 2 года назад

    dude really amazing work! got it all working this time! really happy with the outcome! tyvm

  • @katesaychaleun6322
    @katesaychaleun6322 9 месяцев назад

    Your video is amazing! It's engaging and practical.
    I also love how this is similar to your video from 2 years ago, but shorter :)

  • @samerrkhann
    @samerrkhann 2 года назад

    A huge appreciation for you nick to putting this together

  • @nikitabalani
    @nikitabalani Год назад

    Great video, Nick! Thank you for putting this together!

  • @hayleighwitmer7127
    @hayleighwitmer7127 Год назад +2

    Wonderful presentation. Very nice imagery and explanation.

  • @allankumo
    @allankumo Год назад

    Hi, Nick!. This is so help me to understanding about build one of deep learning method, especially with tensorflow. Thank you so much for your effortS to make it done your amazing tutorial. I hope you more have a fantastic what you done next.

  • @yuval_kahan
    @yuval_kahan 17 дней назад

    one of the few youtube channels that actually can be taught from - super rar , thank you so much for your work 🙏🙏🙏🙏🙏🙏🙏🙏🥳🥳🥳🥳

  • @yolandasundari5356
    @yolandasundari5356 2 года назад +1

    Amazing video! Can’t wait for real time speech recognitizion with python tensorflow🤩🤩

  • @lalu15248
    @lalu15248 Год назад

    That was a really great video. And I'd really like the idea of making one where the images are multi labeled!!

  • @ege621
    @ege621 2 года назад +40

    A multiclass object detection with data augmentation pipeline would be LIT !!!! Great work as always :)

    • @maximeentsi2205
      @maximeentsi2205 2 года назад

      Hey! It is possible, you just have to add N coordinates into array and add N labels into class_labels

    • @user-gu9hg5pu4c
      @user-gu9hg5pu4c 2 года назад

      @@maximeentsi2205 can you clarify more where exactly is it?

    • @maximeentsi2205
      @maximeentsi2205 2 года назад

      @@user-gu9hg5pu4c There are many changes, you have to adapt your code in order to read array of many coords, etc. I haven't finished adapting everything yet, I even have to change the outputs of the neural network, but I think it's feasible.

    • @ege621
      @ege621 2 года назад

      @@maximeentsi2205 Yea right, I think where it gets tricky is that the whole structure in this video is like a binary classification problem. Converting that to accept multiple classes might be confusing..

    • @jorgeffonte
      @jorgeffonte 2 года назад

      @@maximeentsi2205 did u finish it?

  • @panasrat457
    @panasrat457 Год назад

    Thank you Nick! Always love your videos.

  • @hiya_bhatt
    @hiya_bhatt Год назад

    This video truly helped me a lot, thanks!

  • @me965563
    @me965563 2 года назад +5

    this was much more accurate than the one you did in the last tutorial great job man👏🔥

    • @NicholasRenotte
      @NicholasRenotte  2 года назад +2

      Yeah ton of lessons learned from that one!

  • @williammantovanelli9577
    @williammantovanelli9577 Год назад

    Congrats, im learning to much with you

  • @tonyrubanrajraja974
    @tonyrubanrajraja974 Год назад +3

    Hi Nicholas, I loved the tutorial but have one suggestion. You have extended the Model class and implemented FaceTracker class to fit multiple loss functions. But you could have used the Keras' Model.compile() parameters - loss, loss_weights to pass both the loss functions and their corresponding weights as arguments and avoided the FaceTracker class.
    model.compile(optimizer = opt, loss = [loss1, loss2], loss_weights = [weight1, weight2])

  • @gustavojuantorena
    @gustavojuantorena 2 года назад

    Keep it up Nicholas! 100K follows it's getting closer 💪💪💪

  • @hamoodya659
    @hamoodya659 2 года назад

    Amazing work. I love your channel.

  • @aligholipour1974
    @aligholipour1974 2 года назад

    Hi Nicholas your youtube channel is great. i appreciate you

  • @marouanmdr273
    @marouanmdr273 Год назад

    Thank you so much ! a very interesting tutorial

  • @najiibrashiidabdi5014
    @najiibrashiidabdi5014 Год назад

    Thank Very much nicholas you explained easier

  • @MonikaSingh-nu5sg
    @MonikaSingh-nu5sg 2 года назад

    Thanks a ton for all your effort :)

  • @samirtarda1657
    @samirtarda1657 Год назад

    I really appreciate the throrough explanation of the code as you are working through the projects. Thank you so much. Very helpful and insightfull.
    Samll request. Can you please do a project to classify and image in runtime? This was part of an assignment for my course and I am not
    sure if this tutorial covers that part of the classification process. please advise..

  • @CliffordKintanar
    @CliffordKintanar Год назад +17

    Great tutorial, Nicholas! Thanks for putting this together!
    Suggestion for 40:10 , loading the image pipeline: this string will not work for Mac/ Linux, I think. I converted it to os.path.join("data", 'images", "*.jpg") for more robustness in the system.

  • @shekharkumar1902
    @shekharkumar1902 2 года назад +1

    After watching full 2h long video...Felt like "Ureka". Great Job 👍

  • @NoMercy8008
    @NoMercy8008 2 года назад +2

    Heads up, there's a very small typo in your chapters, the one for 34:11 has a space between the : and the 11 in your description, making it not show up as a chapter/timestamp in the video at all :)
    Really love this video, huge huge thanks for all the work, time and effort you put into this, much much appreciated! ❤
    object detection is really really awesome, you can do so much with it.
    Tons of usage examples, like the good ol' plant classification apps, but also for example quality control. My first thought for the latter was a PCB manufacturer using this to quickly detect faults (broken traces, bad solder joints or whatever) on their PCBs, but obviously even within that field alone, the possibilities are endless.
    And it is probably much quicker than a human to pick up those errors and finds even pretty small faults and stuff, too. Super super useful.
    And one has to say, TF is an awesome and super powerful library, the fact that they have SO many things included that you'll probably need for ML, even stuff like loading images and so on, makes creating your own ML apps so so much easier and quicker.
    And the albumentations lib seems absolutely awesome! Saves a ton of work and/or headache by handling the labels automagically, gotta love it!
    It's really really beautiful that people release their amazing software for public use like that, really gotta appreciate FOSS.
    So yeah again, huge huge thanks for the video, much appreciated, really loving it! ❤
    All the best, have an awesome weekend! :)

    • @NicholasRenotte
      @NicholasRenotte  2 года назад +2

      Fixed, you're an absolute legend! Agreed, it's insane how much open source stuff there is, albumentations is an absolute game changer. I just teamed up with a new team at work, there are so many new use cases we're going to be able to explore!

    • @roger_island90
      @roger_island90 2 года назад

      @@NicholasRenotte Hi Nick, please you did not add the confidence score in the bounding box in the detection. Pls, can you do that since I'm a beginner? Please help a brother. It will go a long way to help me in my research

  • @ashishvishwakarma6542
    @ashishvishwakarma6542 Год назад

    hanks lot Sir.. You helping us..

  • @MAXTHEREMIX
    @MAXTHEREMIX Год назад

    This guy deserves more views :)

  • @ydidiyaassefa5415
    @ydidiyaassefa5415 Год назад

    Hi Nick, really amazing video I liked how explained everything. Thank you so much. One more question how do you load the saved model when you want to use it again. Thanks for everything.

  • @emirzmen
    @emirzmen Год назад +3

    if anyone having x_max

  • @psychedeliccoffee2737
    @psychedeliccoffee2737 Год назад

    It works! Awesome tutorial!

  • @adityakonnur169
    @adityakonnur169 5 месяцев назад

    The augmentation part began and my brain just left the chat....😂😂 Absolutely melted...🤯
    still understood it after watching 2-3 times and understanding it with a fresh mind and also because it was Nich who was teaching it, it got way simpler than other videos/tutorials.... Thanks man❤🔥

  • @debsnilsamudra9993
    @debsnilsamudra9993 Год назад +3

    Hey Nick can you suggest how I can automatically assign bounding boxes and labels to a new image dataset and retrain the existing model to detect additional faces?

  • @JFischbeck
    @JFischbeck 2 года назад

    Nick great lab! Question for you. Do you have a work-around for installing tensorflow-gpu on a mac?

  • @preadtorsiddharth4391
    @preadtorsiddharth4391 4 месяца назад +8

    for the new coder watching video in 2024 tensorflow-gpu library has been disabled directly install tensorflow and opencv

    • @vivekgaur4369
      @vivekgaur4369 3 месяца назад

      hi, i am running above code as .py script, i am getting error:
      Traceback (most recent call last):
      File "E:\Vivek\PYTHON\Face_Detection\PartitionAndAugmentData.py", line 326, in
      hist = model.fit(train, epochs=10, validation_data=val, callbacks=[tensorboard_callback])
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py", line 123, in error_handler
      raise e.with_traceback(filtered_tb) from None
      File "E:\Vivek\PYTHON\Face_Detection\PartitionAndAugmentData.py", line 295, in train_step
      batch_classloss = self.closs(y[0], classes)
      can you help me with this ?

  • @pinged6576
    @pinged6576 Год назад +2

    @Nicholas Renotte When the pictures were taken I could not find them? Do you know where they are? I have also checked the Images folder/

  • @soumanabettoboubacar6995
    @soumanabettoboubacar6995 2 года назад

    Nice Nicholas. Thanks

  • @reza6130
    @reza6130 2 года назад

    thank you . You may teach about multi-object tracking, for example, using an algorithm deepsort. or ...
    Or a project about football analysis in video

  • @aleromende
    @aleromende Год назад

    Hi Nick, did you train all layers in this tutorial, including the vgg layers? or the vgg layers were frozen?

  • @junshen552
    @junshen552 Год назад +8

    Hi Nick, would really be fantastic if you could do a multiface detection system, i've manageed to learn a lot from your videos. thank you so much.

  • @armaang6411
    @armaang6411 Год назад

    your really the DJ Khaled of AI bro hats off to you!

  • @Ann-jw8bt
    @Ann-jw8bt 11 месяцев назад

    Hi @Nicholas, Thank you for this tutorial, it really helped. I will also like you to do a tutorial on detecting multiple objects on an image using SSD. Thanks

  • @lepitt1063
    @lepitt1063 10 месяцев назад

    Hi Nick, what cuda version are you using in this video? can i used cuda 5.1? Great video very helpful.

  • @qamilharith
    @qamilharith 2 года назад

    Hi nick!, Can we actually use any type of deep learning model to control a servo motor ? Or the model must have a output of interpreter for the servo motor to understand ?

  • @pratyakshagarwal-iw1es
    @pratyakshagarwal-iw1es 6 месяцев назад

    thanks u for uploading this amazing tutorial

  • @srezaziaee
    @srezaziaee 2 года назад +14

    Hi Nick, fantastic video as always. you are awesome. Would you please tell us how can we add multiple object detection, for instance, many faces? In the end, you have described some, but when I did the project couldn't run the real-time multiple!? how can I solve this, please?

    • @abdullaherzin4529
      @abdullaherzin4529 Год назад

      I'm currently dealing with the same issue. Were you able to resolve this issue?

  • @54M1WUL
    @54M1WUL 2 года назад +4

    this guy is on fire delivering content we want🔥

  • @azeeemm
    @azeeemm 2 года назад

    Hey nick!!
    can we execute in our own laptops with normal cpu or we need gpu for this project??

  • @aminaigibayeva3439
    @aminaigibayeva3439 2 года назад

    Hello! We wanted to do sign detection with this tutorial, firstly entered one sign "hello", 30 images. It ended up showing bounding box, but it wasnt reacting on any move/sign. What should we change in this code to make it work?

  • @hrittikobjectsol6128
    @hrittikobjectsol6128 Год назад

    Hey, Nick!!!
    Can we use 'create polygon' for labeling in labelme??
    as that may give better accuracy!!

  • @kunalwagh2129
    @kunalwagh2129 9 месяцев назад

    Very well versed sir!! I had a question, much appreciated if you could help,
    Could I use this same to classify between two different objects, say box with barcode and without barcode??

  • @hilnsworld762
    @hilnsworld762 5 месяцев назад

    thank you so much for this video

  • @gblazerify
    @gblazerify 2 месяца назад

    This is awesome, Nick! How does the complexity increase if you want to identify multiple boxes in the image, and/or combine them together to identify empty space in the image. Is there a similar approach to identify things in say, rendered html... Is there an alternative to cv2 that can render and visualize html, like chromium?

  • @ahmedgon1845
    @ahmedgon1845 Год назад

    Hi Nick, first thing to say, amazing video thank you so much, and when i do augmentation it just augment the images with no bounding box and discard the other why??

  • @bibianaalphonsagladies9949
    @bibianaalphonsagladies9949 Год назад

    Hey Nick! Cool Tutorial as usual, but I'm facing a problem. When we capture an image , before the albumentations and augmentation. The image is not getting loaded. If I check whether actually there is anything inside img , it says frame is empty. The part is exactly at 55:15. Clarifications from anyone would be much appreciated!

  • @snehalpatil6079
    @snehalpatil6079 Год назад

    Thank you for the video. I would like to know that can we apply the same code for multiple face detection???

  • @dongivafoc4493
    @dongivafoc4493 6 месяцев назад

    Hi so if i want to make it so that we could use it for multiple people the loss would be different right ? Would be great to have something more recent as well

  • @sarthakwalia8664
    @sarthakwalia8664 Год назад +1

    Hi Nicholas if i want to detect more than 1 faces what should i use?

  • @afaqueumer7968
    @afaqueumer7968 Год назад

    Hey Nick, One question how will i zip the images and bboxes if i have more than one labels. Let's say i am training for cola cans and i have multiple cans in one image but they all belong to the same label. Would you please help me out??

  • @creeda.7621
    @creeda.7621 2 года назад

    Hello. Do you have the method add percent at bounding box showing?

  • @esmael.c2b
    @esmael.c2b 2 года назад +4

    Now I'll rule the world with this

  • @mrunalketankumargandhi2673
    @mrunalketankumargandhi2673 9 месяцев назад

    Thanks for a great tutorial as always! I wish to know if this is implementable on a Windows machine with 16GB RAM and 4GB NVIDIA graphics card?

  • @jakubkahoun8383
    @jakubkahoun8383 2 года назад

    Thank you.

  • @ghitabencheikh5839
    @ghitabencheikh5839 5 месяцев назад

    Thank you so much for this video it helped so much. So we only use augmented data to train, test and validate the model. The original images are not used. am I right?

  • @fustigate8933
    @fustigate8933 Год назад

    Hi, nick, we already have a build_model method which returns a model, why do we need to build our own model class?

  • @priyankvachhani9460
    @priyankvachhani9460 4 месяца назад

    HI Nicholas. I am just wandering that is this the DeepFake Detection model using Deep Face Recognition? It will be great if you could clear my doubt and your work is amazing and I would like to do more research on this. Thanks!

  • @zeersaleem2017
    @zeersaleem2017 2 года назад +1

    Thank you Nicolas

  • @veesoho93
    @veesoho93 Год назад

    awesome thank you !

  • @Subi_Py
    @Subi_Py 6 месяцев назад +1

    Hey i trained this using photos of multiple people, how do i get it to tell who the face belongs to too ? i have kept the label separate for each of the people whose photos i have kept ,

  • @farouktouil5036
    @farouktouil5036 2 года назад +1

    Great Tutorial thanks , can I use it without GPU ?

  • @rajarshiray6582
    @rajarshiray6582 6 месяцев назад

    Thank you sir. But can we use MTCNN on detecting the facial features instead of labelme?

  • @Dujana-2018
    @Dujana-2018 2 года назад

    Hi Nicholas
    You are doing amazing work. And your channel is full of practical knowledge which is great. I have a question, can we use our normal pc to work on these projects or should it work on higher OS?

  • @nandanuds8604
    @nandanuds8604 Год назад

    great tutorial..helped a lot..can u please help to do multiple face detection with the same architecture?

  • @Rajiv90Vijay
    @Rajiv90Vijay 2 года назад +2

    Hey, i am try to recreate your sign language detection. but I have error on update config for transfer learning text_format.merge(proto_str, pipeline_config). I am searching online but I can't clear this error please help me.

  • @pierocasusol7279
    @pierocasusol7279 2 года назад +1

    Omg, this is gonna be epic...

  • @mhmdalishamass5388
    @mhmdalishamass5388 2 года назад +2

    Hello Nicholas , Great video !! I have a question, suppose I have approximately 15k images in my dataset and I want to annotate them all in 'COCO Format' , is there anyway faster than annotating them manually ? And then exporting them as a single json file. I would appreciate your help. Thanks

    • @NicholasRenotte
      @NicholasRenotte  2 года назад +1

      There are auto annotation tools out there! I don't have any recommendations for any but there are a few that are pretty good!

  • @nikw4740
    @nikw4740 Год назад

    in the override for train_step() shouldnt it be "self.opt.apply_gradients"?

  • @dimitheodoro
    @dimitheodoro 2 года назад

    CONGRATS!!!
    i still dont get something.
    in part 8.3 Build instance of Network
    how do you pass the coordinates as input ? The input accepts only the image as I can understand.
    where am i mistaken??

  • @hunar.abubakir
    @hunar.abubakir 2 года назад +17

    your tutorials are always great. Can you please add a code to convert it into tflite then imbed it in a flutter app? that will be great idea.

    • @lindanidlamini4567
      @lindanidlamini4567 Год назад

      were you able to do this Hunar? I also think its a great idea

    • @vamsik1453
      @vamsik1453 Год назад

      @@lindanidlamini4567 Were you able to do this Lindani? I also think its a great idea.

    • @amanm5087
      @amanm5087 Год назад

      @@vamsik1453 were you able to this Vamsi? I also think its a great idea.

  • @Sepiol2019
    @Sepiol2019 Год назад

    This could be a good option to create a facial recognition system or is it better to use algorithms that are already built?

  • @pauste2459
    @pauste2459 2 месяца назад

    Hey, i wanted to ask if you have any papers, regarding your information. I am currently trying to create some simple face detection for a subject at univ. and your tutorial is awesome.

  • @redabenlekehal5924
    @redabenlekehal5924 Год назад

    YOU ARE THE BEST😃

  • @thepirate_kinz1509
    @thepirate_kinz1509 5 месяцев назад

    Hey Nick, anytime I calculate the localization loss it returns an error saying operands could not be broadcast together with shapes (8,1,4) (8,2)

  • @searchthescripturessts6707
    @searchthescripturessts6707 Год назад

    please how did you get the Jupyter notebook you used in the video

  • @jawedhawari6927
    @jawedhawari6927 6 месяцев назад +1

    Do we really need to do those annotations of faces manually? I am confused.

  • @kapilujwal8039
    @kapilujwal8039 2 месяца назад

    nick what if i have dataset of different faces with different labels, how can i print those labels instead of just 'face'

  • @ashleysami1640
    @ashleysami1640 2 года назад

    Where did you get that plant with the lights though?

  • @s.a.m8481
    @s.a.m8481 2 года назад

    how is Learning rate decay calculated ? where did you get the numbers ?

  • @mmarsyad
    @mmarsyad 4 месяца назад

    I wonder is it possible to use ImageDataGenerator from TensorFlow Keras? and if possible how to deal with the coordinate 🤔

  • @roger_island90
    @roger_island90 2 года назад

    Hi Nick, you did not add the accuracy in the boundding box in the detection. Pls, how can I do that since I'm novice

  • @pratayushagoyal4574
    @pratayushagoyal4574 2 года назад +1

    Hi Nick,
    First of all thanks for putting so much efforts, your content is really helpful.
    I have a doubt, should we label blur images or not. Would blur images help the model classify better or would it make the model misunderstand the label.

    • @NicholasRenotte
      @NicholasRenotte  2 года назад

      Possibly! Could add it to the albumentation pipeline!

    • @mikesemple1439
      @mikesemple1439 2 года назад

      I'd suggest that this would not help for this dataset, since you now have less data, but more labels to train for. In general, you need a very large dataset for image recognition/object detection. 115 images is tiny dataset, 5000 images is still a very small dataset (ImageNet dataset is 1.2 million images, COCO dataset is 320k images).

    • @mikesemple1439
      @mikesemple1439 2 года назад

      Also since this a CNN based architecture, and assuming the blur is a gaussian/gamma distribution based blur, I'd suggest that blurring the images allows the can layers to learn a more generalisable kernel, resulting in higher accuracy on un-seen images.