GPU bench-marking with image classification | Deep Learning Tutorial 17 (Tensorflow2.0, Python)
Вставка
- Опубліковано 19 чер 2024
- This video shows performance comparison of using a CPU vs NVIDIA TITAN RTX GPU for deep learning. We are using 60000 small images for classification. These images can be classified in one of the 10 categories below,
classes = ["airplane","automobile","bird","cat","deer","dog","frog","horse","ship","truck"]
Here is the dataset link: www.cs.toronto.edu/~kriz/cifa...
We will use simple artificial neural network (we are not using CNN, usually CNN is preferred for image classification but since we have not covered that in our deep learning playlist so far we will be happy with simple ANN that still gives pretty high accuracy).
#gpuperformance #gpuperformancetest #GPUbenchmarking #imageclassification #DeepLearningTutorial #deeplearning
Code link: github.com/codebasics/deep-le...
Exercise: github.com/codebasics/deep-le...
Do you want to learn technology from me? Check codebasics.io/ for my affordable video courses.
CUDA,cuDNN installation instructions: shawnhymel.com/1961/how-to-in...
Next video: • Customer churn predict...
Previous video: • Tensorboard Introducti...
Deep learning playlist: • Deep Learning With Ten...
Machine learning playlist : ua-cam.com/users/playlist?list...
Prerequisites for this series:
1: Python tutorials (first 16 videos): ua-cam.com/users/playlist?list...
2: Pandas tutorials(first 8 videos): • Pandas Tutorial (Data ...
3: Machine learning playlist (first 16 videos): ua-cam.com/users/playlist?list...
Website: codebasics.io/
Facebook: / codebasicshub
Twitter: / codebasicshub
Do you want to learn technology from me? Check codebasics.io/ for my affordable video courses.
You are doing a tremendous job. Thanks for the video
Nice presentations and teaching. Thank you.
Awesome stuff!
👍😊
Thanks sir for ur tremendeous efforts , I am blessed for finding ur channel
I have Macbook Air M1 and I was surprised to know that for a single epoch run on 50000 image training datasets, The difference time between CPU and GPU was just 6 secs. While for 10 epochs, GPU time consumption was 3 min 19 secs and CPU time consumption was 4 min 19 secs
The article solved my problem, of including GPU device.
Amazing...superb content. Nice explained
Glad it was helpful!
Sir loving the deep learning series...Please don't discontinue this series.
i am continuing it and you will see more videos coming in
@@codebasics Thanks sir. Sir I have an Intel GPU and everyone says CUDA wouldn't be compatible with anything other than Nvidia GPUs. What should I do sir? What GPU toolkit should I install?
@@rishavbhattacharjee7182 what did u do then ? did u get any solution for it
@@lakshsinghania Had to get an NVIDIA GPU. Thats the only solution I found
@@rishavbhattacharjee7182 f 🥲😭😭
You are amazing your video is so simple and easy to understand, really gone through every video and that is better by better every day i learn.
i never got bored nothing hat's off to youuuuuuuu😀😀 And yes LOVE from NEPAL
Rohan thanks for your kind words of appreciation :)
Really Amazing 😍😍😍. Although I don't have GPU but somehow I managed to do by kaggle kernel.🙏🙏💓
could u pls brief on kaggle kernel? does it provide some gpu memory/space ? for running deep learning programs
Gifted Trainer, thank you for the videos
Thank you very much my dear sir. I could able to sort out my problem.
Thank you very much.
thank you so much.
Awesome video sir. Can you please put videos on data hiding and detecting with code.
Amazing video. I tried the scenario on my integrated nvidia quadro m1000m, the difference wasn't much (~ 25 seconds better). I guess we need a dedicated/external card!
But, I too obtained a lower evaluate accuracy of 0.5539. That means the model is biased/overfitting! How can we optimize it !? Any pointers. Thank you.
You can try with CNN also, else you can go for hyper parameter tuning and early stopping to stop over training
Hi sir, can u suggest on opting btwn AWS and Salesforce as a career.......
Nice
very informative
Glad it was helpful!
Sir can you make a C++ Tutorial? I would learn faster with your teaching style.
Thanks
Sure. I will add to my Todo list. My Todo list is growing very fast 😊
Hello , great tutorial , thanks. When should we one hot encode the values ? Is there any rule reg this?
When we have categorical variables in dataset, use one hot encoding.
great
I do all ML programming on Kaggle only, do I need to try on my local as well?
Sir, I want to know will there be any PyTorch video classification tutorial?
In the 6th video in this series, he said he'll focus on Keras over Tensorflow, since that's the goal of this series. Up to this day, being 41 videos in this series so far, he hasn't mentioned anything else regarding PyTorch.
All my personal laptops are macbooks and work laptop is macbook too. How do i get CUDA for MacOS to be able to try this out?
Please make a video how to install Nvidia drivers and cuda ...
How to decide number of hidden layers and number of nodes? Are there any parameters or we can just keep random number?
Read this insightful answer (first one). There are general guidelines but no fixed rules. For hidden layer you would keep number of neurons as inbetween neurons in input layer and output layer. There on you can tweak it using trial and error: stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw
Could you make a video on how to add your own custom datasets?
It depends on what kind of data you'll load. What is it? Images, Databases, Excel spreadsheet... That way it'll be faster for others to help you out.
Please make video on how to install all necessary software/Library to use gpu for deep learning in jupyter notebook
sir why did you one hot encoded the labels? or I can also use the same discrete labels and use sparse categorical crossentropy?
same question, have u figured out the answer?
no
Hey if you are not having GPU you can use google colab GPU.
Thank you! Could you compile this test without flattening the input or categorizing the y?
I used kaggle's GPU,
if compared with CPU computation time against GPU,
the difference is wayyyyy significant.
how to run GPU in details? I installed Nvidia cuda but I don't know which cuDNN is suitable there are runtime and developer liberary
Hello sir
Thank you so much for the video
But i am facing an error while testing with gpu
Failed copying input tensor from ....CPU/0 to ....GPU/0 in prder to run _EagerConst: Dst tensor is not initialized.
I have an error that keras has no attribute sequential. How do I solve this error?
Great video, the pitty is that i have a rx580, is there any way to use my card ? thanks in advance
You can, explore AMD options and install necessary drivers. TF auto picks up in case of Nvidia Cuda, you will have to check how it would behave against AMD.
Sir, one class for Exploratory Data Analysis. Please..
sure. I have covered EDA in my pandas tutorials series. Also in my machine learning projects, please watch those.
Why do we need to use one hot encoding in this tutorial? Our output is already mapped from 0 to 9 right?
i have the same question, if you know, can you please tell me why?
@@NitinKumar-wm2dg i have the same question, if you know, can you please tell me why?
Sir I have AMD Radeaon GPU supports open CL so how can i download this?
Sir 50 epochs is giving me an accuracy of 0.1 and a loss of 2.3 , for me 35 epoch were fine bur i guess model underfits
Hi, I have amd graphic card and cuda only support nvidia gpu's what can ı do?
why one hot encoding of Target Variable??? why not use the same output data as it is ?
if representing your target classes with the numbers 1, 2, and 3, the model may interpret class 2 as being "in between" classes 1 and 3, rather than being a distinct class. This can lead to incorrect predictions and poor performance on the classification task.
@@tsai301103 why dont he use it for handwritten digits classification (mnist) on tutorial 7
Can someone tell me what is the name of the model in which this project is working?
sir, already you use the flatten function in model building then again why you use the x_train_scled
Because the Flatten parameter belongs to the model definition, and so it does NOTHING to X_train_scaled. Therefore you must use it anyways, as input to your model.
may be you should increase the font size of code.
On my laptop the list_physical_devices() found an additional device: '/XLA_CPU:0' but it could not be used with the model
It can but will take more time as demonstrated
I just have one quesiton, why are we doing hot label encoding when we have our y_train in the number itself?
thats what my doubt lies in, even for the digits classification we had categorical values why didnt we do OHE for that ?
why do we need one hot encoded output values?
have u figure out the answer?
Hi Dhaval, I don't have GPU but still mt code is running tf.device('/GPU:0'): May i know the reason? Please....
probably integrated GPU
Sir my GPU and CPU time are comming same, it is happening because my GPU is not strong
Why didn't we need to OHE the MNIST database?
if any one using tensorflow recent versions like 2.16.1, When converting y vars to categorical you dont need to specify dtype which means you can simply do this y_train_categorical = keras.utils.to_categorical(y_train,num_classes=10)
Dhawal sir iska kya krna h GPU test pe :
Failed copying input tensor from /job:localhost/replica:0/task:0/device:CPU:0 to /job:localhost/replica:0/task:0/device:GPU:0 in order to run _EagerConst: Dst tensor is not initialized
wwhy tf.config.experimental.list_physical_devices() dont have gpu?
Total no. of X_train is 50000, but while compiling the model why it is showing 1563 samples? Can someone clarify ???
Keep in mind that in this video, the parameter "batch_size" of "model.fit()" was NOT used. If you go to Keras oficial documentation, on the parameter "batch_size" description, you'll see that "If unspecified, batch_size will default to 32" (keep this 32 in mind). The number you mention corresponds to some hyperparameter called "number of batches", and is calculated by dividing: total number of samples / batch size. If you replace everything, you'll get: 50000 / 32 = 1562.5, which is approximately that 1563 you saw. Hope it helped.
Source: keras.io/api/models/model_training_apis/
In my code fit() shows 96% accuracy and loss 0.1, but in evaluate it is very different, accuracy = 53% and loss = 3. Can someone please explain what am I doing wrong?
You're not doing anything wrong, you actually get those results if you followed this tutorial. Remember that when your model is training, it is passing the whole dataset as much times as there are epochs (if you set epochs=50, then it means it will pass the whole dataset 50 times)... And so eventually it will "memorize" the dataset (which generates that 96% accuracy, which might look "good" at first sight)... But you DO NOT want your model to "memorize training data", since as you could witness yourself, when your model "sees new data" (a.k.a. test set), it will fail one sample after another, and generate awful real results, just as you have got: 53%. This effect is called "overfitting", and so, you could search in the web "how to reduce overfitting in neural networks", so you know what are your options to achieve better results. Plus, I also suggest searching "Accuracy Trap", so you also find out as to why a high accuracy, might keep meaning "(hidden) bad results". Cheers.
Hi , can you please do a video on which optimizer and loss functions to choose for building the model.
Thanks
Hello, by own experience, the question you've asked would be enough to complete a whole series of videos... Have you tried checking Keras documentation?
Optimizers: keras.io/api/optimizers/
Loss functions: keras.io/api/losses/
how to run a deep learning model on GPU
Radeon (TM) R7 M445
Discrete/Hybrid
it would be great help...if you provide a solution for this.
If you have tensorflow2.0 installed, by default it will use GPU. you dont need to do anything special. just use this and make sure it shows GPU in the list of available devices:
tf.config.experimental.list_physical_devices()
@@codebasics okay thank you very much sir 🙏🏻
Accuracy was very low 54% , you smartly hide it , it would be better if you could tell us some ways to inrease accuracy of the model
Even now, getting GPU to work is very difficult and are still not stable :'(
what if you dont have an Nvidia GPU, but you have an AMD GPU?
I am getting accuracy less then 1% , can somebody help what is wrong ?
Increase hidden layers and explore loss options
Do Data standardization
I ran it. This is the output:
Hidden Layer CPU GPU
1 30.9 Sec 21.1 Sec
5 2 Min 58 Sec 21.3 Sec
Surprisingly for 1 Epoch CPU and GPU not much difference also, For GPU 1 Vs 5 Epochs not much difference.
You are doing a tremendous job. Thanks for the video