Ich versuche, die Deconvolution2D von Keras mit Tensorflow-Backend zu verwenden.Dekonvolution unter Keras Probleme
Aber ich habe ein paar Probleme. Zuerst wird in der output_shape, wenn ich keine für das batch_size passieren, bekomme ich diesen Fehler:
TypeError: Expected binary or unicode string, got None
Und wenn ich keine Größe des Charge ändern, die ich verwende, hier ist der Fehler ..:
InvalidArgumentError (see above for traceback): Conv2DCustomBackpropInput: input and out_backprop must have the same batch size
[[Node: conv2d_transpose = Conv2DBackpropInput[T=DT_FLOAT, data_format="NHWC", padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](conv2d_transpose/output_shape, transpose, Reshape_4)]]
Hier
ist das Modell, das ich verwenden:
model = Sequential()
reg = lambda: l1l2(l1=1e-7, l2=1e-7)
h = 5
model.add(Dense(input_dim=100, output_dim=nch * 4 * 4, W_regularizer=reg()))
model.add(BatchNormalization(mode=0))
model.add(Reshape((4, 4, nch)))
model.add(Deconvolution2D(256, h,h, output_shape=(128,8,8,256), subsample=(2,2), border_mode='same'))
model.add(BatchNormalization(mode=0, axis=1))
model.add(LeakyReLU(0.2))
model.add(Deconvolution2D(256, h,h, output_shape=(128,16,16,256), subsample=(2,2), border_mode='same'))
model.add(BatchNormalization(mode=0, axis=1))
model.add(LeakyReLU(0.2))
model.add(Deconvolution2D(64, h,h, output_shape=(128,32,32,64), subsample=(2,2), border_mode='same'))
model.add(BatchNormalization(mode=0, axis=1))
model.add(LeakyReLU(0.2))
model.add(Convolution2D(3, h, h, border_mode='same', W_regularizer=reg()))
model.add(Activation('sigmoid'))
model.summary()
Warum wollen Sie eine batch_size auf None setzen? –
@ MarcinMożejko: Da in Keras bedeutet None variable Batch-Größe. (Wie -1 in Tensorflow) –