I am using Colab for training my GAN network. The training session can be completed correctly, but even if I show a directory folder name, I cannot see any file or folder for output images which are generated in Colab. How can I see these output images in my google drive or where these image files are stored?
Asked
Active
Viewed 981 times
0

Christopher Bradshaw
- 2,615
- 4
- 24
- 38

can uzun
- 1
- 2
-
Have your checked [this](https://stackoverflow.com/questions/49031798/when-i-use-google-colaboratory-how-to-save-image-weights-in-my-google-drive)? – Cheche Nov 10 '18 at 13:58
-
Yes, I checked that one but I can not understand what is happening there. I tried the steps in that link but I cannot get any result. Actually when I run my code in pycharm and show the file directory, it is directly saving the images in that directory, but in colab things are confusing. I can read from a file in drive but I cannot save a file to drive from colab. – can uzun Nov 10 '18 at 14:01
-
Also google [docs](https://colab.research.google.com/notebooks/io.ipynb#scrollTo=bRFyEsdfBxJ9) explain how to download. Can you please upload your code to help you better? – Cheche Nov 10 '18 at 14:04
-
I am looking that google docs now. thanks. I shared the code above. Image.fromarray(image.astype(np.uint8)).save(image_path+"%03d.png" %(epoch)) in this code block I save the images giving the path but I think it is not the method to see the files in colab. – can uzun Nov 10 '18 at 14:10
1 Answers
0
I know several ways. The easiest one is a follows:
- Mount Google Drive locally:
from google.colab import drive
drive.mount('/content/gdrive')
- Define the path to store your data, e.g.:
generator_cb = ImageGridCallback("output/gan_convolutional/epoch-{:03d}.png",
generator_sampler(latent_dim, generator))
,
- Click the horizontal arrow in the top right of the collab docs page and choose the tab "File" as in the picture. Then you can easy download the output.

SvitlanaGA...supportsUkraine
- 1,289
- 1
- 11
- 23