alecGraves / cyclegan_keras

cyclegan reimplimented in keras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Look at your test results

middlexu opened this issue · comments

It doesn't look good. The pictures are all dark.
why it doesn't work?

GANs often have stability issues, and this little demo setup is no exception! I had to play with quite a few parameters to get even the results that I did. I have found that if the learning rate is too high, the models completely fail, and you can get a black image problem.

It may also help to modify how the images are pre-processed. I believe I just left the mean of the input data at whatever it naturally is. If you modify the input data's distribution to [-1, 1], this could also help the models overcome the dark image problem:

images = images.astype(keras.backend.floatx())

# divide by the largest uint8 value, setting the distribution to [0, 2]
images *= 2/255

# shift the distribution to [-1, 1]
images -= 1 

and to reset the data to uint8 for viewing:

# shift the distribution to [0, 2]
images += 1

# shift the distribution back to [0, 255]
images *= 255/2 # restore to uint8
images[images < 0] = 0
images[images > 255] = 255

images = np.uint8(images)