我关注了一些建议将input_shape输入到第一LSTM层的帖子,但仍然会产生此错误:
model.add(TimeDistributed(Conv2D(32, kernel_size=(2, 2), activation='relu', input_shape=(100, 126, 1))))
model.add(TimeDistributed(MaxPooling2D(pool_size=(2, 2))))
model.add(TimeDistributed(Dropout(0.25)))
model.add(TimeDistributed(Flatten()))
model.add(LSTM(20, input_shape=(100, 62, 1), return_sequences=True))
model.add(Dense(6, activation='sigmoid'))
model.compile(loss=categorical_crossentropy, optimizer=sgd, metrics=['accuracy'])
model.fit_generator(generator=train_gen, validation_data=val_gen)