I want to build a generator model based on the picture (reference). The picture said that the model is using a 1D-Transposed Convolutional Layer.
Is that possible to build the model (like in the picture) by using Conv1DTranspose in Keras while the input size is (10x10x1)? If it is possible, could you give some advice on how to perform it in Keras? Thank you.
Before, I tried to build the model. The dimension output seems to be correct, but I used Conv2DTranspose instead of Conv1DTranspose. (please correct me if I am wrong on the implementation especially on the first 4 layers).
def get_mlp():
in_lat = Input(shape=(100,))
x = Reshape((10,10,1))( in_lat )
x = Conv2DTranspose(32, 7, strides=(2,1), padding='same', activation='relu')(x)
x = Conv2DTranspose(64, 7, strides=(2,1), padding='same', activation='relu')(x)
x = Conv2DTranspose(128, 7, strides=(2,1), padding='same', activation='relu')(x)
x = Reshape((800,-1))(x)
x = Conv1D(128, 3, strides=1, padding='same')(x)
x = Conv1D(64, 3, strides=2, padding='same')(x)
x = Conv1D(32, 3, strides=2, padding='same')(x)
out = Dense(100, activation='softmax')(x)
model = Model(in_lat, out)
model.summary()
return model
Output
Model: "functional_95"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_64 (InputLayer) [(None, 100)] 0
_________________________________________________________________
reshape_80 (Reshape) (None, 10, 10, 1) 0
_________________________________________________________________
conv2d_transpose_91 (Conv2DT (None, 20, 10, 32) 1600
_________________________________________________________________
conv2d_transpose_92 (Conv2DT (None, 40, 10, 64) 100416
_________________________________________________________________
conv2d_transpose_93 (Conv2DT (None, 80, 10, 128) 401536
_________________________________________________________________
reshape_81 (Reshape) (None, 800, 128) 0
_________________________________________________________________
conv1d_47 (Conv1D) (None, 800, 128) 49280
_________________________________________________________________
conv1d_48 (Conv1D) (None, 400, 64) 24640
_________________________________________________________________
conv1d_49 (Conv1D) (None, 200, 32) 6176
_________________________________________________________________
dense_8 (Dense) (None, 200, 100) 3300
=================================================================
Total params: 586,948
Trainable params: 586,948
Non-trainable params: 0