zsdonghao / Unsup-Im2Im

Unsupervised Image to Image Translation with Generative Adversarial Networks
https://github.com/zsdonghao/tensorlayer
73 stars 16 forks source link

Is the output image size of 256 x 256 an option – or is just 64 x 64 px possible? #9

Open subzerofun opened 7 years ago

subzerofun commented 7 years ago

Hey it's me again, browsing through your other repos i found this gem – seems fun! A few months ago i've tested another gender swap network written in TF, but the output resolution was hardcoded and i couldn't figure out how to change it (with my limited knowledge of TF). Your version again seems a lot easier to read – due to the usage of the Tensorlayer library?

I'm using the celebA dataset and have left all thetf.flags by default. So the default image size is 64 x 64px but i've seen that you've also written quite a few lines in train.py and model.py for a 256 x 256px option.

if FLAGS.image_size == 64:
    generator = model.generator
    discriminator = model.discriminator
    imageEncoder = model.imageEncoder
# elif FLAGS.image_size == 256:
#     generator = model.generator_256
#     discriminator = model.discriminator_256
#     imageEncoder = model.imageEncoder_256
else:
    raise Exception("image_size should be 64 or 256")
################## 256x256x3
def generator_256(inputs, is_train=True, reuse=False):
(...)
def discriminator_256(inputs, is_train=True, reuse=False):
(...)

Since the second if-statement (elif FLAGS.image_size == 256:) is commented out and never changes the default 64x64px model generator and encoder, setting flags.DEFINE_integer("image_size", ...) in train.py to 256 doesn't really change the size - is this correct?

I've tried to uncomment the code and enable the elif line but then ran into this error: ValueError: Shapes (64, 64, 64, 256) and (64, 32, 32, 256) are not compatible

You've added generator_256, discriminator_256 and imageEncoder_256 to model.py so i'm wondering if you just have just experimented with this image size and then discarded the option (and just left the 64x64 image_size option) or if i'm missing something here...

There is also a commented out flag for output_size – but this variable doesn't show up anywhere else so i guess it's from a previous version of your code: # flags.DEFINE_integer("output_size", 64, "The size of the output images to produce [64]")

And this one is also non-functional: # flags.DEFINE_integer("train_size", np.inf, "The size of train images [np.inf]")


I just wondered if it's possible to crank up the training and output resolution to 256x256px (and maybe finish the training process this year – when i get my 1080 Ti 😎).

Will try to finish the 64x64px first and save the model-.npz files for later, but it would be interesting to know if the mentioned portions of your code are still functional.

Thanks!

polar99 commented 6 years ago

@subzerofun Hello! Did you solve this problem? ValueError: Shapes (64, 64, 64, 256) and (64, 32, 32, 256) are not compatible