【发布时间】:2022-01-20 20:28:12
【问题描述】:
我正在尝试对时空数据使用自动编码器。
我的数据形状是:batches , filters, timesteps, rows, columns。我在将自动编码器设置为正确的形状时遇到问题。
这是我的模型:
input_imag = Input(shape=(3, 81, 4, 4))
x = Conv3D(16, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(input_imag)
x = MaxPooling3D((3, 2, 2), data_format='channels_first', padding='same')(x)
x = Conv3D(8, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(x)
x = MaxPooling3D((3, 2, 2), data_format='channels_first', padding='same')(x)
x = Conv3D(4, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(x)
encoded = MaxPooling3D((3, 2, 2), data_format='channels_first', padding='same', name='encoder')(x)
x = Conv3D(4, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(encoded)
x = UpSampling3D((3, 2, 2), data_format='channels_first')(x)
x = Conv3D(8, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(x)
x = UpSampling3D((3, 2, 2), data_format='channels_first')(x)
x = Conv3D(16, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(x)
x = UpSampling3D((3, 2, 2), data_format='channels_first')(x)
decoded = Conv3D(3, (5, 3, 3), data_format='channels_first', activation='relu', padding='same')(x)
autoencoder = Model(input_imag, decoded)
autoencoder.compile(optimizer='adam', loss='mse')
autoencoder.summary()
这是摘要:
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) [(None, 3, 81, 4, 4)] 0
_________________________________________________________________
conv3d (Conv3D) (None, 16, 81, 4, 4) 2176
_________________________________________________________________
max_pooling3d (MaxPooling3D) (None, 16, 27, 2, 2) 0
_________________________________________________________________
conv3d_1 (Conv3D) (None, 8, 27, 2, 2) 5768
_________________________________________________________________
max_pooling3d_1 (MaxPooling3 (None, 8, 9, 1, 1) 0
_________________________________________________________________
conv3d_2 (Conv3D) (None, 4, 9, 1, 1) 1444
_________________________________________________________________
encoder (MaxPooling3D) (None, 4, 3, 1, 1) 0
_________________________________________________________________
conv3d_3 (Conv3D) (None, 4, 3, 1, 1) 724
_________________________________________________________________
up_sampling3d (UpSampling3D) (None, 4, 9, 2, 2) 0
_________________________________________________________________
conv3d_4 (Conv3D) (None, 8, 9, 2, 2) 1448
_________________________________________________________________
up_sampling3d_1 (UpSampling3 (None, 8, 27, 4, 4) 0
_________________________________________________________________
conv3d_5 (Conv3D) (None, 16, 27, 4, 4) 5776
_________________________________________________________________
up_sampling3d_2 (UpSampling3 (None, 16, 81, 8, 8) 0
_________________________________________________________________
conv3d_6 (Conv3D) (None, 3, 81, 8, 8) 2163
=================================================================
Total params: 19,499
Trainable params: 19,499
Non-trainable params: 0
我应该改变什么以使解码器输出形状为[?,3,81,4,4] 而不是[?,3,81,8,8]?
【问题讨论】:
标签: python tensorflow time-series conv-neural-network autoencoder