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...
hi; i purchased 3 of these, AZDelivery 3 x AZ-MEGA2560-Board Bundle with Prototype Shield and each is reporting the error message below. I have triple checked every aspect of the set up and all seems in order, cable devices port, board reburn bootloader et al . I have substituted an arduino uno and it works fine; could you help please Thanks Martyn 'avrdude: ser_open(): can't set com-state for "\\.\COM3"avrdude: ser_drain(): read error: The handle is invalid.avrdude: ser_send(): write...
Back
Top