skyflynil / stylegan2

StyleGAN2 - Official TensorFlow Implementation with practical improvements
http://arxiv.org/abs/1912.04958
Other
120 stars 33 forks source link

Projection of non-square images #29

Closed Anas-Khayata closed 3 years ago

Anas-Khayata commented 3 years ago

Many thanks @skyflynil for sharing such an amazing work. I would like to ask you if you have a working version of projector.py file for non-square images.

projector.py throwing exception for reshape operation at line: 122 if the model is trained for non-square images

When I have commented the lines: 122-123

v = tf.reshape(v, [1, 1, sz//2, 2, sz//2, 2]) # Downscale

v = tf.reduce_mean(v, axis=[3, 5])

it worked but gave wrong results.

Any suggestion for how to set a correct numbers in: v = tf.reshape(v, [1, 1, sz//2, 2, sz//2, 2]) # Downscale Thanks

Anas-Khayata commented 3 years ago

I fixed the issue in projector.py to accept non-square images: the solution is very simple :) just divide v[3], v[2] and set the value instead of 2 in reshape command