Convolutional Neural Network from Scratch | Mathematics & Python Code

Поделиться
HTML-код
  • Опубликовано: 26 июн 2024
  • In this video we'll create a Convolutional Neural Network (or CNN), from scratch in Python. We'll go fully through the mathematics of that layer and then implement it. We'll also implement the Reshape Layer, the Binary Cross Entropy Loss, and the Sigmoid Activation. Finally, we'll use all these objects to make a neural network capable of classifying hand written digits from the MNIST dataset.
    😺 GitHub: github.com/TheIndependentCode...
    🐦 Twitter: / omar_aflak
    Chapters:
    00:00 Intro
    00:33 Video Content
    01:26 Convolution & Correlation
    03:24 Valid Correlation
    03:43 Full Correlation
    04:35 Convolutional Layer - Forward
    13:04 Convolutional Layer - Backward Overview
    13:53 Convolutional Layer - Backward Kernel
    18:14 Convolutional Layer - Backward Bias
    20:06 Convolutional Layer - Backward Input
    27:27 Reshape Layer
    27:54 Binary Cross Entropy Loss
    29:50 Sigmoid Activation
    30:37 MNIST
    ====
    Corrections:
    23:45 The sum should go from 1 to d
    ====
    Animation framework from @3Blue1Brown: github.com/3b1b/manim

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

  • @KCOANIKETSINGH
    @KCOANIKETSINGH 3 года назад +219

    This is one of the best explanation of CNN on the internet for me, and that 3b1b video format is cherry on the cake. Please keep on making these videos.

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

      Yeah , for sure !

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

      Honestly, this is barely an explanation. He just showed you the steps to achieve CNN from scratch. He did not explain why we did some of the stuff we did, like the cross-correlation and stuff.

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

      @@mysticlunala8020that's what other videos out there already do. The focus of this video was how to actually put all the concepts into code concisely and intuitively.

  • @TenzinDayoe-vy6vu
    @TenzinDayoe-vy6vu Год назад +6

    Cannot believe that tutorials like this exist. Thank you so much. I have been looking for a tutorial for a long time and I finally found it. This is definitely one of the best tutorials out there!

  • @FahmiNoorFiqri
    @FahmiNoorFiqri 2 года назад +8

    Thank you so much! I've been searching for this kind of explanation of CNN, especially the backprop process. I'll for sure cite this video in my thesis. Thank you!

  • @JPTL-bl4js
    @JPTL-bl4js Год назад +3

    This is for real one of the best videos related to any type of NN I've ever seen. Most videos just scratch the surface of how these NNs work, but you went deeper and in an understandable way. Congratulations and keep the good work!

  • @3dascension744
    @3dascension744 2 года назад +2

    I love your teaching! This is perfect for me and exactly what I have been looking for. Thank you for your contribution. These videos are gold!

  • @animeshpande1915
    @animeshpande1915 Год назад +5

    After going through many blogs, this helped me just fully understand these networks. Such a great teacher you are!!!

  • @BassMarineBeatz
    @BassMarineBeatz Год назад +6

    This is the best and calm explanation in NNs that I have ever seen on Internet! Amazing work, definitely sharing it to my colleagues

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

    Thank you!! I'm making a machine learning library from scratch for fun and I've been confused with some details that thanks to you now I understand. It's my favorite explanation of CNNs on youtube

  • @delete7316
    @delete7316 10 месяцев назад +12

    I know it’s a bit late, but I thought I should mention how well this video is paced and structured. The listing and crossing out of what topics are to be covered makes the video very clear, concise and easy to follow.

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

    please please please keep making more videos. This is so insightful and relaxing to watch.

  • @user-wb3dh2ki9x
    @user-wb3dh2ki9x Год назад +1

    the "from scratch" series you made is pure gold!!

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

    This is too much underrated.
    Keep doing the good work. I really appreciate your contribution.

  • @jamesnguyen3459
    @jamesnguyen3459 Год назад +6

    Please produce more high quality videos like this. Your 30-minute video explains CNN better than my 1-semester AI class in college

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

    The best explanation of CNN I have ever seen. Thank you!

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

    Man, I hope you channel become very huge. Thanks, this is the one of the best videos on youtube and not just about this topic, it is in general one of the best video in youtube

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

    You are a gifted teacher bro. I can't believe you've only got 50k views. But then again with how esoteric the content you're teaching is, it's impressive that your videos are so popular! Thank you

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

    True that. After reading so many blogs on Medium, none could solve all my doubts. You did it. Kudos to you.

  • @dark_gamer4550
    @dark_gamer4550 2 года назад +3

    I really love this explanation of CNNs. It almost makes them look easy

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

    I am really so fortunate to have found this amazing video. I will really mention reference of this video at multiple places. Thanks for the hardwork :)

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

    I am making a CNN from scratch and I was a little bit stuck on how to find the gradients of convolutional layers but that little digression about how the equation of a convolutional layer is really just a more general version of the equation of the dense layer output really made it clear for me! This video is gold

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

    Finally understood backprop of conv. Thank you for the great video!

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

    You are one of the best had ever explained this topic. Keep up your easy and succinct style. thumbs up

  • @denismerigold486
    @denismerigold486 2 года назад +11

    Your lessons are works of art!!!

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

    this is definitely one of the better videos on the topic, surprised it doesn't have more views (:

  • @rocksbox156
    @rocksbox156 7 месяцев назад

    I'm an undergrad student studying CS at Georgia Tech. This video explained the backprop in CNN's better than my professors. A true gem.

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

    Came across this while trying to code Resnet in pure CUDA
    The best explanation on the topic!
    Great Thanks!!

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

    It's really the best explanation I have ever seen about convolution neural network
    Thank you pro.

  • @mr.anderson5077
    @mr.anderson5077 2 года назад +1

    GREATEST LECTURE EVER ON CORE DEEP LEARNING.... THANK YOU MATE

  • @marvinmartin1373
    @marvinmartin1373 3 года назад

    Another piece of art! Thank you

  • @methsiri123
    @methsiri123 26 дней назад

    One of the best tutorial I have gone through. Thank you so much.

  • @Elonimous
    @Elonimous 7 месяцев назад

    This video is amazing, It really helped me understand the math behind CNNs - thank you!

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

    The best-ever tutorial. thank you.

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

    I dont know if its the music but this video is incredibly calming, thanks for this!

  • @bob-ym3gk
    @bob-ym3gk Год назад +1

    Great thanks!This is the clearest video about CNN's on the whole internet!😀

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

    Thanks for making this. You're really good at doing what you do.

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

    best video on Convolutional layer. Good job!

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

    This is amazing man. Very informative!

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

    Amazing video, watched it multiple times. The only feedback I can give is, you can be a little more mindful of your words specifically, it felt like you were strongly implying the nature of CNNs to have a forward pass function that is more general than a FFNN which is an interpretation. Regardless, the best video I've seen on CNNs. Thank you so much

  • @bradleyadjileye1202
    @bradleyadjileye1202 7 месяцев назад +1

    thank you very much for this masterclass

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

    Thank you so much of those two excellent videos !!!

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

    best video on cnn ever

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

    Thank you for explaining very clearly!

  • @yaaryany
    @yaaryany 8 месяцев назад

    Thanks a lot for this video. Couldn't be more grateful!

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

    One of the best explanations for CNN on internet! Your channel would be Big in future.

  • @hossamel2006
    @hossamel2006 7 месяцев назад +2

    Numpy needs to add this operation and give it a name for real 8:46
    Edit: Ammmazing video btw!!

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

    Thank you for your time and effort, this is the best so far for me

  • @Misscrazy3957
    @Misscrazy3957 3 года назад +4

    Perfect Perfect i like this channel. Bravo, i found what i was looking for. Really thank you Sir.💚

  • @VimalKumar-oy4uw
    @VimalKumar-oy4uw 7 месяцев назад

    Man , I am mind blown by your content . Such a great video 👌

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

    best CNN video on youtube by far!

  • @b.v.r.r.jayasinghe415
    @b.v.r.r.jayasinghe415 11 месяцев назад

    Best Explanation... lv ur teaching style and animations

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

    BEST video! Thanks a ton!

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

    Finally, a tutorial where I got to know how the 3-channel RGB is being mapped mathematically into features. It is surprising to watch so many tutorials and none mentioned that for every channel there is a corresponding kernel and the summation of the convolutions was used to get the result for the next step. They all show h*w*3 and then a single 3*3 kernel. Example this video: C4W1L08 Simple Convolutional Network Example

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

    Just amazing work ❤

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

    Thank you so much for those tutorials. They are really clear and well explained. Pls do that in every domain you know, even if its plumbery

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

    very high quality video and amazing explanation!

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

    Exceptional explanation, thank you for sharing this.

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

    3b1b video format & amazing calming voice
    OMG, you are a treasure

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

    Best ever video on CNN, hats off!

  • @user-bx7xh3wy1b
    @user-bx7xh3wy1b 6 месяцев назад

    wonderful, fantastic, thanks a million

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

    Great sir !! i find about backward kernel so long time thank you

  • @jvnganesh4943
    @jvnganesh4943 Месяц назад

    really found this video very interesting and informative . I really appreciate it a lot. Thanks!

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

    Great video - first I saw that really shows how to thing about implementation

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

    I've been reading about CNN and image recognition for a while to make my own one for my project idea, but never thought or found something that brought me light into how to implement a CNN, because I want to do it from scratch, with the maths and all staff.
    You have thought me a lot on 33min of video, now I know how I can make my own CNN, and also that I need to go over derivatives UwU
    Thanks a lot!!!

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

      Thank you for the kind message, I'm really glad if it helped :)

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

    Excelent Video!!! Thanks for inspiration.

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

    This in a very good tutorial to learn about CNN. Thank you so much.

  • @arnetriesyoutube
    @arnetriesyoutube 11 месяцев назад

    I had so many aha moments here! this is awesome

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

    Incredible video!

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

    This is amazing work, thank you so much :)

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

    interesting and well organized demo!!!!

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

    Great video! helped me a lot!!!

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

    awsome, thank you for the tutorial it really help me out to understand about cnn with easily

  • @ali-ates
    @ali-ates Год назад

    heavy logical equations like poetry, the only channel I activate the bell :D thanks for all.

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

    Great Video!

  • @pkurian1211
    @pkurian1211 3 года назад

    woow amazing explanation..thank you!

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

    excellent video on CNN ever thanks buddy. Do more videos like this!!

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

    Thanks, This vidio was perfect also had some beauty of mathematics

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

    Thanks a lot!

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

    Perfect Perfect i like this channel. Bravo, i found what i was looking for. Really thank you Sir

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

    Excellent!

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

    It is really help me to understand the whole concept of Convolutional Network. Especially the backpropagation. Please make some video on RNN, LSTN. Thank you.

  • @user-fv9pb3rf9i
    @user-fv9pb3rf9i Год назад

    I feel like I don't deserve to get such content for free.. Amazing job!

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

    Fatnastic brother!
    I really apprciate what you are doing
    thanks🎉🎉

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

    LOVE IT!!!

  • @easyBob100
    @easyBob100 2 года назад +10

    Your "from scratch" videos are great! I was able to convert them into c++/cuda neural net classes and they work better than my old code. Thank you!
    Also, is there any way you can do one for an "Unconvolutional" layer? I would love to mess around with different types of autoencoders for images. :)

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

      Deconvolution is just a convolution, you just pick your convolved image, and use a bigger filter and add some padding.

  • @muze3k
    @muze3k 3 года назад

    This is extremely in-depth and just what I needed... All the best for future videos..

  • @simssim262
    @simssim262 3 года назад

    Your videos are amazing 🙃❤

  • @shivu.sonwane4429
    @shivu.sonwane4429 3 года назад

    Wonderful explaination love from India🇮🇳

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

    Hey, thanks for your knowledge, please share more❤

  • @codybarton2090
    @codybarton2090 21 день назад

    Great video

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

    Your animation reminded me of 3Blue1Brown videos. Awesome stuffs! :)
    Thanks for sharing!

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

      It's because I'm using his library :)
      github.com/3b1b/manim

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

    Best video of its kind. Please do RNN's!

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

    Thank you for this! great explaination.
    I will request you to do "Attention" next if possible.

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

    You could implement the hypermatrix operation you talked about in the beginning of the video in order to simplify the forward and backward functions of the Convolutional layer, removing all the loops

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

    please keep posting videos, thanks

  • @user-po7ei3nl5c
    @user-po7ei3nl5c 10 месяцев назад

    Thank you so much

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

    yougot yourself a new subscriber my firend

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

    I have started my AI journey a month back and I have lots of confusion as how these CNN are getting parameters and how is it passing through layers and why reshaping and many more queries. I give full star to clear all the doubts on this video. This is saviour for me in my AI journey.

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

    very underrated video..

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

    Utterly Beautiful

  • @Rohit-fr2ky
    @Rohit-fr2ky Год назад +9

    Wow your content is super awesome,
    it would be super cool if you would also code RNN, LSTM, GRU and all that.. 🙂