Tutorial 28- Create CNN Model Using Transfer Learning using Vgg 16, Resnet

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • Please join as a member in my channel to get additional benefits like materials in Data Science, live streaming for Members and many more
    / @krishnaik06
    Github url: github.com/kri...
    Please do subscribe my other channel too
    / @krishnaikhindi
    Take the best online course on Data Science
    www.appliedaic...
    Connect with me here:
    Twitter: / krishnaik06
    facebook: / krishnaik06
    Instagram: / krishnaik06

Komentáře • 194

  • @karmawangchuk283
    @karmawangchuk283 Před 4 lety +17

    Sir, I salute for your comprehensive tutorial. You are a source of inspiration. Hats off to you.

  • @luq2337
    @luq2337 Před 3 lety +41

    That's true. My professor: Do it, I won't teach you!!! Give me the results next week!!! Some smart India guys on youtube: do this, do this ..... and then you get it!

  • @abutareqrony4513
    @abutareqrony4513 Před rokem +1

    You man are seriously legend. You deserve lot lot appreciation krish. Great fan of u.

  • @varunraj5543
    @varunraj5543 Před rokem +1

    this solved my entire problem . Really really helpful . sir how can we write code for predicting the outputs

  • @AmanKumarSharma-de7ft
    @AmanKumarSharma-de7ft Před 4 lety +9

    Great content sir ....and wonderful explaination!!......can you please upload more videos on deployment of machine learning models as these are the areas nobody have such extensive tutorial about

  • @samueladoun2989
    @samueladoun2989 Před 4 lety +8

    You are doing a great work here. Keep it up.

  • @matcarpes
    @matcarpes Před rokem

    If you get an error trying to plot the "accuracies" step near the end it is probably because there was a change in Keras release 2.3.0.
    “Metrics and losses are now reported under the exact name specified by the user (e.g. if you pass metrics=[‘acc’], your metric will be reported under the string “acc”, not “accuracy”, and inversely metrics=[‘accuracy’] will be reported under the string “accuracy”.”
    Just change:
    plt.plot(r.history['acc'], label='train acc')
    plt.plot(r.history['val_acc'], label='val acc')
    for this:
    plt.plot(r.history['accuracy'], label='train acc')
    plt.plot(r.history['val_accuracy'], label='val_acc')

  • @bigghostshadowchannel3955

    Hi Krish, I have watched some of your videos recently. I was amazed at your teaching techniques. You deserved a big thank you from me. However, I wonder if you have made any videos regarding Transfer learning using CNN (VGG16, VGG50, Alexnet, Resnet, Etc.) as a feature extractor and Classifiers (Random Forest, Decision tree, SVM, KNN, Naive Bayes, etc.) as a classifier for a multiclass classification problem and compare their performance in terms of Accuracy, Recall, F1 score, and precision?

  • @carlosfotsing6779
    @carlosfotsing6779 Před 4 lety +2

    You are the best keep doing

  • @EverlastingsSlave
    @EverlastingsSlave Před 3 lety

    Thanks man done my assignment, I pray that Allah give u guidance to Islam and bless u

  • @caiohenrique-bg1pp
    @caiohenrique-bg1pp Před rokem

    Thank you so much for this tutorial! I think this is the best one on youtube so far!
    Congratulations!

  • @luq2337
    @luq2337 Před 3 lety +22

    There is one mistake I made when doing my homework. And I wish you guys who see this comment will not make the same mistakes as I did. Be careful with function flow_from_directory(...), you need to make subdirectories for the files under your training folder or testing folder. For example, if you have three classes under the training folder, you need to make three folders. training/calss1/; training/class2/;training/class3/; If you put all files in one folder(like training/... or testing/...), it will return 0 classes. And your program will not work.

    • @subithamohanps
      @subithamohanps Před 3 lety

      yes, keras documentation clearly explains this

    • @zunairanaseem4088
      @zunairanaseem4088 Před 4 měsíci

      But If our all dataset in one folder and folder contains image files and each image file has 3 labels names age, gender and ethnicity then what will do in that case?

  • @andrestiti9698
    @andrestiti9698 Před 3 lety

    U are the reason to succeed in my scholarship year thanx

  • @RahulKumar-qo2ce
    @RahulKumar-qo2ce Před 2 lety +3

    For anyone having an issue in executing model.fit_generator() and it says shape value error: "shape incompatible", please check the "loss" attribute in model.compile and make it "sparse_categorical_crossentropy"

    • @FanaticAuthorship
      @FanaticAuthorship Před rokem

      thanks a lot bro

    • @ahmedchammam6797
      @ahmedchammam6797 Před rokem

      hello bro is this script isn't outdated?

    • @RahulKumar-qo2ce
      @RahulKumar-qo2ce Před rokem

      @@ahmedchammam6797 yep a bit as you can see my comment above for correction but I think Krish can’t help with that 😅 deprication of function is like aging of code with time

  • @hashamfaridy8152
    @hashamfaridy8152 Před 3 lety +2

    Thank you so much 💗 i have successfully trained and integrate my cnn model with my django app locally on my system. i have a question how can i deploy my trained cnn model with django app on heroku do i need to make an API of model to serve django app on heroku? it will be really helpful if you can answer my question.

  • @jaikishank
    @jaikishank Před 3 lety

    Very useful video and well explained. Thanks Krish for the same.

  • @syedrehman5755
    @syedrehman5755 Před 3 lety

    thank you sir
    huge respect from pakistan

  • @shivangbhardwaj51
    @shivangbhardwaj51 Před rokem

    Thank u sir for this wonderful video😊

  • @japeshmethuku9223
    @japeshmethuku9223 Před 4 lety +1

    Krish Naik, I think you missed out on changing 'preprocess_input' function while explaining ResNet50 implementation.

  • @achintya-7
    @achintya-7 Před 3 lety +2

    Sir, I have a question
    If our image size is small like 32, 32, 3
    What would happen to the image if we are resizing it to 224, 224

  • @raghavkandhari1838
    @raghavkandhari1838 Před 3 lety +1

    What about including a confusion matrix?

  • @FaczutMon
    @FaczutMon Před 4 lety +2

    Thank you for your video but may I ask how to use this model? Like load some random image and see if the model is correct or not.

  • @alirezaparsay8518
    @alirezaparsay8518 Před rokem

    It was so clear. Thank you.

  • @stephentidi7320
    @stephentidi7320 Před 3 lety

    Thank you for the excellent video Prof

  • @Raj-sz9pg
    @Raj-sz9pg Před 2 lety

    You make it look so doable👍

  • @sandipansarkar9211
    @sandipansarkar9211 Před 4 lety +1

    Great video.Thanks

  • @shreearmygirl9878
    @shreearmygirl9878 Před 2 lety

    Hello Krish, Fantastic videos fro beginners, please can u send any videos for creating our own dataset for satellite images.

  • @ayushminanayak5352
    @ayushminanayak5352 Před 4 lety +2

    Can I know what data set are you using??? Great video

  • @taruarora7500
    @taruarora7500 Před měsícem

    Hi Krish, wuld have been better if you would have provided us with your dataset also. basically the whole github repo

  • @sapnilpatel1645
    @sapnilpatel1645 Před rokem

    very useful video. Thank yo sir!

  • @bhupendrasingh59
    @bhupendrasingh59 Před 3 lety

    Very simple and helpful

  • @syedmuhammadusmanghani9220

    a very helpful video sir..Stay blessed

  • @djibrildassebe4327
    @djibrildassebe4327 Před 2 lety

    Great explanation 👏👏👏

  • @subrinanaureen399
    @subrinanaureen399 Před rokem

    Thank you so much

  • @swatimishra1555
    @swatimishra1555 Před rokem +1

    can you make a video on skin cancer classification ISIC2019.

  • @sohailahmaddes
    @sohailahmaddes Před 2 lety

    very useful tutorials sir

  • @HashanDananjaya
    @HashanDananjaya Před 3 lety

    Really helpful video. Thank you!

  • @mh1630
    @mh1630 Před 2 lety

    very thanks for you

  • @layallayal2761
    @layallayal2761 Před 4 lety +2

    I am a beginner to deep learning I want to ask you for example if I took alexnet as my pre-trained model and I only kept the first 2 conv without any modification, but the rest of the layers I did change it dose this consider transfer learning?!

  • @lakshmitejaswi7832
    @lakshmitejaswi7832 Před 4 lety +2

    why kernel size is always odd?
    how backpropagation takes place in max-pooling?

    • @hardikkamboj3528
      @hardikkamboj3528 Před 4 lety

      There are no parameters in max pooling, so, i guess there is no effect of backpropagation on maxpooling layers.

    • @jagdishjazzy
      @jagdishjazzy Před 4 lety

      In back propagation the value of the filters are updated in each epoch to minimize the loss. Hence if the weight are updated so is the output image of convolution layer. If the convolution image changes every epoch so is the max pooling .

  • @vibesnovibes6320
    @vibesnovibes6320 Před 3 lety

    Great video. Thanks 👍

  • @lavanyamaddisetty
    @lavanyamaddisetty Před 4 lety

    I have designed a multiplier and output is obtained for it. How to use this multiplier in CNN(the multiplication operation takes place between the inputs and filters in CNN), where to place the designed multiplier architecture in CNN.

  • @priyankapradhan4539
    @priyankapradhan4539 Před 4 lety

    very knowledgable video...
    can we use more than one pretrained model like vgg16 with reset etc...???

  • @learn2know927
    @learn2know927 Před 2 lety

    very nice sir, thank you

  • @lotfimerad658
    @lotfimerad658 Před 2 lety

    in 13:38 s you have to change the line 17 to form keras.application.resnet50 import preprocess_input

  • @parimalakhenia9528
    @parimalakhenia9528 Před 4 lety +2

    r = model.fit_generator(
    training_set,
    validation_data=test_set,
    epochs=5,
    steps_per_epoch=len(training_set),
    validation_steps=len(test_set)
    )
    when it fit
    'Tensor' object has no attribute 'assign' this is error

  • @thevivekmathema
    @thevivekmathema Před 4 lety

    very good information....thank you

  • @alexomelak4200
    @alexomelak4200 Před 6 měsíci

    Sir ,help me please? I was doing gray scale image classification using VGG16. their is an error when I update the code from
    vgg = VGG16(input_shape=IMAGE_SIZE + [3], weights='imagenet', include_top=False) to
    vgg = VGG16(input_shape=IMAGE_SIZE + [1], weights='imagenet', include_top=False). help me please

  • @mele1314
    @mele1314 Před 3 lety

    Thank you ! it is fantastic and important tutorial !! but can you show the confusion matrix ?

  • @akhilsharma4004
    @akhilsharma4004 Před 4 lety +1

    I really like the way you explain your concepts but to be honest i amm really disappointed the way you have hurried up in video number 28 which is using vgg16 , firstly it took me a while to understand that i need to create a folder named dataset and i need to upload some images into it ,,, as you didnt mentioned that part also i am getting an error :'ProgbarLogger' object has no attribute 'log_values' when i am trying to run the model.fit_generator code cell and then i somehow googled that i need to set verbose=0 in that part and then i am getting a keyerror:'loss' , i would have really appreciated your much efforts if you could have run the code and shown us the output it really difficult for those who are really trying their hands on Deep Learning for the 1st time

  • @nikolaostziokas6847
    @nikolaostziokas6847 Před 3 lety

    Great video. I have only one question to the community here. What the dimensions of the training and test images should be? Do they have to be 224*224 before the import into the algorithm or the user can set them (the dimensions) afterwards? Many thanks

    • @subratsaxena9767
      @subratsaxena9767 Před 2 lety +1

      Hi Nikolaos
      The target size parameter in flow_from_directory handles it for you and standardizes all inputs to the required dimensions

  • @tilkesh
    @tilkesh Před 2 lety

    Thanks

  • @sahajrajmalla
    @sahajrajmalla Před 2 lety

    You have to load models and make the prediction too sir

  • @unemployedcse3514
    @unemployedcse3514 Před 3 lety

    Awesome 💞

  • @Alphaz-db8vc
    @Alphaz-db8vc Před měsícem

    Sir any guide video for using transfer learing in case of ViT

  • @global4069
    @global4069 Před 2 lety

    A great tutorial. Is it possible to use an independent model in Transfer Learning , other than the documented set from keras library?

  • @tulsichopade
    @tulsichopade Před 2 lety

    If we want to predict the class for a particular image then how to do it?

  • @anshikachoudhary4134
    @anshikachoudhary4134 Před 3 lety

    @Krish Naik sir pls explain Google Net as well as Squeezenet

  • @venkateshsurampally8915

    Fantastic

  • @dr.d.vetrithangam5787
    @dr.d.vetrithangam5787 Před 2 lety

    Great content sir , kindly provide the code with explanation for computing confusion matrix for resnet models

  • @ladiharish7843
    @ladiharish7843 Před 3 lety

    Without training the new data with VGG16 or ResNet how come the features got extracted simple using softmax function at the end of the previously trained neural network?

  • @louerleseigneur4532
    @louerleseigneur4532 Před 3 lety

    Thanks Krish

  • @sahajrajmalla
    @sahajrajmalla Před 2 lety

    I have trained the model using this technique and while predicting it showing this error:
    ValueError: `decode_predictions` expects a batch of predictions (i.e. a 2D array of shape (samples, 1000)). Found array with shape: (1, 31)
    Please help

  • @SIMHADRICHINNAGOPIPHD

    Hai krish sir..Thanks to share your knowledge and your videos are very helpfull to my research work ... and i have small doubt can please help me... for the above transfer learning code i run and save the diff models..,after saving the model in .h5 format is it possible to calculate performance metrics like precision, recall, f1-score, sensitivity and cf. If possible Please help me regarding this.

  • @kin_1997
    @kin_1997 Před 2 lety

    followed all steps, using 4 similar type of classes. Why only getting 20% accuracy ?

  • @tejaswinicode
    @tejaswinicode Před rokem

    can please add confusion matrix and ROC curve after transfer learning CNN model

  • @purushothamkothakota4327

    Is transfer function in Ann diffrent from activation function

  • @yasminekhemiri6221
    @yasminekhemiri6221 Před 4 lety

    THANK YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @RAZZKIRAN
    @RAZZKIRAN Před rokem

    how to print classification report for the above code?

  • @bhavukthakur9501
    @bhavukthakur9501 Před 2 lety

    sir, could you help me out with image augmentation part. After applying image augmentation in train data do we get 4 times the number of image or just one augmented image?

  • @mapytekh
    @mapytekh Před 3 lety

    how many images have you taken in your train and test set??? and how many folders are there in your test folder???

  • @divyarajvs8890
    @divyarajvs8890 Před 3 lety

    why are we removing the last layer 3 of vgg16 that is include_top=False

  • @poonamanand9011
    @poonamanand9011 Před 4 lety

    Hi Krish, Pls make a video on Local Response Normalization used in Alexnet.

  • @muhammadsajad2230
    @muhammadsajad2230 Před 3 lety

    # don't train existing weights
    for layer in vgg.layers:
    layer.trainable = False (if here we give false then how it is possible to train the network on our data?)

  • @navjiwanhira3888
    @navjiwanhira3888 Před 3 lety

    Thank you!!!

  • @sweeten5878
    @sweeten5878 Před 4 lety

    is their any video lecture how to use transfer learning in mask rcnn? Or any video lecture how to develop mask rcnn from scratch using images?

  • @manalisingh1128
    @manalisingh1128 Před 2 lety

    Should we create 4 sub-folders under "test" folder as well?

  • @SurajVerma-rh9xi
    @SurajVerma-rh9xi Před 4 lety

    Thank u Sir !!

  • @mrmystery-jz2ev
    @mrmystery-jz2ev Před 3 lety

    I have question, what if we want to use Alexnet for transer learning? what should write?

  • @babaabba9348
    @babaabba9348 Před 3 lety

    how to covert picture from fashion mnist size 28x28 to 32x32x3

  • @tirthadatta7368
    @tirthadatta7368 Před 2 lety

    Sir, how can I use stratified cross validation and label encoding in the vgg16 model given in video??

  • @karthikarumugam9905
    @karthikarumugam9905 Před 9 měsíci

    how to write a test func to load the saved model and test on new images?
    Please help

  • @segundojaramilloromero9909

    Could you make an example of segmentation?

  • @surajpatil4815
    @surajpatil4815 Před 2 lety

    How to fuse features from multiple deep learning model

  • @punkster36
    @punkster36 Před 4 lety

    What if the input images are not of size [224,224] and are [32,32]. How can I change the input image size to fit this model?

  • @dkishore599
    @dkishore599 Před 4 lety

    it is great explanation, i just wondering about one thing here i seen some videos they used MobileNet of Keras on image classification , so
    what is the difference b/w CNN code and MobileNet code ?
    can we do Dog & cat classification by using MobileNet ?

    • @Roodyculous
      @Roodyculous Před 4 lety

      Yes, you can do Classification by MobileNet. It requires less computational power for giving outputs.

  • @sharatchandra2045
    @sharatchandra2045 Před 4 lety

    good content

  • @sumagopan8730
    @sumagopan8730 Před 11 měsíci

    Sir
    I have a 1000 classes to train the VGG16 network, but I am not able to train it in a single attempt. I want to train the image with 100 classes and aging using the new weight I need to train again. What shall I do?

  • @anantgoyal7297
    @anantgoyal7297 Před 3 lety

    Hello sir , Can you please make a video about GAN,s ,its implementation

  • @randyansyah1851
    @randyansyah1851 Před rokem

    sir, i want to ask. how to use this model after we save?

  • @Twilight2595
    @Twilight2595 Před 4 lety

    the Train set has images but what is inside the Test set?? how did u divide it?

  • @MithileshDSCS
    @MithileshDSCS Před 4 lety

    hey Krish could you like maybe post a video as to how to import and use data sets used for cnns and image classification in Colab? Because it is not a simple csv file and has different folders so accessing and using them is hard. Would really help as other tutorials only use cifar and mnist which are already pre loaded into keras. So yeah!!

    • @vasusharma1773
      @vasusharma1773 Před 4 lety

      It is not that hard, You just watch his video 'czcams.com/video/Gvwuyx_F-28/video.html'

  • @amruthgadag4813
    @amruthgadag4813 Před rokem

    can keras be imported in pytorch model?

  • @adityarajora7219
    @adityarajora7219 Před 4 lety

    Where are FC1 and FC2 layers as they present in VGG16 ?

  • @artificialintelligenceengi6125

    Sir, I am getting the following error:-
    File "C:\Users\Ammu\TL\face_Recognition.py", line 91, in
    plt.plot(r.history['val_loss'], label='val loss')
    KeyError: 'val_loss'

  • @siddharthmishra8012
    @siddharthmishra8012 Před 3 lety

    Actually VGG net is trained on other images then how come it will classify your face?

  • @aachaljakhotiya523
    @aachaljakhotiya523 Před 3 lety

    Can we use these models for text polarity classification??

  • @zahidrasheed5273
    @zahidrasheed5273 Před 4 lety

    Hello Sir, I am doing experiment by using this model and datasets is (cats and dogs) downloaded from kaggle all things are same... but i am not getting accuracy more than 50% on VGG16 model please give me some suggestion thanks

  • @yepnah3514
    @yepnah3514 Před 3 lety

    my professor wants me to extract the weight values is there a way to do that? IM pretty new to this.

  • @Maryashahere
    @Maryashahere Před rokem

    Sir
    How can we apply transfer learning for numerical data?