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.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top