Image Classification in TensorFlow : Cats and Dogs dataset

  Рет қаралды 19,836

Learn DL Code TF

Learn DL Code TF

Күн бұрын

Пікірлер: 118
@rakibulhasanroni9701
@rakibulhasanroni9701 5 жыл бұрын
Thank you very much for the video. It helped a lot to start my research.
@jayshah5949
@jayshah5949 6 жыл бұрын
Can I use similar code to differentiate MS excel graphs or images of these graphs?
@meriljayasinghe9292
@meriljayasinghe9292 3 жыл бұрын
What is the AI technique used here? CNN?
@ravikiran791
@ravikiran791 6 жыл бұрын
Hello,can u tell us how to show the ouput of each convolution layer in the form of images
@kalpanaramasamy5570
@kalpanaramasamy5570 4 жыл бұрын
hi sir , i need separate file for training set or otherwise how can i update the checkpoint whenever i train that file. because whenever i start to train the images trained with beginning iteration'0'. Please help to do that sir.
@MondayMotivations
@MondayMotivations 5 жыл бұрын
IndexError: list index out of range X_train, Y_train = image_preloader(train_data, image_shape = (56, 56), mode = 'file', categorical_labels =True, normalize = True)
@kiruthigarajan1707
@kiruthigarajan1707 6 жыл бұрын
Hi Mr.Vikraman does this code work also for recognising the digits and alphabets or is there a need to do some modifications..if so can you please help me...I am doing my project on optical character recognition..I have tried with images of numbers and alphabets. But it is showing some error like "ValueError: invalid literal for int() with base 10: 'Rajan\\Desktop\\English\\ocr\\img002-00511.png' " . So that i can't go further..I downloaded the dataset named "chars 47K dataset" which contains images of digits and alphabets of differenr styles....can you please figure this out and solve as soon as possible ..Thank you....waiting for your reply.
@vivekmangipudi3773
@vivekmangipudi3773 8 жыл бұрын
thanks for informative tutorial. If i had a 1000 different pictures of different cat in different settings .. say sitting on a sofa in a room full of clothes, a cat inside a box in a room, a cat perching on compound wall on house terrace with beach in background etc .... how do i train model to identify cat & ignore the background and clutter etc.
@learndlcodetf5331
@learndlcodetf5331 8 жыл бұрын
Hi Vivek, This algorithm is based on deep neural network. All Deep models are statistically invariant to a great extent, i.e if your object is in a different location in an image, or in a rotated fashion or in a different color, the network would still do a great job in classification. Having said that, Deep models get better with more training examples. If you include numerous examples of your cat, yes, with this method you can identify your cat in any picture. Interestingly, my upcoming lecture is about Semantic segmentation. With this, you can identify your cat location(pixelwise) in your image! stay tuned!!
@vivekmangipudi3773
@vivekmangipudi3773 8 жыл бұрын
perfect! really excited about your new tutorial! :)
@kumarmadhav4855
@kumarmadhav4855 6 жыл бұрын
Nice video. How have u converted image folder into text file?
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
thanks, I've uploaded a Jupyter notebook that contains this code to convert your image paths to a text file github.com/Vikramank/Deep-Learning-/blob/master/Cats-and-Dogs/to%20create%20text%20files.ipynb
@harineesubramanian9539
@harineesubramanian9539 6 жыл бұрын
Hello sir! After referring to your Image classification in android - tensorflow CIFAR-10 tutorial, i tried to freeze the graph for this image classification in tensorflow cat dog dataset code. But i am getting "output is not in graph" error.
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
Hi check the contents of the graph. Cross check whether you have a named 'output'. You can use the method I discussed in the video
@harineesubramanian9539
@harineesubramanian9539 6 жыл бұрын
Mastering deep learning with TensorFlow Thank you sir!! Is there any size limitation for .pb file? Because, after deploying the code in mobile and capturing the image, we are getting " app stopped working"..and our .pb file size is 170mb
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
No, there is problem when you are loading the graph. Give some output commands for debugging in your Java code, for example soon after loading your model give an output statement. you can call me Vikraman and refrain from calling me 'Sir'
@marceloa.oliveira4333
@marceloa.oliveira4333 6 жыл бұрын
Thank's for this video!! But after training how can I save or will I have to train again every time? thank you!!
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
Hi, of course not :) You can see the following code where I save the model -> github.com/Vikramank/CIFAR-Android-TF/blob/master/cifar_export.py#L100 I've also explained how to save and restore in a separate video that you might find it useful -> kzbin.info/www/bejne/aYeoiYttaNmhrZYm15s Hope this helps :)
@marceloa.oliveira4333
@marceloa.oliveira4333 6 жыл бұрын
Fantastic man thx
@marceloa.oliveira4333
@marceloa.oliveira4333 6 жыл бұрын
I'm begin in tensorflow ty a lot
@engmohamed2165
@engmohamed2165 6 жыл бұрын
please which video you have explained model > please mention me to that video
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
link to the video kzbin.info/www/bejne/jpKYpoVmZrmBaMk
@datasciencewithr1039
@datasciencewithr1039 7 жыл бұрын
Hello, thanks for the tutorial. My data has 1000 images of 2types of flowers in one folder . The images are labeled 1.jpg 2.jpg so on till 1000.jpg . There is a separate csv file with two columns. Col1 is ID which has 1-1000. Col 2 is label which has 1 or 0 . corresponding to each flower id. how should i go about training & building my model thank you.
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Hi, The training method remains the same. However, the way you create your dataset is slightly different. You need to change cell 3 & 4 in the Jupyter notebook. You can access the filenames and class ID from CSV file using Pandas package. In cell 3, filenames_image would be col1 (+.'jpg') . In cell 4, use matching values from col2 to find out the class ID and write the same in a text file. Be sure to shuffle your data before writing it a text file. For your reference in dealing with CSV files and Pandas, check my Jupyter notebook github.com/Vikramank/Deep-Learning-/blob/master/Iris%20data%20classification.ipynb and the corresponding lecture kzbin.info/www/bejne/iISumZ1od7-EeMk . If you are stuck, please don't hesitate to contact me :)
@waytolive7055
@waytolive7055 5 жыл бұрын
hi sir i neen from very begining, like how to install python, jupiter notebook etc, can you do for me?
@learndlcodetf5331
@learndlcodetf5331 5 жыл бұрын
வணக்கம் நண்பரே நீங்கள் எனது Python அறிமுக வீடியோவைப் பார்க்கலாம் kzbin.info/www/bejne/pnengYGkjMdmnJI
@deepkshikha
@deepkshikha 7 жыл бұрын
Thanks for the tutorial . Can you suggest how to load .ckpt-meta and .ckpt-data files to classify new dataset
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Hi, the .ckpt files store the values of the weight and other parameters. You need to start a new session and a tensorflow graph, then restore the values from ckpt files using restore function inside tf.train.Saver(). I have discussed and demonstrated how to do the same in this video(after 21 mins) kzbin.info/www/bejne/aYeoiYttaNmhrZYm4s Hope this helps!
@deepkshikha
@deepkshikha 7 жыл бұрын
Thank you .. Is the same algorithm works for human face image classification ?
@deepkshikha
@deepkshikha 7 жыл бұрын
Means if we have more then 2 class will it works?
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Yes, of course :) You can even try it Cifar 10 or Cifar 100 dataset which contain 10 and 100 classes respectively. You need the dimensions of 'y_' placeholder and output of the last layer(softmax ) to the number of classes
@deepkshikha
@deepkshikha 7 жыл бұрын
I am trying to do using the same for 10 classes all of human faces but getting an error cannot reshape array of size 37632 into shape (50,56,56,3)
@geetanjalisharma3521
@geetanjalisharma3521 7 жыл бұрын
how can i convert the imges dataset floder into txt file ?? 1) writing images name in the folder or any other option ?
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
You can use the method I discussed! Check cells 2-4 in the ipynb github.com/Vikramank/Deep-Learning-/blob/master/Cats-and-Dogs/Cats%20and%20Dogs%20Image%20Classification.ipynb
@marcusnash8238
@marcusnash8238 6 жыл бұрын
Is there a version with this using matlab
@ravikiran791
@ravikiran791 6 жыл бұрын
How to plot confusion matrix for the given cats and dogs tutorial
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
Hi Ravi, To plot the confusion matrix, first, you need to make predictions in the train/test data. You can check my code and explanations to plot a confusion matrix here -> kzbin.info/www/bejne/jpKYpoVmZrmBaMk I have done it for MNIST dataset, You can follow similar procedure here, though it might take longer
@prakhardixit2597
@prakhardixit2597 7 жыл бұрын
I am getting an error File "C:/Python35/dogsandcatscnn2.py", line 48, in X_train, Y_train = image_preloader(TRAIN_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True) File "C:\Users\Prakhar Dixit\AppData\Roaming\Python\Python35\site-packages\tflearn\data_utils.py", line 523, in image_preloader labels.append(int(l[1])) ValueError: invalid literal for int() with base 10: 'and'
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Hi what version of TF learn and TensorFlow are you using?
@prathamesh070191
@prathamesh070191 7 жыл бұрын
I am getting following error: "c:\tf_jenkins\home\workspace elease-win\device\cpu\os\windows\tensorflow\core\common_runtime\executor.cc:594] Executor failed to create kernel. Invalid argument: Cannot parse tensor from proto: dtype: DT_FLOAT tensor_shape { dim { size: 32768 } dim { size: 4096 } } float_val: 0" Can you tell me what is the issue, why it is not able to parse tensor?
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Hi, what version of TensorFlow you are using? Only the latest version of TF supports Windows and the version I made the code is relatively old, but it should still work. I see that you are unable to create a Kernel. Can you open a new Jupyter notebook and try importing TensorFlow ?
@prathamesh070191
@prathamesh070191 7 жыл бұрын
Hi thanks for the reply. I have solved the problem. As i have 4 GB of RAM, its not able to create tensor of that size. I reduced the size of images then it works. But the network is not learning anything, everytime i tried it is showing same loss i.e., around 10.0 and accuracy = 0.0. Although i am trying it on different images. I also tried to change the learning rate, but with no help. Dont know whats going wrong.
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Maybe you reduced the size of images too much. Try resizing the image via the method I discussed towards the end of the lecture. But, I think the problem is due to something else. Did you shuffle your data? If you haven't it will always output a single class and the accuracy will be 0.0 for one class and 1.0 for the other.
@prathamesh070191
@prathamesh070191 7 жыл бұрын
I have shuffled the data and also tried to resize image to slightly bigger size i.e., from 64 to 100. But still getting the same problem.
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
hi, can you share your Jupyter notebook ? I'll have a look at it
@parvathynandakumar8251
@parvathynandakumar8251 5 жыл бұрын
I am getting errors as I try to run this code(tensor flow module not found)
@learndlcodetf5331
@learndlcodetf5331 5 жыл бұрын
Hi, you need to install TensorFlow first www.tensorflow.org/install
@sanketkillekar
@sanketkillekar 5 жыл бұрын
Can u show how to get it in tf lite
@learndlcodetf5331
@learndlcodetf5331 5 жыл бұрын
Hi you can check my tutorial to convert your model to TFlite. kzbin.info/www/bejne/mYjVk2anfqufebM
@mominshaik7786
@mominshaik7786 5 жыл бұрын
How to install tflearn ??? Plz help sir
@learndlcodetf5331
@learndlcodetf5331 5 жыл бұрын
hi you can use pip to install TFlearn (pip install tflearn)
@saikirandornipati6579
@saikirandornipati6579 7 жыл бұрын
Thanks alot
@engmohamed2165
@engmohamed2165 6 жыл бұрын
what is the solution for this error name 'os' isnt defined
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
you need to import the package 'os'. Just hit 'import os'
@dharineeshram5345
@dharineeshram5345 5 жыл бұрын
How to test an image from the already saved trained model
@learndlcodetf5331
@learndlcodetf5331 5 жыл бұрын
Hi, you can check the last two cells of my Jupyter notebook where I have included a helper function for preprocessing and explained how to test on a new image. If you are working on a new notebook, first load the save model using builtin function tf.train.Saver().save and restore functions. Hope this helps!
@dharineeshram5345
@dharineeshram5345 5 жыл бұрын
Bro can you help me with the code to restore the saved model in a fresh notebook and test it . I tried so much and am not able to get it.
@learndlcodetf5331
@learndlcodetf5331 5 жыл бұрын
hi, could you share me your code?
@vijaykoravi7583
@vijaykoravi7583 7 жыл бұрын
thanks fot this tutorial... but i have one question.. if we dont have any dataset and we have some custom images then how we can build the dataset for tensoflow ?
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Hi Vijay, There are several ways to build your custom own data. If you create a dataset with smaller sizes like MNIST, you can store your images in a pickle file. For a large dataset, you can follow my method or use 'h5' file format to store and dynamically import images batch wise. If you are working with signals, you can store them in numpy array format. On the other hand, if you just want to try new images you can try method that I discussed towards the end of the video. Hope this helps.
@vijaykoravi7583
@vijaykoravi7583 7 жыл бұрын
ghostbin.com/paste/2zrjv Hi, can you check this code, I am getting error"Value Error" when i was defining train data and test data....
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
@Vijay Koravi have you defined the path to the files correctly? You can check by loading and displaying a sample image.
@satishdechu5772
@satishdechu5772 8 жыл бұрын
thanks
@learndlcodetf5331
@learndlcodetf5331 8 жыл бұрын
:)
@keerthanarani9929
@keerthanarani9929 7 жыл бұрын
I am getting an error "IndexError: list index out of range" after i run this statement. "X_train, Y_train = image_preloader(TRAIN_DATA, image_shape=(56,56), mode='file', categorical_labels=True, normalize=True)" Can anyone please help me with this?
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Hi Keerthana, this error is likely caused when you image_preloader function is trying to access the image, but the directory does not exist. 'image_preloader' function extracts images from the list in 'TRAIN_DATA' and feed it to TensorFlow graph. You can try to read a single image from Train_Data file using cv2/PIL package. If that files, then there is a problem with Train_data file. Could you please tell me which version of TFlearn and OS you are using?
@keerthanarani9929
@keerthanarani9929 7 жыл бұрын
I am using 1.1.0 version of Tflearn. I am not able to find the OS version. I am new to python. Could you help me with this please?
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Sure! Regarding OS, I want to know whether you are using UNIX(Mac/Linux) or Windows. I coded it in TensorFlow v 0.10. But it's unlikely that it might be the reason for the error. You can check my introductory video about Python kzbin.info/www/bejne/pnengYGkjMdmnJI . Could cross check whether TRAIN_DATA points to the text file containing information in the following format as mentioned in my video: /path/to/img1 class_id_1 /path/to/img2 class_id_2 ...
@keerthanarani9929
@keerthanarani9929 7 жыл бұрын
Thank you so much. I am using Mac actually. Will try it once again and in case I stumble, will surely seek out your help.
@learndlcodetf5331
@learndlcodetf5331 7 жыл бұрын
Sure! I coded in Mac too. So it should work!
@nimrahjabbin6294
@nimrahjabbin6294 4 жыл бұрын
#Importing data X_train, Y_train = image_preloader(TRAIN_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True) X_test, Y_test = image_preloader(TEST_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True) X_val, Y_val = image_preloader(VALIDATION_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True) ValueError: invalid literal for int() with base 10: '(1)/train/dog.11795.jpg' how can i fix this?????/
@AbdusSalamcseiu21
@AbdusSalamcseiu21 6 жыл бұрын
I was run the code and I get the following error .... RESTART: C:\Users\MHL\AppData\Local\Programs\Python\Python35\cat_dog.py == Warning (from warnings module): File "C:\Users\MHL\AppData\Local\Programs\Python\Python35\lib\site-packages\h5py\__init__.py", line 36 from ._conv import register_converters as _register_converters FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. curses is not supported on this machine (please install/reinstall curses for an optimal experience) Dataset Number of training images 493 Number of testing images 154 Number of validation images 73 Shape of an image (56, 56, 3) Shape of label:(3,) ,number of classes: 3 WARNING:tensorflow:From C:\Users\MHL\AppData\Local\Programs\Python\Python35\lib\site-packages\tflearn\initializations.py:119: UniformUnitScaling.__init__ (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior. Iteration no: 0 Traceback (most recent call last): File "C:\Users\MHL\AppData\Local\Programs\Python\Python35\lib\site-packages umpy\core\fromnumeric.py", line 52, in _wrapfunc return getattr(obj, method)(*args, **kwds) AttributeError: 'list' object has no attribute 'reshape' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\MHL\AppData\Local\Programs\Python\Python35\cat_dog.py", line 171, in y_label=np.reshape(y_input,[batch_size,2]) File "C:\Users\MHL\AppData\Local\Programs\Python\Python35\lib\site-packages umpy\core\fromnumeric.py", line 257, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "C:\Users\MHL\AppData\Local\Programs\Python\Python35\lib\site-packages umpy\core\fromnumeric.py", line 62, in _wrapfunc return _wrapit(obj, method, *args, **kwds) File "C:\Users\MHL\AppData\Local\Programs\Python\Python35\lib\site-packages umpy\core\fromnumeric.py", line 42, in _wrapit result = getattr(asarray(obj), method)(*args, **kwds) ValueError: cannot reshape array of size 60 into shape (20,2) . Please can I get help ?? Thank in advance
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
Hi What version of TensorFlow are you using. I think there is a mistake that you have made while labeling. You need to reshape carefully!
@vishaldeepsingh9602
@vishaldeepsingh9602 6 жыл бұрын
thanks for this tutorial it was really helpful. can you tell me how to implement the same on android??
@learndlcodetf5331
@learndlcodetf5331 6 жыл бұрын
Hi, you can follow the steps that I followed in my CIFAR- Android video here -> kzbin.info/www/bejne/jZC0gYx4nruVsJo Instead of Cifar-10 dataset you would be using this dataset
@Donclion911
@Donclion911 6 жыл бұрын
That cat ......lol
@dandybramasta979
@dandybramasta979 4 жыл бұрын
Thank You for uploading this tutorial. It helps me a lot. By the way, I have some problems with my code. When I trained my model the validation accuracy keeps fluctuating, and my validation loss tends to increase, also when I tried to predict a sample image, my model keeps giving me the same output prediction. I have posted my question in stackoverflow too : stackoverflow.com/questions/61570271/python-cnn-image-classification-it-gives-me-always-the-same-prediction could you please help me with it? I appreciate it a lot Thank You
@learndlcodetf5331
@learndlcodetf5331 4 жыл бұрын
Hi there! your model has not learned properly. If you are getting the same output always there are two possible cases: 1) You have not shuffled the dataset. 2) Your dataset is highly imbalanced. How many images you have in each set?
Hello World TensorFlow-Android
27:10
Learn DL Code TF
Рет қаралды 11 М.
Image Classification in Keras with explanation || Easy Way
26:08
Vaishvik Satyam
Рет қаралды 55 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Why Does Diffusion Work Better than Auto-Regression?
20:18
Algorithmic Simplicity
Рет қаралды 422 М.
Build a Deep CNN Image Classifier with ANY Images
1:25:05
Nicholas Renotte
Рет қаралды 656 М.
All Machine Learning algorithms explained in 17 min
16:30
Infinite Codes
Рет қаралды 503 М.
Dogs vs Cats Image Classification (CNN) | Deep Learning | Python
1:01:44
Image Classification Using CNN Keras | Dogs vs Cats Classification
15:32
Lumberjack Studs
Рет қаралды 1,3 М.
Image Classification using CNN Keras | Full implementation
17:56
Learn With Jay
Рет қаралды 198 М.
Image preparation for CNN Image Classifier with Keras
8:42
deeplizard
Рет қаралды 99 М.
I made maps that show time instead of space
10:44
Václav Volhejn
Рет қаралды 1 МЛН
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 1,5 МЛН