@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.
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?
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.
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?
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.
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?
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
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
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.
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
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)
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!
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)
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
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!
@@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.
@@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
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
@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.
Thanks sir i hv been searching for this for quite some time now..most helpful
You are most welcome Philip
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?
You can classify each at a time and pass them as a batch, totally upto you!
Amazing video. Thank you so much for your content. it is advantageous. it solved my problem of splitting datasets in folder management.
Glad it helped! Keep learning :-)
One of the best videos and solved my problem... Thank you so much sir ❤️
Most welcome
Great video! Just a quick question, how do you print the images in the train or validation folders?
Please share the screenshot of where and what you are trying to print.
How can I use my own dataset for this?
Amazing video! Just had a small doubt. How did you make the csv file of your labels?
Dear Neelabh, I have downloaded the data from Kaggle and labels are already stored in the CSV file. Hope this helps.
Hi. Can you plz guide me how to create this test.csv file
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.
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?
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.
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?
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.
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
Can you please retry or share the screenshot?
Very Nice video. Can you guide me how to find RECALL value for MULTICLASS IMAGE CLASSIFICATION in keras?
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
Congrats and thank you for the video.
You are most welcome. Thank you for watching.
Very informative video, thank you
Many thanks!
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.
Can you please share the screenshot of the error to theclassoai@gmail. com
Very informative video Thank you so much sir
Thank you, Anil :-) Keep Watching
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
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)
can u tell the model name u have used in this?
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!
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)
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
Did you ever fix the problem?
Thanks for this video
Most welcome
what is inside the test.csv file
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!
@@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.
In general how to improve accuracy?
You can use different transfer learning methods for domain adaptation.
Is it possible to create multi-class image classification and captioning without using Tensorflow, Keras, or sklearn
Yes, it is possible.
@@TheClassofAI can you give a outline for this ?
@@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
How to split dataset in train and test set?
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.
Based on your code I have an error due to split data there is no such file directory
[Errno 2] No such file or directory: '/content/dataset/cloudycloudy47.jpg'
I got it
my directory name changes
Thank you for raising the query. Glad to know that you have sorted it.
Is this code on github?
@Chintan: Kindly see the link to GitHub: github.com/theclassofai/Multiclass_Image_Classification
weather dataset is free
Yes it is free. You only need Kaggle account to download the data
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
Can you please send me the screenshots or share the notebook with me theclassofai@gmail.com ?
Thank you!
@@TheClassofAI i have the same error
did u found a solution ?? @Umer Zaman Khan
@@nasroayed3065 yes bro
@@umerzamankhan4536 can u help me plz ? how did u fix the probleme ?