DCGAN-on-Anime-Faces icon indicating copy to clipboard operation
DCGAN-on-Anime-Faces copied to clipboard

Trouble getting this to work with other image sizes

Open Til-Weimann opened this issue 3 years ago • 2 comments

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

Til-Weimann avatar Mar 27 '21 14:03 Til-Weimann

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) `

dreamsproxy avatar Jun 24 '22 09:06 dreamsproxy

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...

dreamsproxy avatar Jun 24 '22 09:06 dreamsproxy