Тёмный

Tutorial on CNN implementation for own data set in keras(TF & Theano backend)-part-1 

Anuj shah
Подписаться 8 тыс.
Просмотров 53 тыс.
50% 1

A complete tutorial on using own dataset to train a CNN from scratch in Keras (TF & Theano Backend)-Part-1.
Github: github.com/anujshah1003/own_d...
It explains loading of your own data set, defining and training a CNN model, evaluating and testing the model,Visualizing intermediate output layers,plotting loss and accuracy curve, plotting confusion matrix, Saving and loading weights and trained model.
You can support me on Paypal : paypal.me/anujshah645

Опубликовано:

 

11 май 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 229   
@abhishekdogra3655
@abhishekdogra3655 6 лет назад
This is "THE" Tutorial !! Seriously among the best.
@gudimetlakowshik3617
@gudimetlakowshik3617 6 лет назад
bro...this is one of the most awesome lecture I've ever heard on machine learning and convolution neutral networks.... did a great work... this is helping me alot in projects...
@GunnuBhaiya
@GunnuBhaiya 6 лет назад
best video for learning CNNs as well as Keras! Especially loved the simple and detailed explanation of the image preprocessing part, which many others have ignored.
@anujshah645
@anujshah645 6 лет назад
thanks
@naganandinis816
@naganandinis816 4 года назад
Thanks a looooot Anuj. I wanted to try my own dataset rather than the easily available pre-processed datasets. Your tutorial helped me a lot to do the same. Keep sharing!
@occculto
@occculto 3 года назад
A really good tutorial. I struggled to find a step by step process that allows me to understand. Thanks
@PsRafael84
@PsRafael84 7 лет назад
Great work Anuj Shah! Must say, for begginers, this is THE video tutorial on YT! Keep going!
@anujshah2625
@anujshah2625 7 лет назад
thanks
@PsRafael84
@PsRafael84 7 лет назад
Your next video could be about transfer learning with keras
@anujshah2625
@anujshah2625 7 лет назад
Rafael Ribeiro Paiva yeah I will try
@yashgokhale5238
@yashgokhale5238 7 лет назад
Excellent work Anuj shah
@richasharma1042
@richasharma1042 5 лет назад
This is the tutorial that I'm searching for so long....thank you so much sir...:). Please include data augmentation part in it as well. Thanks.
@mustafavadnagarwala2640
@mustafavadnagarwala2640 6 лет назад
Good & precise explanation. Nice work Anuj.
@suecheng3755
@suecheng3755 6 лет назад
Thanks Anuj! Great job!
@jalendarch89
@jalendarch89 6 лет назад
Excellent.... Thanks a lot Anuj
@hippypopo
@hippypopo 6 лет назад
Cool stuff, implemented following your video, thanks man!
@rohitsethi2085
@rohitsethi2085 6 лет назад
Excellent explanation anuj.... A big thanks to you .... Keep posting the videos like this
@anujshah645
@anujshah645 6 лет назад
+Rohit Sethi thanks
@pranabdas6243
@pranabdas6243 5 лет назад
best explanation on CNN on youtube!!!
@ROHITMAHTO89
@ROHITMAHTO89 6 лет назад
Excellent, very easy to understand. Thanks
@dahoreamit
@dahoreamit 6 лет назад
Thank you very much Anuj.Excellent explanation of code and functions :)
@seyoumdaba4348
@seyoumdaba4348 6 лет назад
Thank you. This is the best explanation.
@anujshah645
@anujshah645 6 лет назад
+John Michael thanks
@soukaynaelkarakhi4011
@soukaynaelkarakhi4011 2 года назад
Thank you a lot. A really good tutorial and vers good explanation Keep sharing anuj !
@rajaplanet
@rajaplanet 4 года назад
really v good, thanks Anuj shah Very helpful
@jhonbetancourt93
@jhonbetancourt93 6 лет назад
me ayudaste mucho, ¡muchas gracias! saludo de colombia
@TalBizi
@TalBizi 6 лет назад
Great explanation. it's so kind of you to share your knowledge that way, and even more to make the effort of explaining it. Thank you. Subscribing.
@anujshah645
@anujshah645 6 лет назад
Thanks. you can watch part-2 also. I explained couple of useful things there
@prafulhambarde8337
@prafulhambarde8337 6 лет назад
Awesome tutorial...............
@prabhasaxena4609
@prabhasaxena4609 4 года назад
Love ur all video....thankuuuu so mch for sharing sch a knowledge video.....please make more videos on different accuracy parameters....u r the best .
@GualterioPulvirenti
@GualterioPulvirenti 6 лет назад
Amazing job Anuj!
@anujshah645
@anujshah645 6 лет назад
Thanks Walter
@anongeorge2504
@anongeorge2504 6 лет назад
Nice work
@udayanbirajdar6530
@udayanbirajdar6530 5 лет назад
Best cnn tutorial 👍👍
@anujshah645
@anujshah645 5 лет назад
thanks
@rainyday7919
@rainyday7919 5 лет назад
Thank you a lot Anuj
@enliveners3743
@enliveners3743 5 лет назад
Nice job Anuj Shah , it worked perfectly and helped me alot for my project .
@anujshah645
@anujshah645 5 лет назад
I am glad it helped
@enliveners3743
@enliveners3743 5 лет назад
I m struggling with issues of dimesions as you have also mentioned that theano and tensorflow both backend works differently for dims , and i m pretty confused also , can your share me any of your video or any other which clear my doubts regarding selecting dimensions.
@anujshah645
@anujshah645 5 лет назад
well the dimensions are explained pretty well in this video, you need to code and see the outputs to comprehend it better, try with both the backends and see how the dimension change
@TKB_videos
@TKB_videos 7 лет назад
Hey Anuj thanks again for another good video. Learnt a lot from you channel :). Specially your initial video on MNIST - Digit recognition tutorial video inspired me to implement my own CNN based Gesture Recognition project. I do have one question regarding input image set. In your video and many other tutorials over net I have noticed that we input only 1 channel image even if image is RGB colored we convert it to GrayScale. This way works fine, but I tried to input 3 channel image and made the required changes in neural net architecture and trained the model. However when I try to visualize the internal layers its not similar to what we get for grayscaled images and image spans across multiple kernels (for 32 kernels) instead of single kernel. I think its due to some stride factor that I have overlooked. But wanted to know if you have tried inputting 3 channel image ever ?
@anujshah645
@anujshah645 7 лет назад
yes many times, it works totally fine. and even with 3-channel input you can visualize the intermediate layers. it gets transformed into depth equal to the number of filters defined in the convolution layer. If you see this video i uploaded earlier : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-N7-lyuhKoz8.html&index=2 In this i am using VGG-16 network which takes RGB input
@husamalfergani7110
@husamalfergani7110 6 лет назад
It is awesome Anju thank you
@anujshah645
@anujshah645 6 лет назад
welcome
@husamalfergani7110
@husamalfergani7110 6 лет назад
Do you have any video about regularization? if not please make one.
@pranitapradhan9652
@pranitapradhan9652 6 лет назад
Very nice tutorial. Thank you once again. There a lot of tutorials for image classification however I am looking for pixel classification. I have doubt regarding the size of labels and image data in case of semantic segmentation using CNN. Will the size of labels be (number of samples, img_row, img_cols, number of classes) to train the mode? Also in case of semantic segmentation, can I use Dense layer or I should use upscale layer? Your help will be highly appreciated. If there is any tutorial for this please post a link. Thank you in advance.
@anaswara9579
@anaswara9579 5 лет назад
Thnkuu so much sir... Very gud lucture
@letaoliu3479
@letaoliu3479 6 лет назад
Hi Anuj, nice video, I encountered an error during visualizing the intermediate output... (np.shape(activations)) = (32,126,126) rather than (32,128,128)... do you know why that happen?
@kartiksareen
@kartiksareen 6 лет назад
what if I have less dataset to train...it would just effect the accuracy or anything else as well
@rezaghoddoosian1
@rezaghoddoosian1 7 лет назад
for the Convolution2D layer the documentation says that the sample axis should not be included in the input_shape, why did you include ?
@user-li4gv5vt1t
@user-li4gv5vt1t 6 лет назад
Thank you for good explain.^^.I have an one Question....Is there a reason that you construct the network that way(In lecture) or other note that you referred??? Thanks.
@anujshah2625
@anujshah2625 6 лет назад
박동훈 no no such reason, just showed one example. You can also use Model API for model construction
@sakifaaktar6781
@sakifaaktar6781 6 лет назад
hi, i got an error, how can i solve this?please help me . AttributeError: 'Activation' object has no attribute 'get_output'
@geetanjalisharma3521
@geetanjalisharma3521 6 лет назад
how to extract feature of each & individual layers in keras??
@rezaghoddoosian1
@rezaghoddoosian1 7 лет назад
Shouldnt expand_dim be at axis 3 instead of 4?
@Ramorin94
@Ramorin94 6 лет назад
I can just train the CNN with images of faces for facial recognition?
@anithjoseph8730
@anithjoseph8730 4 года назад
thank you sir......
@falahobaid7520
@falahobaid7520 6 лет назад
Hi Anuj. I have a model to classify RGB_D video sequence comprises from two branches (models) one it is inputted color images to extracted features from its, and the other depth images and then the outputs of two branches merged and inputted to the third model. If I want to get intermediate layers of the third model. from where I can get on the input layer of that model to use it in this functio def get_featuresmap (model,layer_idx,x_batch): get_activations=k.function([model.layers[0].input, k.learning_phase()],[model.layers[layer_idx].output]) activations=get_activations([x_batch,0]) return activations
@RAZZKIRAN
@RAZZKIRAN 2 года назад
I have uploaded own_dataset folder in google drive, from google drive how to load dataset? please tell how to specify the path
@tathagatdasgupta5298
@tathagatdasgupta5298 6 лет назад
Hey Anuj...your video was quite helpful. Could you tell me how to add an classifier such as an svm to this model by replacing the FC layer...Im workng on ensemble learning and need help
@anujshah645
@anujshah645 6 лет назад
for every image get the output of the second last layer before the softmax layer, this will be the feature vectors for every image. you can save all the feature vectors in a variable for training,then simply use this feature vectors and feed it to a svm
@vikassharma-er2ce
@vikassharma-er2ce 6 лет назад
I am getting "None type object has no attribute to append" while appending input_img_resize, i m novice to python please help
@codenpy5566
@codenpy5566 6 лет назад
Hi Anuj, your are amazing man. I have one question, what if i want to implement it with webcam to recognize in real time and draw label with accuracy score and show in real time also. Thanks
@anujshah645
@anujshah645 6 лет назад
well you can simply run a videocapture code of opencv to read frames from webcam and then feed each frame into tha CNN which will give a output and you can write the output on that particular frame using opencv again
@faheemirfan6598
@faheemirfan6598 6 лет назад
Can you please make video on localization.? is there any built in functions for localization in keras?
@raptor312
@raptor312 6 лет назад
python 2.7.6 Keras 1.2.2 and I get this error while building CNN : model.add(Convolution2D(32, 3,3,border_mode='same',input_shape=input_shape)) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 299, in add layer.create_input_layer(batch_input_shape, input_dtype) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 401, in create_input_layer self(x) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 529, in __call__ self.assert_input_compatibility(x) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 469, in assert_input_compatibility str(K.ndim(x))) ValueError: Input 0 is incompatible with layer convolution2d_6: expected ndim=4, found ndim=3
@raptor312
@raptor312 3 года назад
@Toshiba Kamruzzaman Thanks 😁
@abdkumar1300
@abdkumar1300 6 лет назад
nice work bro
@anujshah645
@anujshah645 6 лет назад
Thanks
@urabanopatayon
@urabanopatayon 5 лет назад
How can this be use to train using GoogleNet and ResNet Architecture?
@jamiewithorne7459
@jamiewithorne7459 4 года назад
Hi, this is a great video! But I'm having issue uploading my own dataset. I have a folder with five sub-folders of data, and when I follow your instructions, it only uploads one of the folders. Any advice would be helpful!
@anujshah645
@anujshah645 4 года назад
Hey usually the practice is not to upload the dataset the GitHub. I did that just so that the code can be tried out and also my dataset was small. On things you can do isntjat upload your dataset to a Google drive or to some server in awe nd give it's link in the GitHub readme
@namagirimallikarjun9535
@namagirimallikarjun9535 6 лет назад
Good Explanation, how to handle text file to extract the data using word2vec?
@amirlasry8426
@amirlasry8426 6 лет назад
Hi, can you explain how to make the output continuous?
@RnFChannelJr
@RnFChannelJr 4 года назад
sir , i got Error when checking input: expected conv2d_32_input to have 4 dimensions, but got array with shape (646, 128, 128), someone can help me ? thakns
@aeli1413
@aeli1413 4 года назад
hello did you figure it out? This is also my problem :(
@epaphraspeter1693
@epaphraspeter1693 4 года назад
great work! please do you have a tutorial on how to fine tune inception v3? (that is transfer learning with inception v3)
@tharindumanoj9838
@tharindumanoj9838 4 года назад
Error when checking target: expected activation_5 to have shape (1,) but got array with shape (2,) I got this error pls help
@vigneshviggs100
@vigneshviggs100 6 лет назад
Anuj shah can I use this code to build a biometric ear recognition model with a dataset having 125 subjects, atleast 5 samples in each?
@anujshah645
@anujshah645 6 лет назад
well you can start with this and see the accuracy and then change parameters to improve over this
@snakegirl4848
@snakegirl4848 6 лет назад
thank you!
@anujshah645
@anujshah645 6 лет назад
+Do it yourself [DIY] welcome
@Gauravkr0071
@Gauravkr0071 4 года назад
anuj bro u are great, your tutorials are timee saving, can u plz make a tutorial on how to make custome keras layer
@bobypardamean7355
@bobypardamean7355 4 года назад
Hai, do you have to resize all the image in your dataset before you go with all that stuff?
@anujshah645
@anujshah645 4 года назад
well the network takes fixed size input so you need to resize all the images before you feed to your network
@freaky504
@freaky504 7 лет назад
Can I use the same approach for recognizing static gesture? I already have my dataset, but could one also test using webcam or video feed?
@anujshah645
@anujshah645 7 лет назад
yes sure you can obviously use
@grmk007
@grmk007 6 лет назад
freaky504 how to crop images and train them
@mirkocrobu403
@mirkocrobu403 7 лет назад
very good work thank you! but i have this error: np.shape(model.layers[0].get_weights()[0]) i just changed channel from 1 to 3, and changet the cnn model with the vgg16 model. Can you help me?
@anujshah645
@anujshah645 7 лет назад
i didn't understand your error, can you be little descriptive
@visheshtanwar1710
@visheshtanwar1710 7 лет назад
Hey Anuj.. Thanks a lot for this wonderful video. Helps me a lot.. I do have a question that do you have video like this to apply LSTM model on video dataset. Actually, I am totally new to coding and facing a problem in that LSTM Model. So, can you please help me out ? Thanks again.
@anujshah645
@anujshah645 7 лет назад
M not so well verse in LSTM now, maybe later i will upload some videos
@visheshtanwar1710
@visheshtanwar1710 7 лет назад
Okay fine.. But, if possible, can you plz suggest me video like this for LSTM?
@rohitsrivastava5527
@rohitsrivastava5527 7 лет назад
Hi Anuj, fist of all thanks to u for making such presentation. as you suggest i followed the same steps train model for 4 classes (cat,dog,horse,rider) & each class having 202 images. i tried so many permutation of convolution,activation,maxpooling, dropout but i could not increase the validation accuracy of model beyond 63%. could you suggest me what all things need to take care to enhance the accuracy of model or suggest useful links. your help would be highly appreciated.
@anujshah645
@anujshah645 7 лет назад
you need a larger dataset first of all, this was just to explain the code, 800 images are very very tiny for a Deep Learning model, if you have small dataset you can try data augmentation, keras has option for that. you can checkout this blog : blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
@erfanebrahimi9748
@erfanebrahimi9748 7 лет назад
Once again thanks for the grat tutorial. One fast question. What shffles from sklearn.cross_validation does is making train and test data, right? When we say test_data we mean our network ahs never seen that data, right? I mean it's not like k-folding in which you for instance break the dataset into 80% training data and 20% validation and do it for instance 5 times and each time assign data to these two sets randomly which mean at the end the network is also trained by the data in the other 20%. Is shuffle like the action of k-folding or is it really hiding those test data? Another question which I have is, what does epoch generally mean in the context of training a network? Lets say we ahve a 20 epoch of batch_zie 200. Does it mean at each epoch only 200 data is used to train the network, or does it mean we forward and back-propagate the whole training data 20 times? (I assume number of epochs as 20.) I really appreciate if you kindly shed light on these two questions and concepts. Once more really two thumbs up!
@erfanebrahimi9748
@erfanebrahimi9748 7 лет назад
Or does epoch mean to forward and backpropagate the same data but 20 times to tune the weights and bias of the filter?
@anujshah645
@anujshah645 7 лет назад
yes test data is kept untouched during training. Its a good practice to shuffle the training data as it introduces randomization of the input the network will see which improves its learning. Its not Like K-Fold. Shuffle is just for shuffling the data, We are using train test split to create test data. YOu can either split the data in the code or the best way is to have two different set of data from before. Epoch means number of iterations or number of time the network is going to see the entire training data set. If we have 20 epoch with 200 batch. It sees the data in chunk of 200 but it see the entire data 20 times.
@anujshah645
@anujshah645 7 лет назад
yes the same and entire training data 20 times to fine tune the weights
@hazoorahmad6339
@hazoorahmad6339 6 лет назад
Great
@srimadhur5559
@srimadhur5559 5 лет назад
bro am getting the below error when running code for getting activations could you please help me with it: c_api.TF_GetCode(self.status.status)) FailedPreconditionError: Error while reading resource variable conv1d_38/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/conv1d_38/bias) [[{{node conv1d_38/BiasAdd/ReadVariableOp}} = ReadVariableOp[dtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv1d_38/bias)]]
@ahmadfitri6035
@ahmadfitri6035 6 лет назад
one question, are data_dir_list and img_list a vector of string or are they a built in function that is used to read the number of file in the directory? cheers
@anujshah645
@anujshah645 6 лет назад
os.listdir() is a built in function for listing all the files or folders in a directory
@ahmadfitri6035
@ahmadfitri6035 6 лет назад
so leave them as it is? is that mean os.listdir() automatically assign the list of files to data_dir_list and img_list
@ahmadfitri6035
@ahmadfitri6035 6 лет назад
and why for label number 2 your data has 202 on it [204:406]. shouldn't it be [204:306]?
@erfanebrahimi9748
@erfanebrahimi9748 7 лет назад
Hi, thanks for your great tutorial. I can say it was the most practical tutorial I've seen regarding IMPLEMENTATION of Keras and Tensorflow. I am using windows 10 pro, python 3.6 and I have installed Tensorflow and Keras by using pip. So I guess they have to bethe latest version. I have downloaded your code and after unzipping everything, executed it to see how it works, but I face the following warning and error. I am absolutely new to python. But it seems some of the methods are depricated. Can you also add what changes we need to apply to your code to solve this problem? Once again thank you for the great tutorial. The error: Warning (from warnings module): File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\cross_validation.py", line 44 "This module will be removed in 0.20.", DeprecationWarning) DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. Using TensorFlow backend. Loaded the images of dataset-data Traceback (most recent call last): File "E:\Apps\own_data_cnn_implementation_keras-master\own_data_cnn_implementation_keras-master\custom_data_cnn.py", line 45, in input_img=cv2.cvtColor(input_img, cv2.COLOR_BGR2GRAY) cv2.error: D:\Build\OpenCV\opencv-3.2.0\modules\imgproc\src\color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
@stony_mellows
@stony_mellows 4 года назад
i am getting this error: code: num_channel=1 num_epoch=20 # Define the number of classes num_classes = 2 img_data_list=[] for dataset in data_dir_list: img_list=os.listdir(data_path+'/'+ dataset) print ('Loaded the images of dataset-'+'{} '.format(dataset)) console: img_data_list=[] for dataset in data_dir_list: File "", line 1 for dataset in data_dir_list: ^ SyntaxError: unexpected EOF while parsing can you tell ,whats the problem?
@HafizAbass
@HafizAbass 7 лет назад
Awesome. thanx for the post. Could you maybe make a tut on Tensorflow serving with Keras sometime?
@anujshah645
@anujshah645 7 лет назад
i didnt get you , Tensorflow serving with keras?
@HafizAbass
@HafizAbass 7 лет назад
Yes. Used for deploying models into production
@asadmahmood9381
@asadmahmood9381 7 лет назад
Can you please tell me if i have a dataset containing labelled data of whether two images are similar or not, how can i train that dataset using cnn. what will be the architecture.
@anujshah645
@anujshah645 7 лет назад
you can try multimodal approach containing two CNNs.
@dkishore599
@dkishore599 4 года назад
why do we use 32 filters always ( odel.add(Conv2D(32, (3,3)) ???? , why should use 32 only at initial Layer ????
@enriqueibarra9851
@enriqueibarra9851 6 лет назад
this can work to achive super resolution on images? i mean modifying the code
@anujshah645
@anujshah645 6 лет назад
I haven't explored that yet,
@ahmadfitri6035
@ahmadfitri6035 6 лет назад
i use spyder to create the program but i cannot import cv2 and i also cant install opencv on the environment i used on my anaconda navigator. please help
@guit-ar-peggios7114
@guit-ar-peggios7114 6 лет назад
Ahmad Fitri Anaconda 's base(root) environment is in the user directory due to that Anaconda should be installed in the user directory. Reinstall conda and then install the necessary packages again.
@sokhibtukhtaev9693
@sokhibtukhtaev9693 6 лет назад
I WILL SAY ONE THING: YOUR CHANNEL IS WORTH SUBSCRIBING
@jennyvega7414
@jennyvega7414 6 лет назад
How did you pass the data folder for images? All the images in only one folder? Thank you!!
@anujshah645
@anujshah645 6 лет назад
different classes of images are in different folders, if you see the part 2 i have explained the code by implementing: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-NUuMg5m42-g.html
@madymnm
@madymnm Год назад
Good tutorial. How can I connect with you for some advice on my CNN project
@harineesubramanian9539
@harineesubramanian9539 6 лет назад
Hello sir! While running this code, we are getting a value error: x and y must have same first dimension, but have shapes (20,) and (2,). Kindly help us!
@jagadeeshn7449
@jagadeeshn7449 6 лет назад
Harinee Subramanian even I am facing same error...did you found any solution??if yes can you suggest me wt to change?? Thank you..
@ramrajitsrm333
@ramrajitsrm333 6 лет назад
sir, thanks for the video. I am working in NLP. My CNN model is following the structure as ['main_input', 'embedding_1', 'sequential_1', 'sequential_2', 'sequential_3', 'sequential_4', 'merge_1', 'dense_1', 'dropout_5', 'batch_normalization_5', 'dense_2', 'dropout_6', 'batch_normalization_6', 'dense_3', 'dropout_7', 'batch_normalization_7', 'dense_4'] I want to get the output of 'batch_normalization_7' layer i trainned the model. now after training when i followed your procedure. def getfeaturemaps(model,layer_idx,X_batch): get_activations=K.function([model.layers[0].input,K.learning_phase()],model.layers[layer_idx].output,) activation = get_activations([X_batch,0]) return activation Exception is coming ResourceExhaustedError: OOM when allocating tensor with shape[82080,1,100,256] [[Node: sequential_1/conv1d_1/convolution/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](sequential_1/conv1d_1/convolution/ExpandDims, sequential_1/conv1d_1/convolution/ExpandDims_1)]]
@testingmnmg517
@testingmnmg517 5 лет назад
Hey Anuj...your video was quite helpful... but when i run your code "hist = model.fit(X_train, y_train, batch_size=16, nb_epoch=num_epoch, verbose=1, validation_data=(X_test, y_test))" i get an error as .. Error: ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (646, 128, 128).. Please Help..
@anujshah645
@anujshah645 5 лет назад
Hi, just check the shape of x_train , if you are using tensorflow and great images its shape should be 646,128,128,1 in your case the last dimension is not there, you can use the function x_train = np.expand_dims(x_train,axis=3)
@mariumhayat8663
@mariumhayat8663 5 лет назад
@@anujshah645 where should i insert this line?i have placed it after dataset spliting but it stilll gives the error ?kindly help!TIA
@alexbc8688
@alexbc8688 4 года назад
@@anujshah645 It doesn't run
@dkishore599
@dkishore599 4 года назад
why do we take test image path like : test_image = cv2.imread('data/Humans/rider-8.jpg')to Predict . i have taken my own file path to test_image = cv2.imread('data/riders123.jpg')- it is not Predicting right Value , why ? what will be the error....??????
@TheExpression638
@TheExpression638 7 лет назад
Hi..I want to use only keras with theano in your code. How to disable tensorflow?(I havent installed it).
@anujshah645
@anujshah645 7 лет назад
There are two ways to do that 1. include this at top of your code script - os.environ['KERAS_BACKEND']='theano' 2. Go to your home directory and look for keras.json directory , inside that open keras.json file and change the backend to theano
@TheExpression638
@TheExpression638 7 лет назад
Anuj shah thanks a lot
@tictac5896
@tictac5896 5 лет назад
Very helpful . however i've some queries. How will u design bounding box? the certain object should be detected using a bounding box (if we want make your coding in real time apps.) and the box should slide over the entire image.
@anujshah645
@anujshah645 5 лет назад
This example was for classification problem. What you are talking comes under detection problem, for that you have to create ground truth with bounding boxes. You can look for tutorial online for creating your custom object detector with tensorflow object detection API. You will get the idea of how it's done. Good Luck
@tictac5896
@tictac5896 5 лет назад
@@anujshah645 Thanks for your informative response. Can you suggest some sites / algorithms to study about it? Thanks again for your time.
@dexterslab7750
@dexterslab7750 6 лет назад
i have 25 different classes of images is there any change in convolution layer?
@anujshah645
@anujshah645 6 лет назад
It should work. However its better you try and experiment yourself
@sushanthkapisthalam2411
@sushanthkapisthalam2411 5 лет назад
Hi deepak umrekar, Did it work? even have 25 classes in my data set. please suggest if it worked for you.
@nikhilkenvetil1594
@nikhilkenvetil1594 5 лет назад
At 2:56, shouldn't it be `from sklearn.model_selection import train_test_split`?
@anujshah645
@anujshah645 5 лет назад
You are right , nowadays it's this way but when I was working, that way worked
@nikhilkenvetil1594
@nikhilkenvetil1594 5 лет назад
@@anujshah645 Ok. Got it. Thanks. Great video BTW
@brendachirata2283
@brendachirata2283 5 лет назад
Hello there. You have the best tutorials ever. You explain why every step is as it is. Thank you. I have a problem trough. I ran your code with this dataset with keras 2(backend TF) and i am getting an error on training. error: "Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s), but instead got the following list of 658 arrays: [array([[[255, 255, 255]"
@anujshah645
@anujshah645 5 лет назад
I guess you are doing some mistake in your code , can you just screenshot your code and paste it
@fizamukhtar3442
@fizamukhtar3442 4 года назад
helpful
@Hiiii138
@Hiiii138 3 года назад
Sir if i keep all the images in a single folder then it shows an error of shape mismatch..how to fix it?..please reply
@anujshah645
@anujshah645 3 года назад
Keeping image in a folder has nothing to do. Check how it is read and what is the shape of the array after images are read
@rahuldraj
@rahuldraj 6 лет назад
will the same code work without modification in keras 2?
@anujshah645
@anujshah645 6 лет назад
+Rahul Raj some modifications may be required but not much
@dkishore599
@dkishore599 4 года назад
how do we decide img_row, img_cols values? can we mention any values ? ???
@anujshah645
@anujshah645 4 года назад
Its a hyper parameter. In various convolution neural net architecture people have used various sizes eg 224x224x3, 368,368x3, etc.But that's upto you and your problem
@davidjones-wq2sw
@davidjones-wq2sw 7 лет назад
Great video. If there are 808 images i.e., 202 per class why are they split up into labels like this: labels[0:102]=0 labels[102:204]=1 labels[204:606]=2 labels[606:]=3 This says 102 for class 1, 102 for class 2, 202 for class 3 and 202 for class 3??
@anujshah645
@anujshah645 7 лет назад
yes you are right, we need to assign label to each class
@davidjones-wq2sw
@davidjones-wq2sw 7 лет назад
Ok so what do you make the new assign code snippet correction?
@darshandesai496
@darshandesai496 5 лет назад
I want to deploy your model on Android. I tried converting it in Tflite format. Buhh the app crashes when I capture image to identify the image. Can you send me code for conversion of model into Tflite?
@anujshah645
@anujshah645 5 лет назад
Well I haven't tried conversion
@darshandesai496
@darshandesai496 5 лет назад
Can you provide links? And tell me how it will work ur code. Or can you send me ur email id so that I can send you the customized code which I have done. And you can provide with a convertercode.
@shanerooney7288
@shanerooney7288 5 лет назад
00:00 = Intro 01:30 = overview of the entire lesson 02:40 = Loading and Prepocessing the Dataset 13:43 = Building the CNN model 17:03 = Training time 19:38 = Ploting the loss and accuracy curve 24:15 = Visualizing the intermediate layer output of CNN 28:47 = Plotting the confusion matrix for your result 31:01 = Saving and Loading the trained weights and model 33:27 = Wrapping up 34:23 = Thank you
@anujshah645
@anujshah645 5 лет назад
thank you for doing it,
@shanerooney7288
@shanerooney7288 5 лет назад
@@anujshah645 , Thanks for the tutorial. I have a question for how to make the bottleneck for VAE. We need to compare the mean distribution and standard deviation at the same time. I don't know how to do that. :(
@801saurabh
@801saurabh 6 лет назад
Hello Anuj, what is the purpose of normalisation???
@anujshah645
@anujshah645 6 лет назад
we need to normalize our features so that our features are within one specific range, if that is done the network learns better and converges nicely. you can have a look at this notes for better understanding-cs231n.github.io/neural-networks-2/
@supriyanaik316
@supriyanaik316 3 года назад
Sir can we do same things using matlab coding??
@anujshah645
@anujshah645 3 года назад
yes same can be done. However I don't work in Mtalp
@vishnukeerthi5024
@vishnukeerthi5024 3 года назад
Sir is this model is working for real time camera to detect and classify the objects .I really like your way of explanation 😎😎 u r really really awesome keep teach us like this ❤️❤️
@anujshah645
@anujshah645 3 года назад
This is just a mock model . You can use some other model like vgg or Resnet
@vishnukeerthi5024
@vishnukeerthi5024 3 года назад
@@anujshah645 ohh where do I find that models many of the codes did not work correctly
@MohammadFarhadBulbul
@MohammadFarhadBulbul 5 лет назад
I have got the following error: File "C:\Users\user\Downloads\own_data_cnn_implementation_keras-master\own_data_cnn_implementation_keras-master\updated_custom_data_cnn.py", line 46, in label = labels_name[dataset] KeyError: 'data'
@anujshah645
@anujshah645 5 лет назад
I cannot understand the error, you have more information
@geetanjalisharma3521
@geetanjalisharma3521 6 лет назад
how you have taken the dataset in this video. i think its a numpy array ...
@anujshah645
@anujshah645 6 лет назад
yes the frame are read as array
@kunaldas5009
@kunaldas5009 3 года назад
Sir , could you please tell me how to split a image by n number(user input) without any Inbuild function.
@anujshah645
@anujshah645 3 года назад
split a image? sorry I didn't get your question
@kunaldas5009
@kunaldas5009 3 года назад
I mean sir , divide into pieces . Like one image 4 pieces . What should I need to learn. Sorry for my English.😅
@anujshah645
@anujshah645 3 года назад
@@kunaldas5009 you can crop it . you can use inspiration from here - www.pyimagesearch.com/2014/01/20/basic-image-manipulations-in-python-and-opencv-resizing-scaling-rotating-and-cropping/
Далее
How Many Balloons Does It Take To Fly?
00:18
Просмотров 28 млн
Feeding your own data set into the CNN model in Keras
26:15
TensorFlow Tutorial #02 Convolutional Neural Network
36:20
Build a Deep CNN Image Classifier with ANY Images
1:25:05