Neural Network Python Project - Handwritten Digit Recognition

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024

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

  • @ruutjormun2262
    @ruutjormun2262 10 месяцев назад +8

    Had to sign in to say thank you. Breaking down each line is incredibly useful. I also love how you continually point out that there's areas for improvement and reference us to what may be classified as overkill. It gives an excellent gateway into machine learning by linking this seemingly simple explanation to actually recognised CNNs and FC layers etc.!

  • @al.d9592
    @al.d9592 3 года назад +10

    This video is really, really good. Used it to resurrect my 20y old ANN skills. Will use this in my classes now!

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

    Totally underrated video, perfect for people getting started with Neural Networks!

  • @christopherdessources
    @christopherdessources 4 месяца назад +3

    Hi guys. Just want to help anyone following this later like I was.
    Instead of using tensorflow (if you aren't seeing tf.keras.datasets which is what had me stuck), you can get the mnist variable from : from keras.api.datasets import mnist. Also if you import keras.api as k_api (or whatever name i suck at naming), replace all the tf.keras with k_api. It should work the same.

  • @GeoffryGifari
    @GeoffryGifari 8 месяцев назад +2

    so with tensorflow keras we don't need to code the weights and biases from scratch?

    • @kshitijnishant4968
      @kshitijnishant4968 5 месяцев назад +1

      that's the purpose of ML frameworks like pytorch and tensorflow buddy

  • @GeoffryGifari
    @GeoffryGifari 8 месяцев назад +1

    are there repositories out there where we can get training data?

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

    I followed this tutorial and it runs with similar loss and accuracy results to the video. My problem is when I make my own written numbers, the accuracy is usually less than 50%. I have tried playing around with the number of hidden layers, numbers of neurons, and number of epochs and I don't see any real change. What other likely places I could look to find a fix.

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

      I have the same issue. The more I trained the data, the more inaccurate it actually got.

    • @BhanuPandey-hl9ql
      @BhanuPandey-hl9ql Год назад

      got the same issue here, have you fixed it any leads?
      @@HaxeHere

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

      Try replacing all of the model.add lines with this 😉
      model.add(tf.keras.layers.Conv2D(32, (3,3), activation='sigmoid', input_shape=(28, 28, 1))) # The one in "(28, 28, 1)" is required or else it'll error out
      model.add(tf.keras.layers.MaxPool2D((2, 2)))
      model.add(tf.keras.layers.Conv2D(48, (3,3), activation='sigmoid'))
      model.add(tf.keras.layers.MaxPool2D((2, 2)))
      model.add(tf.keras.layers.Dropout(0.5))
      model.add(tf.keras.layers.Flatten())
      model.add(tf.keras.layers.Dense(500, activation='sigmoid'))
      model.add(tf.keras.layers.Dense(10, activation='sigmoid'))

    • @BasedArmenian-kh8pb
      @BasedArmenian-kh8pb 4 месяца назад

      @@Splendisimo
      for anyone wondering, the changes are essentially:
      - Using a convolutional neural network
      - Using a Sigmoid function instead of ReLU

  • @bobvance9519
    @bobvance9519 8 месяцев назад +3

    I got this error. Changing the extension of the model to keras solved it.
    File "C:\Users\user\anaconda3\envs\main\Lib\site-packages\keras\src\saving\saving_api.py",
    line 106, in save_model
    raise ValueError(
    ValueError: Invalid filepath extension for saving. Please add either a `.keras` extension for
    the native Keras format (recommended) or a `.h5` extension. Use `model.export(filepath)` if you want to export a SavedModel for use with TFLite/TFServing/etc. Received: filepath=handwritten.model.

  • @anhurtjv
    @anhurtjv 2 года назад +19

    I did everything as done here, and the performance of the network is terrible, even after increasing the number of epochs!

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

      Same problem , have you managed to fix it?

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

      @@volleyball2676 same problem too, have u fixed it?

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

      I’m about to try it. Let you know soon 💪 fashion mnist worked for me

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

      For me the accuracy is pretty high but the loss is high too
      Accuracy = 0.9778
      Loss = 0.7503

  • @danielrocha2521
    @danielrocha2521 9 месяцев назад +2

    Why did we choose to use 128 neurons for our first Dense layer? I have always wondered what is the intuition that should be used for the number of neurons needed for a layer? Is it kinda just random

  • @doktermaiskorn833
    @doktermaiskorn833 3 года назад +9

    great tutorial. how can i increase the accuracy. shoudl I just screw up the epochs. I tried this, but some digits like a angeled one or a 5 that get "recognized" as a 6 or a 3(as example). sorry for my bad english :D

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

    Why did you normalise the train and test data separately. Shouldn’t we first normalise train data and then apply the same normalisation factor to test data?

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

      was thinking same, fit(Xtrain).transform(Xtrain) and fit(Xtrain).transform(Xtest)

  • @UserError-n7n
    @UserError-n7n 6 месяцев назад

    I have this problem at 12:12.
    It keeps giving me an error in tensorflow stating “DLL load failed while importing _pywrap_tf2

  • @abebuenodemesquita8111
    @abebuenodemesquita8111 3 года назад +3

    mine is super innacurate. could you please help?

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

    ‪How would you suggest to go from beginner to expert in ML/AI in practical terms. Assuming theoretical foundations are there‬

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

    I'm very new to this and have a small doubt when training the data we normalized the pixel values to be between 0 and 1, but when we are predicting using jpgs we dont normalize it, why is that?

    • @danielrocha2521
      @danielrocha2521 9 месяцев назад +1

      I think the reason he normalized the pixel values to be between 0 and 1 is because as he said their values range between 0 and 255. Since this is a big range of numbers normalizing the pixel data would be most ideal as it would reduce the impact of spread on our model. However, when predicting the jpgs they only take on a value between 0 - 9 so label data cannot necessarily be as spread out as the pixel data can be, rendering it kinda useless to do so.
      Again this is just my thought process. If some of my logic is incorrect, please don't hesitate to correct me internet.

  • @oingomoingo7411
    @oingomoingo7411 10 месяцев назад +3

    am i the only one whos digits are not recognized ? The mnist data set works fine and gets recognized but my own digits no chance, why ist that ?

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

      Bro just dissed his own handwriting

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

      Go onto Paint and make the canvas 28x28 pixels, then colour everything black, then write on it with white brush/pen. It works for me.

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

    it seems my created model keeps giving wrong output so i increased epochs but same issue, i noticed it looks at a specific pattern and it finds it similar to another it checks to two numbers as the same number. For example, the 3 and 8 gets confused and it gets termed as 3 all the time. i wonder if it needs more training or do i need to change the code somewhere...

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

    Thanks for a flawless video NeuralNine!

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

    hey can anyone help please i am writing this code in jupyter notebook how to import images in jupyter will the process be the same???????

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

    why it's showing invalid file path use either. keras extension for saving. please add either a keras extension for the native keras format

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

      There's a comment by @somith4259 where they write the whole updated code. They did 'handwritten.models.keras' to fix the problem.

    • @BasedArmenian-kh8pb
      @BasedArmenian-kh8pb 4 месяца назад

      Use ".keras" as the extension as it just told you

  • @godofstrangerness7096
    @godofstrangerness7096 10 дней назад

    Love the vid! But I have a slight problem, my 8 and 9 are not getting recognised even with more epochs.

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

    Hi sir , if we give the image in which we give any paragraph so they can detect it
    or not ,for example in image we give A ,so the they detect it or not

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

      if any one have idea about that so tell me

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

    I'm at 14:04 and I'm getting the following error after loading the saved model 'logits and labels must have the same first dimension, got logits shape [32,10] and labels shape [25088]'. Is anyone getting the same error, I've researched it and it apparently has something to do with the loss function being sparse_categorical_crossentropy or categorical_crossentropy?

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

      I found the problem and fixed it. I wrote 'test_y = tf.keras.utils.normalize(test_X, axis=1)
      ' instead of 'test_X = tf.keras.utils.normalize(test_X, axis=1)
      '

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

    I followed the video to the word, frame by frame. I got this "Mistake" before saving the model (before applying to self made numbers). The loss is 2.3, and the accuracy is 0.097. During the training though, all accuracies are over 90. Can anyone tell me what is the problem? Is there anything wrong with the test set? This is a great video. I just want to make it work !!

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

      Same Problem here

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

      import tensorflow as tf
      mnist = tf.keras.datasets.mnist
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
      x_train = tf.keras.utils.normalize(x_train, axis=1)
      x_test = tf.keras.utils.normalize(x_test, axis=1)
      # model = tf.keras.models.Sequential([
      # tf.keras.layers.Flatten(input_shape=(28, 28)),
      # tf.keras.layers.Dense(128, activation='relu'),
      # tf.keras.layers.Dense(128, activation='relu'),
      # tf.keras.layers.Dense(10, activation='softmax')
      # ])
      # model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
      # model.fit(x_train, y_train, epochs=10)
      # model.save('project.keras')
      model = tf.keras.models.load_model('project.keras')
      loss, accuracy = model.evaluate(x_test, y_test)
      print(f'Loss: {loss}')
      print(f'Accuracy: {accuracy}')
      That fixed my problem, you can try it out if you want to

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

    I want a python code to convert handwritten image into plain text with accurate i have tried but i didnt got you can try it and show me..

  • @GiorgioM.
    @GiorgioM. 3 года назад +7

    Hi F, very useful video as always! when you can, could you make a video about voice recognition/transcription in Python like youtube autosubtitle. To eliminate background noises ... what would you do? Thx

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

    I'm unable to evaluate the model, the error says they dont have same array size

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

    but what if I want to know different hxw images????? this only works for 28,28.

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

    How could I train neural networks without a dataset? Like if I would like it to idk play a video game

  • @16thpolicy
    @16thpolicy 2 года назад

    this might be a stupid question but it isn't obvious for me in the code. How is the output layer ordered? what I mean is how does index 0 directly map to value '0', index 1 to '1', etc. I also searched this up for letter recognition and they have 0-25 mapping in order to letters sequentially. maybe someone can explain

  • @MichaZawadzki-ku1dk
    @MichaZawadzki-ku1dk Год назад

    Where did you download your training data and where was it loaded into your program? That is, I don't see any filename loaded...

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

      the training data is part of the tenserflow library itself u dont need to download it additionaly

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

    Hi. Can someone help me to find my mistake. Where i can save the folder of image so that my programs will read directly to that folder. bcoz, it does not read the image number when i run the programs. really appreciate to someone help and enlighten me. tnx.

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

    is there a chance i can run a code that can transform text pdf , images, voices into a model for medical stuff

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

    can u tell the digits directory thing.. u just skipped that part]

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

    In line #8 you are loading data, but you dont specify any files. I dont see were you are creating the actual training data and testing data. All I see is at the end , you creating data to actually use the model. where is the training data?

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

      The initial training data and testing data are supplied by mnist.

  • @captainamerica768
    @captainamerica768 2 месяца назад +1

    what is the application u are using??

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

    how to downlode data set which u used ?

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

    How did you comment the whole section at 12:28?

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

      crtl + /

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

    The recognition sucked when i used my paint pictures. I found that it recognizes it way better when i have white on black images from paint.

    • @BasedArmenian-kh8pb
      @BasedArmenian-kh8pb 4 месяца назад

      The MNIST dataset are literally all black on white pictures so this is why, that is the only thing its trained on

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

      @@BasedArmenian-kh8pb yes but we turned the black on white paint images to white on black. So I was expecting it to work. The owner of the channel used black on white too

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

    Sir imges not display when i run this code

  • @akshatdodhiya
    @akshatdodhiya 3 года назад +1

    Your videos are really amazing!

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

    Hi, anyone knows which theme of PyCharm is this?

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

    lol, that intro music on a topic like this :D

  • @isururasanjana-n2v
    @isururasanjana-n2v Год назад

    shouldn't we normalize the input image pixel values before predicting it

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

      I think the reason he normalized the pixel values to be between 0 and 1 is because as he said their values range between 0 and 255. Since this is a big range of numbers normalizing the pixel data would be most ideal as it would reduce the impact of spread on our model. However, when predicting the jpgs they only take on a value between 0 - 9 so label data cannot necessarily be as spread out as the pixel data can be, rendering it kinda useless to do so.

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

    Why the dense layer with '128' units ?

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

      he just copied the value online, youtuber programmer modus operandi

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

    I followed your code word by word still the result is showing error. Please help me!!

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

    Amazing tutorial man, i'm a complete beginner and this is totally understandable and it's so awesome, i only have a question, what do i do if i want to use larger images, is it possible?

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

      i think you might need image segmentation , you'll find a video about it in this chanel

  • @AliAli-wi2ys
    @AliAli-wi2ys 3 года назад

    i did this 2 years ago with live opencv drawing and detection
    thx a lot

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

    can i do handwritten character recog using this,just by changing the dataset?

  • @a.dennis003
    @a.dennis003 10 месяцев назад

    To enable the following instructions: SSE SSE2 SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. this is the error i had

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

      This is not an error but a statement u can ignore, but if there is no output that probably mean program was not able to get the digits directory so check your path is correct or not, for me it was to include the directory name where the digits directory was stored

  • @Shayankhan-q8f
    @Shayankhan-q8f 7 месяцев назад

    Is it will work for handwritten words or text?

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

    Cool vid man, I want to get started, just curious as to what IDE you are using?

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

    Can you asist me to identify symbols from drawing using CNN. It will be much helpful for my project

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

    kindly explain banking projects or fraud manageent or loan projects

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

    can anyone help me the no module found name tensorflow

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

    keras isn't working. anyone know how to fix

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

    Why did we make the hidden layers 128 neurons? This is the part no one explains in tutorials

    • @BasedArmenian-kh8pb
      @BasedArmenian-kh8pb 4 месяца назад

      No reason, it is default/standard and in various circumstances it could even cause minor problems changing it

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

    AttributeError: module 'keras.api._v2.keras.models' has no attribute 'load'

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

    i am not able to load tensor flow

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

    really helped me a lot.
    Thank you so much😄😄

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

    For me it's not printing anything why?

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

    HI nice video ! Do you know how to analyse images that are bigger than 28x28px ?? Thanks ;)

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

      im not fully sure about this but you can try changing the numbers in the "model.add(tf.keras.layers.Flatten(input_shape = (28,28)))" so change it to be like "model.add(tf.keras.layers.Flatten(input_shape = (32,32)))"

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

    Can we use raspberry pie with touch screen for input

  • @giannhsp222
    @giannhsp222 3 года назад +1

    OMG.. I was in full screen mode and on 7:45 I thought someone hacked my computer! haha! It was scary!

  • @Dr.Fitsum_Teshome
    @Dr.Fitsum_Teshome 2 года назад

    Hi buddy, thank you for your useful videos. However, I am getting this error "NameError: name "keras" is not defined when I try to classify the datasets into training and test datasets. How can I solve this error, please?

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

    Can you make this same video with alphabet instead of number ? Pretty pls

  • @aarushkumar168
    @aarushkumar168 3 года назад +1

    Please can you make a video on automating social media with python?

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

      he just uses others tools to make stuff that he doenst really understand. so dont expect much from him

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

    Anyone know what program he's coding this in?

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

    Hey, thank you so much for this video.

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

    Please make video Multi Layer Perceptron How To build With Manual Coding without tensorflow

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

    is this only works 28,28 ????

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

    cant download tensorflow

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

    Hey there is some problem in load_model() i cannot use predict or evaluate if i get my model from load_model() function

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

    predict function in line 31 isnt defined according to vscode, error message is " "predict" is not a know member of "None" ". help me

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

    errors come up for every piece of code you write. I am unsure what wizardry you're doing to get it to work on your end. it always fails on mine and it pisses me off.

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

      he doesnt really understand neural networks too, just using tensorflow, there are far better videos on the subject, just look around , these "programmer" youtubers really are the bad side of the platform, they gain massive viewers and they are junior at best.

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

    Great!👍 More videos like this ❤️

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

    Helpful video , thank you ;)

  • @Martin-iy8gd
    @Martin-iy8gd 2 года назад +1

    Hi friend ! Nice video. Could you help me in making Handwritten Digits Recognition but using HMM?

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

    Awesome bro!

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

    You are awesome broo🔥🔥🔥🔥

  • @namo2943
    @namo2943 3 года назад +1

    Early, and love the video!

  • @Erik-fg9fk
    @Erik-fg9fk Год назад

    which ide is this?

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

    Will u plzz provide source code for this ?

  • @محمدامین-س3ف
    @محمدامین-س3ف Год назад

    thank you very much , bro .

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

    Can anyone share the source code ?

  • @s.aravindh6227
    @s.aravindh6227 3 года назад

    Nice video bro 👍👍👍👍👍

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

    It is really helpful and all. Thank you. For me, there could be more illustration of what happens to our data after what command line. Often you just guess it, but you can not be sure, especially when you are not using standard python methods, as you just see the output. Like with neural networks itself. :)

    • @НикитаБаронов-с6н
      @НикитаБаронов-с6н 2 года назад

      why does the neural network immediately correctly determine the numbers without any training?

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

      @@НикитаБаронов-с6н It was trained for 3 epochs with a standard dataset

  • @AJain-18
    @AJain-18 3 года назад +1

    Nice video !!!

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

    can you u upload the source code

  • @karthikeyan.s557
    @karthikeyan.s557 3 года назад

    Awesome bro

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

    my AI thinks 3 is a 6. :(

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

    unbeliavable, no one before me not comment is this only works for 28,28. really unbeliavable. do you really understand what he mentioned ? I think you do not.

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

    thank you!

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

    Awesome!!! Thanks

  • @abhinavchoudhary6849
    @abhinavchoudhary6849 3 года назад +1

    Nice video

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

    you don't explain stuff, you just keep adding layers and optimizers and metrics without explainin what any of those are or what they do. bad stuff.

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

      he doesnt know the "stuff" too, he just wants to crap out a video so he gains money, youtuber programmer, what you expect, its a cancer on the platform. but there are many good youtubers that know neural networks, search for these and really learn it!

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

      @@javali1678 which one please

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

    Amazing!

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

    Thanku so much bro

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

    You really helped me a lot. Thank you so much🤩