Image Preparation for Convolutional Neural Networks with TensorFlow's Keras API

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 113

  • @deeplizard
    @deeplizard  4 ปีที่แล้ว +4

    👉 Check out the blog post and other resources for this video:
    🔗 deeplizard.com/learn/video/LhEMXbjGV_4
    👀 Come say hey to us on OUR VLOG:
    🔗 th-cam.com/users/deeplizardvlog

  • @srujanvajram9430
    @srujanvajram9430 4 ปีที่แล้ว +9

    Ina addition to watching your videos, I visited your website. Your ability to explain Deep Learning fundamentals (both here and in your comprehensive website courses) without shying away from confounding details, is a strong reflection of your immense talent and domain expertise. It's rare.
    You've earned a supporter. I'm excited to watch this channel grow into something big which I know it will. Keep it up!

    • @deeplizard
      @deeplizard  4 ปีที่แล้ว +4

      Thank you, Srujan!

  • @mohammedkassab3110
    @mohammedkassab3110 3 ปีที่แล้ว

    One of the best keras dataset preprocessing videos on youtube. I fully watched this, thank you

  • @linknero1
    @linknero1 4 ปีที่แล้ว +6

    thank you, I really regret not knowing about this channel before, I had some difficulties on my university because it was hard to get the information, really thank you :D

  • @rashmikuchhal5339
    @rashmikuchhal5339 4 ปีที่แล้ว +1

    best video for image data processing. Many many thanks for you efforts.

  • @igor-policee
    @igor-policee 3 ปีที่แล้ว +1

    I've been looking for your channel for a long time, thanks for the work!

  • @suyashrahatekar4964
    @suyashrahatekar4964 8 หลายเดือนก่อน +1

    Thank you very much for this teacher ❤

  • @jedidiaholadele2086
    @jedidiaholadele2086 2 ปีที่แล้ว +1

    Thanks Mandy!!

  • @samanehshamshiri1385
    @samanehshamshiri1385 3 ปีที่แล้ว +1

    your tutorial was very useful and helpful for me, thank you very much

  • @tymothylim6550
    @tymothylim6550 3 ปีที่แล้ว +1

    Thank you very much for this video! It's an excellent video with very beginner-friendly handles on how to get started with CNN models!

  • @syedrehman5755
    @syedrehman5755 3 ปีที่แล้ว +1

    thanks for such great and easiest way to learn preprocessing

  • @Sikuq
    @Sikuq 4 ปีที่แล้ว +2

    Great video. Runs perfectly in my VSCode. Thanks.

  • @anthonychung2907
    @anthonychung2907 3 ปีที่แล้ว +2

    Neural Network is amazing ...

  • @Sikuq
    @Sikuq 4 ปีที่แล้ว

    Second time I'm going through this topic and learning more about the os.listdir functions. Great Video. Thanks.

  • @sarthaksharma9322
    @sarthaksharma9322 3 ปีที่แล้ว

    You are just amazing! Exploring and Explaining every single little detail is extremely awesome and helpful, Thankyou!

  • @verdh100
    @verdh100 4 ปีที่แล้ว +3

    Awesome tutorials. These tutorials have really helped me in my path towards learning machine learning. Great stuff 👍

  • @sukanyaiyer8776
    @sukanyaiyer8776 4 ปีที่แล้ว +2

    I love thank you I've been waiting for this.

  • @Mzah14
    @Mzah14 4 ปีที่แล้ว +4

    The pre processing is always the most annoying part
    Thanks for the clear explanation

  • @dtjiangutube
    @dtjiangutube 3 ปีที่แล้ว

    good stuff! amazing clarity! Hi, professor!

  • @RAY-fk3tv
    @RAY-fk3tv 4 ปีที่แล้ว +3

    Hi, awesome explanation. Hope this series covers the deployment part too.

  • @troyegilbert9971
    @troyegilbert9971 4 ปีที่แล้ว +1

    Awesome explanation and great content.

  • @miguelalba2106
    @miguelalba2106 4 ปีที่แล้ว +3

    This is something that you do only for toy datasets or small sample sets. In the reality using image data generator is not recommended when you have huge volumes of images or video frames (which is usually the case). In those cases is a good practice to load and split the data across multiple tfrecords, then loading it progressively with tf.data and perform multithreaded augmentations dynamically during training. The majority of the augmentations can be computed using low level tf or common python functions.

    • @miguelalba2106
      @miguelalba2106 4 ปีที่แล้ว

      Mher Arabian you can see tf.data documentation for more concrete examples. In general try to manage everything related to input pipelines with tf.data www.tensorflow.org/guide/data

    • @pablopepo1667
      @pablopepo1667 5 หลายเดือนก่อน

      BUenas tardes Miguel. Me dirías donde puedo ver ejemplos de lo que comentás?. Muchas gracias

  • @quamar0313
    @quamar0313 3 ปีที่แล้ว +1

    Nice explanation
    thanks

  • @databridgeconsultants9163
    @databridgeconsultants9163 4 ปีที่แล้ว +6

    Thank You Mandy for the hard work . I regularly visit you website and I can say you are have one of the best ways to make things simpler for NN.
    Can I request you something in RNN/LSTM/ NLP space? Something of this kind of series . I would be grateful to you .

  • @humayonkhan2134
    @humayonkhan2134 4 ปีที่แล้ว +2

    gj..you are making deep learning easy..

  • @raoashwi
    @raoashwi 2 ปีที่แล้ว +1

    I am getting this error module 'tensorflow' has no attribute 'preprocessing_function'. It will be great if anyone could help with this.

  • @starstenaal527
    @starstenaal527 3 ปีที่แล้ว +5

    7:56 Im going to make these into a desktop wallpaper that changes to a different cat image 10 times per second.

  • @gokukrishh
    @gokukrishh 4 ปีที่แล้ว +2

    Hey great work,you made it very simple to understand.If possible,can you please make a video on face recognition using cnn it would be very helpful.

  • @paradona320
    @paradona320 4 ปีที่แล้ว +1

    This is awesome.

  • @hoapham7389
    @hoapham7389 3 ปีที่แล้ว +1

    subscribed to your patreon!!!!

  • @adiai6083
    @adiai6083 2 ปีที่แล้ว

    Very nice explanation 👌👌.make videos on opencv and object tracking and detection

  • @abdul-latifgbadamoshie5602
    @abdul-latifgbadamoshie5602 4 ปีที่แล้ว +3

    Thank you for the video. Where does should the jupyter notebook lie relative to the data folder? I am able to create the train, val, and test directories but can't seem to get the images moved to them. Any help would be appreciated. Thanks!

    • @deeplizard
      @deeplizard  4 ปีที่แล้ว +1

      Choose a directory. Within that directory, place your Jupyter notebook. Within the same directory, place the train, val, and test directories.

    • @umairmalik6480
      @umairmalik6480 4 ปีที่แล้ว

      @@deeplizard i was stick in this problem from the last 4 hours then i read this comment and done
      Thankyou :)
      you are the real gal gadot ;)

  • @gourabsarker5491
    @gourabsarker5491 4 ปีที่แล้ว +2

    I am getting this ,"ValueError: Sample larger than population or is negative" when running the second cell. Means, the change directory cell.

    • @Faisalamin01
      @Faisalamin01 3 ปีที่แล้ว

      same here idk what could be the problem

    • @Faisalamin01
      @Faisalamin01 3 ปีที่แล้ว +3

      okay so the fix is that you have to put all the images into the 'dogs-vs-cats' dir but not the 'Train' dir

    • @kgnightcry8118
      @kgnightcry8118 ปีที่แล้ว +1

      @@Faisalamin01 yeah i realized after lol

  • @marccasals6366
    @marccasals6366 3 ปีที่แล้ว

    If you have an image preprocessing problem, like super resolution. How would you do the image generator part????

  • @benedictjn192
    @benedictjn192 4 ปีที่แล้ว +1

    When we are randomly picking 500 dogs for train and 100 dogs for test and 50 dogs for validation, there is a possiblity that same image may be picked up(may be in all three cases).

    • @deeplizard
      @deeplizard  4 ปีที่แล้ว +2

      The move function we use actually moves the files to a new location, not just copies them. Therefore, there is no overlap or duplication between the three sets.

    • @Sikuq
      @Sikuq 4 ปีที่แล้ว

      deeplizard Excellent point and a good question asked.

  • @myclassical258
    @myclassical258 2 ปีที่แล้ว +1

    wow!

  • @BPSC_ESSAY_SPECIAL
    @BPSC_ESSAY_SPECIAL 4 ปีที่แล้ว +11

    can you make something on OpenCV ...that will be great help.

  • @manojrajsr6001
    @manojrajsr6001 4 ปีที่แล้ว +2

    There are no images in the train, valid and test files after running all the for loops...., and when I run the train_batch, valid_batch, test_batch cell, the output was all 0 images found under the 2 classes.
    Help me out with this error.

    • @saloniagarwal4646
      @saloniagarwal4646 4 ปีที่แล้ว

      Change the directory to C: drive

    • @manojrajsr6001
      @manojrajsr6001 4 ปีที่แล้ว

      @@saloniagarwal4646 it's already in c drive only, I'm sure. There should be something else....

  • @rsnadata7099
    @rsnadata7099 2 ปีที่แล้ว

    Can't we pass other features along with directory and classes in the generator to train our model?

  • @datascience_with_yetty
    @datascience_with_yetty 4 ปีที่แล้ว +2

    Great tutorial, May I ask why you used one-hot encoding? We could have used 0 for cat, 1 for dog for instance right?

    • @deeplizard
      @deeplizard  4 ปีที่แล้ว +1

      Hey Sanni - Yes you're right, we could use either type of label. Just a matter of arbitrary choice for this example since we would get the same results either way. If we use integer labels, we need to use sparse categorical crossentropy loss. If we use one-hot labels, we need to use categorical crossentropy loss.

    • @akshadjha5125
      @akshadjha5125 4 ปีที่แล้ว +1

      @@deeplizard Hi I have followed the code in this video and it get executed without error and the respective folders of test, valid, train are created in the directory but they don't contain the images. Could jus tell what's cozing that error?

  • @rohtashbeniwal9202
    @rohtashbeniwal9202 4 ปีที่แล้ว +1

    I want to fine-tune vgg-16 model for age detection which is a regression modal. how can I use this image date generator function for regression model (u used for classes classification )

  • @md.nazrulislamsiddique7492
    @md.nazrulislamsiddique7492 ปีที่แล้ว

    Hi. Thanks for this amazing video. I am getting some errors while compiling line PlotImages(imgs). The error shows "invalid shape (3,224,224) for image data".

  • @v-sig2389
    @v-sig2389 4 ปีที่แล้ว +2

    Ok, so far i learned that we have a dog directory, and a cat directory ...
    Cool vid, thank you !

  • @amritbhattarai5083
    @amritbhattarai5083 3 ปีที่แล้ว +1

    After deleting the csv files with labels, how did the training batches with preprocessing function recognize the cats and dogs images by using classes=[ 'cat' , 'dog' ] 11:30 ? How did the model know which is which and then correctly label at 14:20 ? Can anyone help me understand? Im super confused.

    • @deeplizard
      @deeplizard  3 ปีที่แล้ว +1

      flow_from_directory() understands labels based on the names of the directories for which the images are stored.

    • @amritbhattarai5083
      @amritbhattarai5083 3 ปีที่แล้ว

      @@deeplizard Great! Thanks for the clarification.

  • @marthasamuel
    @marthasamuel 3 ปีที่แล้ว

    if our image dataset was gray, can we specify (224, 224,3) instead?

  • @lukokimpova26
    @lukokimpova26 3 ปีที่แล้ว

    Hello Mandy, I would like to thank you first for the awesome work you have done; your tutorials have really been helpful to me, from data augmentation to image preparation. However, I am encountering some problems whereby I have been getting this "Found 0 images belonging to 2 classes". Albeit, I place the directory in jupyter notebook as you have advised, I still am getting the same result. I am utilising my own data which I augmented and the original data I place then into the validation folder. I beseech you, would you advise me to what to do to overcome this problem? I would like to hear from you very soon.

    • @deeplizard
      @deeplizard  3 ปีที่แล้ว +1

      The way you specify your paths to the data depends on your OS. Instead of using forward slashes / in the path, try using escaped backslash characters like this: 'data\\dogs-vs-cats\\train'

    • @lukokimpova26
      @lukokimpova26 3 ปีที่แล้ว

      @@deeplizard Good day, dear Mandy, tranks a million for reapplying to my request; I will strongly apply this new approach you have come to advise me. I will come back to you for feedback. Thanks in advance, stay safe.

    • @lukokimpova26
      @lukokimpova26 3 ปีที่แล้ว

      First of all, may the Lord God bless you and your team enormously. You are a lifesaver; now it is perfectly working. In fact, I made a mistake on data labeling, instead of a small letter, I utilised a capital letter. for instance, instead of using dog, I used Dog.
      Thanks a million.

    • @عزوزالمزيني-س9م
      @عزوزالمزيني-س9م 2 ปีที่แล้ว

      @@lukokimpova26 many thanks

    • @kgnightcry8118
      @kgnightcry8118 ปีที่แล้ว

      @@deeplizard yeah it wouldn't work until i moved all the images from train into dogvscats

  • @prathampandey9898
    @prathampandey9898 2 ปีที่แล้ว

    Hello. I am getting "TypeError: 'str' object is not callable" at
    img, labels=next(train_batches)
    line.

  • @darklord9724
    @darklord9724 4 ปีที่แล้ว +1

    Mam can you make some videos on projects on computer vision plz

  • @AKalen96
    @AKalen96 3 ปีที่แล้ว

    Whats the difference between using flow_from_directory and preprocessing.image_dataset_from_directory? Is there a specific reason to use one before the other?

  • @thomasvmf3984
    @thomasvmf3984 3 ปีที่แล้ว

    my code won't load, the first part when I import all the libraries I'm gonna need is all ok, but then when I try to divide the images between train, test and validation the code won't load, it show this symbol * and have stayed like that for hours.. can someone tell me what to do?

  • @david917654321
    @david917654321 2 ปีที่แล้ว

    Hi. I am using Anaconda - Jupyter notebook. May I know how to read the file ?? As it could only allow zip file, I cannot do the splitting of photos like you did starting from 5:14 after unzip. Hope there is a full code tutorial on this. Thanks !!

  • @unamattina6023
    @unamattina6023 2 ปีที่แล้ว

    instead of deleting the files by hand you can use this script:
    path = r"path/to/your/dogs-vs-cats/dataset/"
    train_folder = "train/"
    allfolders = os.listdir(path)
    for folder in allfolders:
    source = os.path.join(path,folder,train_folder)
    destination = os.path.join(path,folder+'/')

    for img in os.listdir(source):
    shutil.move(source+img, destination+img)
    os.rmdir(source)
    that will do the exact thing :)
    thank you for the video!

  • @salmanwafiq4599
    @salmanwafiq4599 2 ปีที่แล้ว

    I have problem when I organize the data. My output is error, it said sample larger than population or is negative. How to fix it ?Thankyou

    • @kgnightcry8118
      @kgnightcry8118 ปีที่แล้ว

      i got the same problem any solution?

  • @davide292e
    @davide292e 2 ปีที่แล้ว +1

  • @user-nadya111
    @user-nadya111 3 ปีที่แล้ว

    i dave one problem. Why train, valid and test directory are empty when i try creating them by meanf of running the code?

    • @pablopepo1667
      @pablopepo1667 5 หลายเดือนก่อน

      the if sentences could be at the same indentation as the for sentences, also os.chdir('../../'). Like this (excuse my basic english):
      os.chdir('M:/Descargas F en M/Varios archivos/Python/Libros/Python/IA/Datasets/Curso Keras Tensorflow/trainer') # acá va el direct relativo a mi workplace
      if os.path.isdir('train/dog') is False: # chequea si dentro de ese direct están creados los subdirect
      os.makedirs('train/dog')
      os.makedirs('train/cat')
      os.makedirs('valid/dog')
      os.makedirs('valid/cat')
      os.makedirs('test/dog')
      os.makedirs('test/cat')
      for i in random.sample(glob.glob('cat*'), 500):
      shutil.move(i, 'M:/Descargas F en M/Varios archivos/Python/Libros/Python/IA/Datasets/Curso Keras Tensorflow/trainer/train/cat')
      for i in random.sample(glob.glob('dog*'), 500):
      shutil.move(i, 'train/dog')
      for i in random.sample(glob.glob('cat*'), 100):
      shutil.move(i, 'valid/cat')
      for i in random.sample(glob.glob('dog*'), 100):
      shutil.move(i, 'valid/dog')
      for i in random.sample(glob.glob('cat*'), 50):
      shutil.move(i, 'test/cat')
      for i in random.sample(glob.glob('dog*'), 50):
      shutil.move(i, 'test/dog')
      os.chdir('../../')

  • @pranjalshahi2277
    @pranjalshahi2277 3 ปีที่แล้ว

    when i run the code of 6:24 it throws "Sample larger than population or is negative" value error
    please help me

  • @Dresseurdecode
    @Dresseurdecode 3 ปีที่แล้ว +1

    Hello,deeplizard! Mandy i like your job, great and impressive. Please, can you help your community with image segmentation? It should be great! Thanks

    • @deeplizard
      @deeplizard  3 ปีที่แล้ว

      Thanks! May add in the future :)

    • @Dresseurdecode
      @Dresseurdecode 3 ปีที่แล้ว

      Thank you so much😎!

  • @diogoqueiroga2774
    @diogoqueiroga2774 2 ปีที่แล้ว

    Hey! Thank you for uploading such amazing content. I have a question about this video. I am a bit confused as to why you apply the function below to both train, validation and test sets:
    preprocessing_function=tf.keras.applications.vgg16.preprocess_input
    My understanding is that this line of code will apply the same type of pre-processing that was applied in vgg16, instead of we manually specifying our own parameters. But I thought this was only important for the train set, and not for validation or test since those directories will be helping us understand the model performance with unseen data...thus, no need to pre-process.
    Can you clarify why you also run that line in validation and test as well?
    Thank you so much!

  • @srinivasarao416
    @srinivasarao416 2 ปีที่แล้ว

    Hi Madam, how to HOW TO load from npZ file . please let me know

  • @sujanpaul99
    @sujanpaul99 3 ปีที่แล้ว

    can i build a mobile application using this data model?

  • @upomashahrin5492
    @upomashahrin5492 4 ปีที่แล้ว

    i can not fix this. i followed exactly the same steps and even created all the folders using the given code. however i think it cannot fine the path directory train_path = 'C:\data\dogs-vs-cats\train' .please help.
    Found 0 images belonging to 2 classes.
    Found 0 images belonging to 2 classes.
    Found 0 images belonging to 2 classes.

    • @upomashahrin5492
      @upomashahrin5492 4 ปีที่แล้ว +1

      i fixed it.
      it must be like this
      train_path = 'C:/data/dogs-vs-cats/train'
      not
      train_path = 'C:\data\dogs-vs-cats\train'

    • @deeplizard
      @deeplizard  4 ปีที่แล้ว

      Thanks for sharing your solution. They way in which you specify file paths (with forward or back slashes) depends on your OS.

    • @GauravSingh-ku5xy
      @GauravSingh-ku5xy 4 ปีที่แล้ว

      @@deeplizard I have a similar problem here. Instead of
      Found 0 images belonging to 2 classes.
      Found 0 images belonging to 2 classes.
      Found 0 images belonging to 2 classes.
      It shows
      Found 2000 images belonging to 2 classes.
      Found 400 images belonging to 2 classes.
      Found 200 images belonging to 2 classes.
      See each number here should actually be half because there are 1000 images in train, 200 in validate and 100 in test.
      I even checked the number of images from the folders. They really are 1000 in train and so on.
      Any help?

  • @nithishkrish3442
    @nithishkrish3442 8 หลายเดือนก่อน

    Can you upload the invoice image model

  • @illenafnayr
    @illenafnayr 6 หลายเดือนก่อน

    Finally can do something useful with the 25000 cat photos on my phone

  • @urvashimesariya
    @urvashimesariya 4 ปีที่แล้ว

    ValueError: Sample larger than population or is negative
    getting this error while running code for organize data

    • @justinsunarto5765
      @justinsunarto5765 4 ปีที่แล้ว +1

      I got same error, to fix this,
      first, I print the length of glob.glob('cat*') function, and I got 0 value. My conclusion is glob.glob didn't find the right directory of the cat images. So what I did is specify the directory for base cat and dog images url., and that's work for me.
      Maybe you can solve your problem using this solution..

  • @Whereismymind-hn3eo
    @Whereismymind-hn3eo 3 ปีที่แล้ว

    Is there this code on github or somewhere i can download ?

  • @pablopepo1667
    @pablopepo1667 5 หลายเดือนก่อน

    Hay errores:
    *Donde dice tensorflow.keras. ....., borrar tensorflow. , que comience desde keras. ..., porque keras trabaja ahora como módulo independiente
    *Esto no es error pero puede confundir: en os.chdir('data/dogs-vs-cats'), puede llevar dentro de las comillas el dir relativo o el absoluto, por ej: 'M:/Descargas F en M/Varios archivos/dogs-vs-cats' , respetando la barra hacia la derecha, y una sola barra después de la letra de unidad y los 2 puntos
    *El indentado está mal. Los for i in random. ... , van a la altura del if os.path.isdir ... y el os.chdir('../../') también a la misma altura de indentado. Si lo ejecutamos así, crea los directorios, pero no les carga las imágenes, puede cargar una sola la primer pasada, porque los for con esa indentación son una condición del if, que está chequeando la creación de los subdirectorios, condición que se cumple en la primer pasada del código

  • @atheeralgarni1687
    @atheeralgarni1687 4 ปีที่แล้ว

    I don't know why I'm getting this Error ValueError: Sample larger than population or is negative !

    • @azpazy
      @azpazy 4 ปีที่แล้ว +1

      i had the same issue it means that the pics arent in the correct location

    • @AyushGupta-kp9xf
      @AyushGupta-kp9xf 4 ปีที่แล้ว +2

      hi, i faced the same error, try moving the pics from train folder to the dogs-vs-cats folder. (with the train folder being empty). that should work

    • @avijitbiswas2628
      @avijitbiswas2628 4 ปีที่แล้ว +2

      @@AyushGupta-kp9xf Thanks dear..it works. I just rename os.chdir('data/dogs-vs-cats') to os.chdir('data/dogs-vs-cats/train')...

  • @aflatkhan6725
    @aflatkhan6725 2 ปีที่แล้ว

    where are labels?

  • @parthbhardwaj2262
    @parthbhardwaj2262 4 ปีที่แล้ว

    This is the path I mentioned - os.chdir('data\d-vs-c')
    But I am getting this error - The system cannot find the path specified: 'data\\d-vs-c'
    Could you please help me !!

    • @AyushGupta-kp9xf
      @AyushGupta-kp9xf 4 ปีที่แล้ว

      hi, i faced the same error, try moving the pics from train folder to the dogs-vs-cats folder. (with the train folder being empty). that should work

  • @imdarrel
    @imdarrel 3 ปีที่แล้ว

    cat.6.jpg: Cat or Human? Yes

  • @ineshtickoo2530
    @ineshtickoo2530 4 ปีที่แล้ว

    How do I fix this?
    ----> 1 for i in random.sample(glob.glob('cat.*'), 500):
    2 shutil.move(i, 'train/cat')
    ValueError: Sample larger than population or is negative
    Great video btw! But please help me fix this error, thank you.

    • @AyushGupta-kp9xf
      @AyushGupta-kp9xf 4 ปีที่แล้ว +6

      hi, i faced the same error, try moving the pics from train folder to the dogs-vs-cats folder. (with the train folder being empty). that should work

  • @gapa5146
    @gapa5146 4 ปีที่แล้ว

    Why there is a bed in the background ? :>

    • @deeplizard
      @deeplizard  4 ปีที่แล้ว +3

      Since we have been living in different areas of South East over the last year and a half, we don't have a dedicated filming studio. This episode was filmed from our Airbnb in Vietnam, which is why you see a bed.

    • @benedictjn192
      @benedictjn192 4 ปีที่แล้ว +1

      Lockdown time it doesn't matter. Look at the video content and enhance your learning.

  • @fnfsnafidfjdsaifji3928
    @fnfsnafidfjdsaifji3928 4 ปีที่แล้ว

    You wanna marry me?

  • @tostupidforname
    @tostupidforname 4 ปีที่แล้ว

    Is there a way to get the dataset without kaggle? I dont own a phone and cant download it.
    EDIT: I got it anyway