moein-shariatnia / Deep-Learning

In-depth tutorials on deep learning. The first one is about image colorization using GANs (Generative Adversarial Nets).
MIT License
152 stars 51 forks source link

The code takes 4h foe each epoch in google colab. #3

Closed damorosodaragona closed 3 years ago

damorosodaragona commented 3 years ago

Hi, i'm trying to run your code but in google colab the time needed for each epoch si about 4h: image

I also downloaded the notebook and run it on my local machine with cuda and GTX 1050 and the time needed is about 30min for every epoch.

Do you have an idea why this happens? It seems should be necessary only 3-4min for every epoch.

EDIT: I forgot to change the runtime type to colab, now it takes about 10min, however i cant't understand why on my lapton takes 30-40min.

moein-shariatnia commented 3 years ago

Hey @damorosodaragona ,

Good that your problem is resolved; I was just writing you about changing the runtime to GPU that I saw you edited your post.

About the issue regarding your laptop, I should admit that I'm not an expert in GPUs but after a quick looking up your GPU specs vs Tesla K80 which Colab offers, I think it is not that unexpected that it takes too long on your laptop and not on Colab. I think K80 GPU is a better fit for deep learning rather than 1050; although I could be totally wrong.

damorosodaragona commented 3 years ago

Thaks @moein-shariatnia .

I have couple of "stupid" questions more:

a) in the colab notebook is written that we are using 8000 images for the training of the model and in the following images

image

this is explained very well.

But if we are using 8000 samples why the train_model function iterates over only 500 images?

image

b) the output that we visualize every 200 iteration is composed by:

image

moein-shariatnia commented 3 years ago

It is alright!

a) That number, 500, shows the number of batches. Each batch is composed of 16 images and 16 * 500 will be 8000 which is the number of training images

b) Yes, the interpretation is right. Fake images denote the colored images which the model predicts and real images are the colorful target images that we wish the model learns to predict. I used the terms fake vs real from the GAN literature which denotes the images predicted by the generator and the real-world data respectively.

I hope this helps.

I'll close the issue then.