Multi-class Image Classification using Keras (Python) on Weather Dataset (Kaggle)

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

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

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

    Thanks sir i hv been searching for this for quite some time now..most helpful

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

    ​ @The Class of AI Thank you for the video. The dataset I am currently using has no test.csv. How do I generate my test.csv such that I can use it to test the model. Or do I do that manually. I have the test folder that contains the all the images I want to use to test. Thank you.

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

    One of the best videos and solved my problem... Thank you so much sir ❤️

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

    Amazing video. Thank you so much for your content. it is advantageous. it solved my problem of splitting datasets in folder management.

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

    Amazing video! Just had a small doubt. How did you make the csv file of your labels?

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

      Dear Neelabh, I have downloaded the data from Kaggle and labels are already stored in the CSV file. Hope this helps.

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

    thank you so much sir this is very good explanation, but i question sir can this model will classify only one image? and it should give me class of that image?

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

      You can classify each at a time and pass them as a batch, totally upto you!

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

    Great video! Just a quick question, how do you print the images in the train or validation folders?

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

      Please share the screenshot of where and what you are trying to print.

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

    How can I use my own dataset for this?

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

    Hi. Can you plz guide me how to create this test.csv file

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

      Your submissions usually have two columns: an ID column and a prediction column. The ID field comes from the test data (keeping whatever name the ID field had in that data, which for the housing data is the string 'Id'). The prediction column will use the name of the target field. We will create a DataFrame with this data, and then use the dataframe's to_csv method to write our submission file. Explicitly include the argument index=False to prevent pandas from adding another column in our CSV file.

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

    Given a training dataset which has pdf having scan image of restaurant invoice...need code for nlp model to extract subtotal from receipts...any such sample code available?

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

      I believe the only way to do it is by using Optical Character Recognition (OCR). Use OCR to read the number/total and then learn it.

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

    Sir ,
    i am getting error in CCN model section, My epochs are not running and giving the erroe as :
    InvalidArgumentError: logits and labels must be broadcastable: logits_size=[16,5] labels_size=[16,4]
    [[node categorical_crossentropy/softmax_cross_entropy_with_logits
    (defined at /usr/local/lib/python3.7/dist-packages/keras/backend.py:5010)
    ]] [Op:__inference_train_function_3283]
    plese solve the issue

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

      Can you please retry or share the screenshot?

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

    Thanks for video!! There was a step to check the number of images across classes(cloudy, fog etc)...is it required to be balanced across classes to get better accuracy?

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

      Yes, we can use resampling to balance the classes. Otherwise, better to use Sensitivity-Specificity Metrics and use a confusion matrix to see the performance.

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

    Very Nice video. Can you guide me how to find RECALL value for MULTICLASS IMAGE CLASSIFICATION in keras?

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

      Please try this code:
      def macro_recall(y_true, y_pred):
      # find the number of classes
      num_classes = len(np.unique(y_true))
      # initialize recall to 0
      recall = 0
      # loop over all classes
      for class_ in list(y_true.unique()):
      # all classes except current are considered negative
      temp_true = [1 if p == class_ else 0 for p in y_true]
      temp_pred = [1 if p == class_ else 0 for p in y_pred]

      # compute true positive for current class
      tp = true_positive(temp_true, temp_pred)
      # compute false negative for current class
      fn = false_negative(temp_true, temp_pred)

      # compute recall for current class
      temp_recall = tp / (tp + fn + 1e-6)
      # keep adding recall for all classes
      recall += temp_recall
      # calculate and return average recall over all classes
      recall /= num_classes
      return recall

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

    Congrats and thank you for the video.

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

      You are most welcome. Thank you for watching.

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

    Very informative video, thank you

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

    sir, How do split dataset if we have 3 splits(train, valid, and test). I have an error like below.
    split_size = .85
    split_data(YES_SOURCE_DIR, TRAINING_YES_DIR, VALID_YES_DIR, TEST_YES_DIR, split_size)
    split_data(NO_SOURCE_DIR, TRAINING_NO_DIR, VALID_NO_DIR, TEST_NO_DIR, split_size)
    TypeError: split_data() takes 4 positional arguments but 5 were given
    Please you give a problem solver about this. Thank you so much. Greeting.

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

      Can you please share the screenshot of the error to theclassoai@gmail. com

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

    Kindly help me with this error, i'm a complete newbie trying to apply this process to another model.
    InvalidArgumentError for model.fit_generator (deprecated)

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

      Model.fit_generator is deprecated starting from TensorFlow 2.1.0 which is currently in rc1. You can find the documentation for tf-2.1.0-rc1 here: www.tensorflow.org/versions/r2.1/api_docs/python/tf/keras/Model#fit

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

      Did you ever fix the problem?

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

    Thank you for the video!
    I have the problem though, that the prediction comes out as integers, meaning it predicts like so [0 0 1 0]. I would like it to give me floats like [0.5 0.7 0.1 0.5] for example

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

      In line 32: Please don't use "argmax" because it returns the indices of the maximum values along an axis. Try this code when predicting test dataset
      array = model.predict(test_preprocessed_images, batch_size=1, verbose=1)
      print(array)

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

    Very informative video Thank you so much sir

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

      Thank you, Anil :-) Keep Watching

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

    In general how to improve accuracy?

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

      You can use different transfer learning methods for domain adaptation.

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

    Thanks for this video

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

    can u tell the model name u have used in this?

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

      Hi Jaswanth, it is a simple CNN model with Data Augmentation. I have not used any transfer learning or pre-trained model for this multi-class classification. If you have any further queries, please get in touch. Thank you!

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

    How to split dataset in train and test set?

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

      Anuja: As I did in cell 9 of the jupyter notebook for train and validation. You can use the same to create a test set.

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

    Is it possible to create multi-class image classification and captioning without using Tensorflow, Keras, or sklearn

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

      Yes, it is possible.

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

      @@TheClassofAI can you give a outline for this ?

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

      @@poraspatle7980 I think this blog can help you medium.com/analytics-vidhya/how-to-build-a-multi-class-image-classification-model-without-cnns-in-python-660f0f411764

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

    what is inside the test.csv file

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

      Hi Ghulam, it has ground truth or you can say true values of the test dataset. In my code, please see cell 33, where I have used it. If you have any further doubts, please get in touch. Thank you!

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

      ​@@TheClassofAI Thank you for the video. The dataset I am currently using has no test.csv. How do I generate my test.csv such that I can use it to test the model. Or do I do that manually. Thank you.

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

    Based on your code I have an error due to split data there is no such file directory

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

      [Errno 2] No such file or directory: '/content/dataset/cloudycloudy47.jpg'

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

      I got it
      my directory name changes

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

      Thank you for raising the query. Glad to know that you have sorted it.

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

    Is this code on github?

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

      @Chintan: Kindly see the link to GitHub: github.com/theclassofai/Multiclass_Image_Classification

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

    weather dataset is free

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

      Yes it is free. You only need Kaggle account to download the data

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

    Sir ,
    i am getting error in CCN model section, My epochs is not running and giving the erroe as :
    InvalidArgumentError: logits and labels must be broadcastable: logits_size=[16,5] labels_size=[16,22]
    [[node categorical_crossentropy/softmax_cross_entropy_with_logits
    (defined at /usr/local/lib/python3.7/dist-packages/keras/backend.py:5010)
    ]] [Op:__inference_train_function_3283
    please help!
    sir

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

      Can you please send me the screenshots or share the notebook with me theclassofai@gmail.com ?
      Thank you!

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

      @@TheClassofAI i have the same error

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

      did u found a solution ?? @Umer Zaman Khan

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

      @@nasroayed3065 yes bro

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

      @@umerzamankhan4536 can u help me plz ? how did u fix the probleme ?