velamini
velamini

Reputation: 1

Generate images from a grayscale trained GAN pkl file

I have trained a stylegan using a set of grayscale images, now I am stuck in the generate.py because it is all set for generating RGB images. I get this error:

ValueError: not enough image data

when I changed the generate.py archive from stylegan pytorch from RGB to L :

ValueError: Too many dimensions: 3 > 2.

This is the whole generate.py code: https://github.com/mit-han-lab/data-efficient-gans/blob/master/DiffAugment-stylegan2-pytorch/generate.py

I have searched the internet for hours and tried a lot of stuff but I am pretty new to python so I have run out of ideas of what I need to change in the generate.py to be able to have the images, can somebody please help me?

Upvotes: 0

Views: 566

Answers (1)

Patrick Tinsley
Patrick Tinsley

Reputation: 11

I ran into this problem a lot, too...

Finally found that it had something to do with indexing the img var.

Check lines 137-140 here: https://github.com/pgtinsley/stylegan3/blob/main/gen_images_gray.py

That's for StyleGAN3, but the code/logic should transfer over to SG2 pretty easily.

Best of luck!

Upvotes: 1

Related Questions