Python Colab doesn't save cycleGAN images correctly

  • Thread starter Thread starter BRN
  • Start date Start date
  • Tags Tags
    Images
AI Thread Summary
The discussion centers on a user experiencing issues with their cycleGAN model implementation, where it works correctly on a university PC but saves empty PNG files when run on Google Colab. The user shares their image-saving code, which involves generating images from a dataset and saving them after re-scaling. Other participants suggest checking if the necessary modules are updated and emphasize the importance of ensuring files are saved in the correct directory on Colab, as the platform can be sensitive to file paths. The conversation encourages troubleshooting by considering differences between the two environments.
BRN
Messages
107
Reaction score
10
Hi everyone,
I made an implementation of the cycleGAN model but I find a strange problem.
If I run the model with a PC supplied to the university it works, while on Colab, it saves me empty PNG files. Consider that I use a standard GPU on Colab.

This is my code to save the generated images

[CODE lang="python" title="save generated function"]
def save_generated(image_ds, label, generator_model, outputs_path):
i = 1
for img in image_ds:
generated = generator_model(img, training = False)[0].numpy()

generated = (generated * 127.5 + 127.5).astype(np.uint8) # re-scale
im = Image.fromarray(generated)
im.save(f'{outputs_path}{str(label)}_fake_image_{str(i)}.png')
i += 1 [/CODE]

Some idea?

Thank you.
 
Last edited by a moderator:
Technology news on Phys.org
Are you using Google Colab? Are you sure the modules are updated? Google Colab is touchy with where files are saved. Make sure it's in the proper folder. Keep thinking of ways the two environments could be different and make the adjustments.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top