DCGAN-on-Anime-Faces
DCGAN-on-Anime-Faces copied to clipboard
Trouble getting this to work with other image sizes
Hey, I tried this out and it works great, but I didn't manage to make it work with images of other sizes and pixel depths so far. Can you tell me how I can do this? Just changing IMG_H and IMG_W didn't work. Thanks in advance, Til
Hopefully, you've managed to solve the problem you've been getting.
If not, here's what I did. It might just solve your problem. I ran the script as-is but with a different dataset. It expected tensor shape of [64, 64, 3] HOWEVER, I had some of the images in RGBa (a for alpha channel) RGBa has 4 channels instead of 3. [64, 64, 4]
I forcefully converted all my images into RGB.
` import PIL.Image from glob import glob from os import path
files = [x for x in glob("./s64/**")] for f in files: rgba_image = PIL.Image.open(f) rgb_image = rgba_image.convert('RGB') save_path = str(f"./rgb64/{path.basename(f)}") rgb_image.save(save_path) `
I forcefully converted all my images into RGB.
` import PIL.Image from glob import glob from os import path
files = [x for x in glob("./s64/**")] for f in files: rgba_image = PIL.Image.open(f) rgb_image = rgba_image.convert('RGB') save_path = str(f"./rgb64/{path.basename(f)}") rgb_image.save(save_path) `
Probably not a good idea, but it worked for me...