Get desired output from convolution (GAN)

145 views Asked by At

I'm trying to code a GAN model for cifar10. But I have a problem.

How to get the desired ouput (3x32x32) from a convolutional network ? I actually inspire my model from one I found for the mnist :

model = Sequential()
model.add(Dense(input_dim=100, output_dim=1024))
model.add(Activation('tanh'))
model.add(Dense(128*7*7))
model.add(BatchNormalization())
model.add(Activation('tanh'))
model.add(Reshape((128, 7, 7), input_shape=(128*7*7,)))
model.add(UpSampling2D(size=(2, 2)))
model.add(Convolution2D(64, 5, 5, border_mode='same'))
model.add(Activation('tanh'))
model.add(UpSampling2D(size=(2, 2)))
model.add(Convolution2D(3, 5, 5, border_mode='same'))

So, from there, I have an output of 3x28x28 Do you know how I can get 3x32x32 ? Thanks!

1

There are 1 answers

1
Thomas Pinetz On BEST ANSWER

You can either do PaddingLayers (https://keras.io/layers/convolutional/#zeropadding2d) and then apply convolutions to acquire a sensible output or do another Upsampling and then apply continous Convolutions with border_mode='valid' to acquire the corect output size. You can do the convolutions earlier so you do not need as many.