我想 Build 这种类型的神经网络架构:2DCNN+GRU . 考虑输入是一个4D张量(batch_size,1,115,40),然后我错了...另外考虑我的训练标签是3D张量(batch_size,1500,2) . 我在这里复制了keras模型和summary()命令的输出:
input_data = Input(shape=[1,1500,40])
x = input_data
for i in range(len([32,96,120])):
x = Conv2D(filters=[32,96,120],
kernel_size=[5,5],
activation='relu',
padding='same'
)(x)
x = BatchNormalization(axis=3)(x)
x = Dropout(0.3)(x)
x = MaxPooling2D(pool_size=[(1,5),(1,4),(1,2)],
data_format="channels_first")(x)
x = Reshape((1500, 120))(x)
x = GRU(units=120,
activation='tanh',
recurrent_activation='hard_sigmoid',
dropout=0.3,
recurrent_dropout=0.3,
)(x)
predictions = Dense(2, activation='softmax')(x)
network = Model(input_data, predictions)
network.summary()
你能帮助我吗?谢谢
1 回答
您似乎期望对输入的每个时间步进行预测 . 为此,您需要在创建
GRU
图层时将参数return_sequences
set添加到True
.