Loading in your own data - Deep Learning basics with Python, TensorFlow and Keras p.2

Поделиться
HTML-код
  • Опубликовано: 22 май 2024
  • Welcome to a tutorial where we'll be discussing how to load in our own outside datasets, which comes with all sorts of challenges!
    First, we need a dataset. Let's grab the Dogs vs Cats dataset from Microsoft: www.microsoft.com/en-us/downl...
    Text tutorials and sample code: pythonprogramming.net/loading...
    Discord: / discord
    Support the content: pythonprogramming.net/support...
    Twitter: / sentdex
    Facebook: / pythonprogramming.net
    Twitch: / sentdex
    G+: plus.google.com/+sentdex

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

  • @uditsingh9576
    @uditsingh9576 5 лет назад +26

    Just wow , didn't wanted to watch the whole video , but your are a magnet !! Excellent style of teaching

  • @Xaminn
    @Xaminn 5 лет назад +6

    Another amazing set of tutorials. You truly are helping me understand Python and Deep Learning at a whole different level. Thank you for your time and expertise, Sentdex.

  • @AnimilesYT
    @AnimilesYT 4 года назад +20

    5:04 I don't know why, but the way you casually said "ha, bluedog", and then continue on, was hilarious to me xD

  • @ssagonline
    @ssagonline 4 года назад

    Works like a charm. For those(beginners like me) who had issue in layers like "kernel size not defined". Just replace "(3,3 ) by kernel_size=3 " in layer 1 and 2 and it will be good to go.

  • @bartoszturkowyd3608
    @bartoszturkowyd3608 5 лет назад +21

    I love the way how you personified the NN. The part with shuffling makes me laugh!

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

      I keep Getting:
      error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
      What does it mean, could not find anything on the web, help!

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

      Here's a course you'll need.
      Face Mask Detection Using Deep Learning . It's paid but it's worth it.
      khadymschool.thinkific.com/courses/data-science-hands-on-covid-19-face-mask-detection-cnn-open-cv

  • @mockingbird3809
    @mockingbird3809 5 лет назад +390

    These were videos that I requested. Please make more Project videos in Machine learning and deep learning videos and real-world machine learning projects in PYTHON because You Are The Best to learn from

    • @MSFTSTRIO
      @MSFTSTRIO 5 лет назад +29

      This is so true. I've been so frustrated trying to learn this topic and a lot of videos are just people explaining what neural networks are, like the begging of the previous video in this series, but nobody actually gets into the code and explains how to set up functions. Like there is A HUGE DIFFERENCE BETWEEN DRAWING A NEURAL NETWORK AND ACTUALLY CODING ONE!!! ANYONE CAN DRAW ONE

    • @kaushilkundalia2197
      @kaushilkundalia2197 5 лет назад +3

      So true ! Make more such project videos. They prove to be of great help.

    • @a.n.7338
      @a.n.7338 4 года назад

      Can someone tell me what X=[] and Y=[] is used for?

    • @anwayeerc
      @anwayeerc 4 года назад

      @@a.n.7338 Yes I do want to know

    • @bennri
      @bennri 4 года назад

      @@a.n.7338 That's to initialize it to an empty array. But at 15:30, he learned that it did not initialize the type. and that's something I especially like about his videos: he doesn't just edit out the mistakes, any talks about things like the need to reshape being kind of stupid.

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

    Thank you so much for this video. As a programmer who just wants to start prototyping a simple model without a great DL background this video gave me the tools to get on with my work.

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

    i started my python journey with you back in the university days, thanks for being there boss.

  • @quanghuyngo7556
    @quanghuyngo7556 5 лет назад +7

    Hi Harrison.
    You've been doing an absolutely amazing list of implementating Deep learning videos with Python, Tensorflow, Keras, etc.
    This is the most useful job you've ever done. I've learned the Machine learning, Deep learning theory easily but implementation and application is something difficult to me. Keep doing this please.

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

      Here's a course you'll need.
      Face Mask Detection Using Deep Learning . It's paid but it's worth it.
      khadymschool.thinkific.com/courses/data-science-hands-on-covid-19-face-mask-detection-cnn-open-cv

  • @robertaradi9994
    @robertaradi9994 5 лет назад +8

    This series is so thorough and easy to understand (for me at least :D)!
    I can't wait for the next part!

    • @sentdex
      @sentdex  5 лет назад +2

      Great to hear!

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

    THANK YOU SO MUCH!!! I just started with Machine Learning and Neural Networks and this video helped me a lot!!!

  • @trivukhac2965
    @trivukhac2965 5 лет назад +1

    I like the teaching style, it's simple to understand

  • @minjaewoo5243
    @minjaewoo5243 5 лет назад

    This is currently the best TensorFlow tutorial on youtube. Can't express how thankful I am, after wasting much time on crappy videos named TensorFlow in 10 mins, 5 mins, 1 min and etc...

  • @PraYogiz
    @PraYogiz 5 лет назад +1

    i enjoyed this so much, i was from CS degree. But not have quite good moment with programming. So i decided to get job that not programming. But, since i was try to learn about pyautogui and selenium from your video, i was so exited to learn ML, and now here am i ... following your keras tutorial :D

  • @rosasgallery
    @rosasgallery 18 дней назад

    You actually saved my life!!! Thank you so much for this amazing tutorial.

  • @RickertBrandsen
    @RickertBrandsen 5 лет назад +1

    These vids always cheer me up :) You are by far my most favourite instructor. :) When I feel depressed i just watch your videos.

    • @sentdex
      @sentdex  5 лет назад

      Nice to hear :)

  • @r00t_sh3ll
    @r00t_sh3ll 5 лет назад +19

    amazing videos, great AI tutorials, honestly one of the best programming channels on RUclips. thank you for making these videos

    • @PandoraMakesGames
      @PandoraMakesGames 5 лет назад +3

      Yeah, I also really enjoy his videos. He inspires me to make my own AI videos.

  • @FatihKarakuzu
    @FatihKarakuzu 5 лет назад

    Heay sentdex pls keep up with your videos. They are really helpful in so many ways. Im just starting to get into ML and started studying Computer-Science just because of ML and your videos are so helpful. Thumbs up to you

  • @Taha-jj1kr
    @Taha-jj1kr 5 лет назад +136

    A nice alternative to pickle is
    np.save('features.npy',X) #saving
    X=np.load('features.npy')#loading

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

    You are very good in teaching and the world need you, Sir.

  • @GilLianni
    @GilLianni 5 лет назад +88

    Epic moment: "haa, blue dog" @ 5:05

  • @jamesriri1810
    @jamesriri1810 4 года назад

    Sentdex these are the best videos I have ever seen in Deep Learning. Amazing tutorials. You are the best at what you do. Why did it take me long to find this channel.

    • @sentdex
      @sentdex  4 года назад +1

      Welcome here :D

    • @jamesriri1810
      @jamesriri1810 4 года назад

      @@sentdex can I have your email if you don't mind?

    • @jamesriri1810
      @jamesriri1810 4 года назад

      @@sentdex Hello. I got stuck when instructing my directory on the file.
      Kindly advise. Thank you.

  • @atharvapagare7188
    @atharvapagare7188 5 лет назад +1

    Amazing video man... Looking forward to the next one

  • @janbiel900
    @janbiel900 5 лет назад +1

    The value of these videos is fucking incredible. After some setup with anaconda to get tensorflow and python 3.6 to work in pycharm, i was able to reproduce all of this with my own data. Your explanations are absolutely on point and i have no questions left after this part.

    • @sentdex
      @sentdex  5 лет назад +1

      Thanks, that's awesome to hear!

  • @rubenuribe
    @rubenuribe 4 года назад +1

    this video is amazing, I am so glad I found your channel. I have tried learning this stuff for quite a while now through other RUclips videos but nobody could explain it that well.

  • @kaushik5014
    @kaushik5014 5 лет назад +3

    Thanks @sentdex, just what I was looking for :)

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

    This was the most helpful video I've found. thank you!

  • @benjii0stylz
    @benjii0stylz 5 лет назад +24

    11:54 that's a great imitation of a model trying to learn ^^

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

      Here's a course you'll need.
      Face Mask Detection Using Deep Learning . It's paid but it's worth it.
      khadymschool.thinkific.com/courses/data-science-hands-on-covid-19-face-mask-detection-cnn-open-cv

  • @engr.inigoe.silvagalvan1161
    @engr.inigoe.silvagalvan1161 Год назад

    Brother, you're amazing. This video has been a huge help. Thanks.

  • @kiwallls6864
    @kiwallls6864 5 лет назад

    Thanks you! Awesome video. Looking forward to the next one 👍👍👍

  • @liamfmackle
    @liamfmackle 5 лет назад +17

    6:50 "the hand of a dog" - it is called a paw! hahaha

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

    Great video, looking forward to see the next one.

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

    For those who want to use RGB/color images, modify these lines!
    Change these:
    img_array = cv2.imread(os.path.join(path,img) ,cv2.IMREAD_GRAYSCALE)
    plt.imshow(img_array, cmap='gray')
    X = np.array(X).reshape(-1, IMG_SIZE, IMG_SIZE, 1)
    To:
    img_array = cv2.imread(os.path.join(path,img))
    plt.imshow(img_array)
    X = np.array(X).reshape(-1, IMG_SIZE, IMG_SIZE, 3)
    And this should work, good luck!

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

    So far, so good! The first dog grayscale image was successfully displayed. I was getting nervous there for a minute! I got confused when you added all that space at the bottom. It threw off my Jupyter notebook. I followed you thereafter, but my output did not print. We'll on to the other videos from other channels. I got to keep moving on. It was good while it lasted.

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

    Exactly the video I needed! Thx bro!

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

    Thanks alot for the videos! Great way to start my Data Science Journey. Really grateful to you for posting such content for free.

    • @sentdex
      @sentdex  11 месяцев назад +1

      Thank you for the super thanks, best wishes to you on your programming journey!

  • @malikadabare3719
    @malikadabare3719 5 лет назад +2

    one of the best programming channels on RUclips. Subscribed and hit the bell ; )

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

    Thanks Snowden, nice tutorial.

  • @cemlynwaters5457
    @cemlynwaters5457 5 лет назад

    Sir your videos are epic! You are an excellent teacher

  • @marcosvolpato8135
    @marcosvolpato8135 5 лет назад

    Cant wait to the next video!! congratulations!!

  • @GelsYT
    @GelsYT 4 года назад

    This video was 2 years ago! Hey sentdex! THANKS :D

  • @GJ-bq9hd
    @GJ-bq9hd 5 лет назад +1

    Really interesting and objective explanation of the topic! lol'd hard bc of the sudden blue dog

  • @Huguillon
    @Huguillon 5 лет назад +22

    1:52 I was taking it serious till the mug appears

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

    I like your way of teaching.

  • @seth8141
    @seth8141 5 лет назад +9

    What is your opinion on setting an aspect ratio and adding padding during resizing? I just feel like forcing an n x n dimension distorts images too much when we have the varied original resolutions.

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

    Guys, the kaggle dataset that he is referring to no longer has folders named as cats and dogs... there are 2 folders, one is for training and another one is for test. You've gotta loop through images in the training folder and assign the labels using the image name

  • @deepakathirvel8023
    @deepakathirvel8023 4 года назад +1

    It was really a very useful video...Thaaank u very much for ur timely help

  • @honzaadamek5186
    @honzaadamek5186 5 лет назад +1

    Great tutorial. Looking forwart to next part!

    • @sentdex
      @sentdex  5 лет назад +1

      Expect it tomorrow!

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

    Thank you so much this video helped out so much with an up coming video of mine

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

    "the hand of a dog", so wise sentdex. forever indebted

  • @kresimirmarkota7674
    @kresimirmarkota7674 5 лет назад

    Man , you are the best !! Keep up doing like this !! :D

  • @fun-ih5sc
    @fun-ih5sc 4 года назад

    seriously you teaches better than my professors
    Thanks for teaching us. :)

  • @DemonSlayer627
    @DemonSlayer627 5 лет назад

    If your using keras you should use the flow_from_directory function ,it's really the same thing without the hassle of running out of memory trying to load the entire dataset.

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

    Hey Sentdex like always awesome tut but one suggestion: Can you mention your library versions you're using at the beginning? I had version compatibility issues which I realized really late and I had to reinstall everything and make sure I also got the correct python version

  • @suleimanmustafa1473
    @suleimanmustafa1473 5 лет назад

    Thanks have been looking forward to this tutorial will help with my thesis.
    For windows, if you have anaconda installed and cannot find module cv2, you may simply have to do:
    pip install opencv-python
    if you are on linux you can do :
    pip install opencv-python

    • @randytucker3083
      @randytucker3083 5 лет назад

      If you are having trouble here use anaconda prompt. This is in the Anaconda Manager where you start jupyter. Then simply type in pip install opencv-python and mine at least worked great

    • @MrSpaceboyy
      @MrSpaceboyy 5 лет назад

      opencv-python is installed, but it cannot find the module cv2

  • @elijahturatsinze1576
    @elijahturatsinze1576 4 года назад

    That's an informative video. thank you so much

  • @shanerooney7288
    @shanerooney7288 5 лет назад

    *sentdex* and *DeepLizard* have both been _VERY_ helpful with teaching me how to program.
    Thanks.

  • @stefanod.3069
    @stefanod.3069 3 года назад

    holy shit these videos have helped me, thank you so much dude!

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

    I've been looking for ways to upload 40k images to my Drive for 3 days. You in one word: you are perfect

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

      you can download google drive on ur machine and sync it with your drive

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

    Sentdex: understands neural nets
    Also Sentdex: doesn't know what to call a dogs paw

  • @huashi8893
    @huashi8893 4 года назад

    Very detailed and helpful and cute. Thank you

  • @ygarabawala
    @ygarabawala 5 лет назад

    Waiting for the next video...thanx man you are an amazing teacher

    • @sentdex
      @sentdex  5 лет назад

      Next one just released :)

    • @ygarabawala
      @ygarabawala 5 лет назад

      Amazing! going through it now

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

    This helps me a lot.

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

    Excellent work

  • @Irfankhan-jt9ug
    @Irfankhan-jt9ug 3 года назад

    Thanks for the awesome tutorials. How do you perform image augmentation in this? You sir are a great man

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

    Great Video !!

  • @garrettsolarsystem2585
    @garrettsolarsystem2585 4 года назад +5

    Great tutorial! However, I got a question. What if you have an image in multiple categories. So you could be sorting images based on size and colour and you stumble on an image that is red and big.

  • @monkeysaregreat
    @monkeysaregreat 5 лет назад +5

    I suggest using context managers for file opening. Cleaner and is better for beginners as you don't have to remember to close the file

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

    Oh thank you! I've looking for the way to load my own dataset and here you go! :З

  • @deadfish404
    @deadfish404 5 лет назад

    Awesome video.. Waiting for more uploads...

  • @lemyul
    @lemyul 4 года назад

    finally, I got through this video without any error

  • @neatpolygons8500
    @neatpolygons8500 5 лет назад +7

    10:22 what kinda cpu you have that could iterate over all of those images in few seconds :D

  • @wolfisraging
    @wolfisraging 5 лет назад

    I am loving it I am loving it, that's what I want

  • @OO-ie1pe
    @OO-ie1pe 5 лет назад

    thanks for showing how to save the weights for future training. also, how did your self driving program from GTA turn out?

  • @niclaswustenbecker8902
    @niclaswustenbecker8902 5 лет назад +119

    Great tutorial, but the way you load the data is not very memory efficient and this will cause problems with large datasets. First the training_data list is written into RAM and afterwards the same amount of memory is reserved when converting into a numpy array. So this approach is only good for datasets < RAM size/2.
    Another option would be to create the numpy array at the beginning using np.empty and then write the data as entries into the array. This way the dataset can be as large as your RAM.
    If the dataset is larger than the RAM size it is suggested to use a generator that loads and yields the data during training. This way your dataset can be as large as your SSD, but training speed is most likely limited by the read speed of the drive.
    Just something I had to deal with during my thesis in the last couple of months. Maybe you could make a tutorial on the generator one, not a lot of people know about this.
    Anyways, keep up the good work!

    • @will1337
      @will1337 5 лет назад

      This looks very interesting and I'm experiencing some errors with this as well on my thesis. Can I contact you via email about this?

    • @niclaswustenbecker8902
      @niclaswustenbecker8902 5 лет назад

      Sure, can you contact me via youtube? Or post you email and I will contact you

    • @liveleaky7571
      @liveleaky7571 5 лет назад +8

      @@will1337 delete the comment with your email

    • @stewie055
      @stewie055 5 лет назад

      ​@@will1337 Did you fixed your problem? my python returns "MemoryError" when doing np.array(X).reshape(-1 , IMG_SIZE, IMG_SIZE, 3) step
      I'm doing the colored version (so I have about 3 channels of colors which is causing me trouble)

    • @will1337
      @will1337 5 лет назад

      @@stewie055 I did fix it with changing my sampling rate of my data. Maybe resize your images? I am not sure how to fix it with image data, sorry.

  • @tommyhuang6698
    @tommyhuang6698 5 лет назад

    so good and so clear

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

    I found for the Y labels you have to make it a numpy array if not the model will not take them. Other than that this is an amazing tutorial

  • @namanbansal7277
    @namanbansal7277 4 года назад

    Thank you so much SentDex

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

    the plylist is amazing, however i came across this issues after running part 2 and part 3 back to back..
    the y also needs to be an array, so the model.fit in part 3 can run...
    thank you once more :)

  • @aalissaa84
    @aalissaa84 5 лет назад +1

    Great tutorial as always im in love with this channel i learn a lot, i'm trying to build OCR to identify a low resolution documents , do you recommended any source to help me out on this , and i wish some day you create a vedio about this ..Regards

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

    Thanks. On Windows, I had problems with your DATADIR="X:/Datasets/PetImages" @2:10. I had my own version of course, but the code said (in effect) my path was not valid, even tho it was. I discovered Colab runs Linux-style OS. There are several methods of doing it; I used the Google Drive mount and zipfile to extract (instead of the Windows File Explorer Extract), ending with DATADIR=''/content/drive/MyDrive/datasets/training_set'. I finally got to see the gray dogs!

  • @mgrotheer
    @mgrotheer 5 лет назад

    I'm not sure which ends up being better....the videos or the random (read: dope) coffee mugs you keep pulling out in them ;)

  • @Wrathofgod220
    @Wrathofgod220 5 лет назад

    Do you have any resources/videos going into detail the os library? Thanks. your vids are awesome!

  • @rezahosseini7851
    @rezahosseini7851 5 лет назад +1

    I did convert my x to a no.array without reshaping it as you did and I got the exact same shape as you did! So I guess you no longer need to reshape it to (-1,50,50,1). plz tell me if I've done something wrong

  • @reinaldo_agostinho
    @reinaldo_agostinho 4 года назад

    awesome tutorial

  • @danielcox8306
    @danielcox8306 5 лет назад +2

    The first video was great, looking forward to watching this one through as well. Can make a video about using CPU vs GPU for some of these training processes? I would like to learn more about forcing the script to use the GPU for running instead of the CPU. For instance some of your older videos (like the Monte Carlo Simulation series) could benefit from this. Thanks!

    • @sentdex
      @sentdex  5 лет назад +2

      To use the GPU, you just install the GPU version of TensorFlow. Depending on your OS this is slightly different, but:
      Windows: ruclips.net/video/r7-WPbx8VuY/видео.html
      Ubuntu: ruclips.net/video/io6Ajf5XkaM/видео.html
      Obviously now you do the later version of TF and the correct matching CuDNN and cuda toolkit. Currently Cuda Toolkit 9.0 and CuDNN 7.0.

  • @dannywithnuggets
    @dannywithnuggets 5 лет назад

    Great tutorial. What would be the method of saving the collected data to put on a USB? Just a text file?

  • @aliakbarpamz
    @aliakbarpamz 5 лет назад

    Super nice tutorial...

  • @manjeetsingh-fr5zd
    @manjeetsingh-fr5zd 4 года назад

    you are simply amazing

  • @tylerk3130
    @tylerk3130 5 лет назад

    Great tutorial as always. Very easy to listen to and follow. I was wondering, are you planning to cover things like TFRecords for handling very large datasets sometime in the future? There are other tutorials, but I think the topic would really benefit from your style.

    • @sentdex
      @sentdex  5 лет назад +1

      Yep I'd like to. Might wait for TF 2.0 tho

    • @tylerk3130
      @tylerk3130 5 лет назад

      Makes sense. I saw they were prioritizing usability, so hopefully it's more straightforward soon. Unfortunately my project is due in 2 weeks, so a little late to avoid wading through 1.10 docs trying not to cry :P.

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

    Thanks a lott🙏🏽🙏🏽 u just saved me

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

    you saved me, thank you

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

    Great video! How could I modify this to use multiple categories for classification instead of just single category label?

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

    Well done video

  • @mohmedhussein7470
    @mohmedhussein7470 5 лет назад

    Great tutorial, but if the images with multi label ,that way is same to load the data with binary classification or multi label classification

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

    Hi, great work!
    I have a question, though, upon the "homework challenge" !
    reshape(-1, IMG_SIZE, IMG_SIZE, 3) pops a ValueError: cannot reshape array of size 239640576 into shape (224,244,3).
    What's your opinion and solution ??
    Thank you

  • @shathabahassan534
    @shathabahassan534 4 года назад

    Thank you so much 💙

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

    Love getting tought ML by Snowden!

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

    Hi Sir,
    I found you posted X, y empty lists to store the features and labels. However, I have no idea how you distinguish the corrected features and labels from training datasets. Please kindly advise me. Thanks in advance!

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

    How to load the image data set from my computer and split into two data set for training and testing?