Python 检查具有不同长度大小声音的输入LSTM自动编码器时出错

Python 检查具有不同长度大小声音的输入LSTM自动编码器时出错,python,keras,audio,deep-learning,Python,Keras,Audio,Deep Learning,如何能够使用一组对象为神经网络提供反馈 我有3000种不同长度的声音,我想用它来训练LSTM网络 for f in files: wav,sr=librosa.load(audio_path+f,sr=None) wav=librosa.util.normalize(wav) log_magnitude_spect=baby_input.waveform_to_examples(wav,16000) X_data.append(log_magnitude_spect) 我使用上面

如何能够使用一组对象为神经网络提供反馈

我有3000种不同长度的声音,我想用它来训练LSTM网络

for f in files:
  wav,sr=librosa.load(audio_path+f,sr=None)
  wav=librosa.util.normalize(wav)
  log_magnitude_spect=baby_input.waveform_to_examples(wav,16000)

X_data.append(log_magnitude_spect)
我使用上面的代码,通过STFT生成对数光谱图,并获得了3000个对象的列表。声音有不同的长度,所以我创建了这个架构

def autoencoder_LSTM(features):
# define encoder
 inputs = Input(shape=(None,features))

 latent = LSTM(128, activation='tanh',dropout=0.2)(inputs)
# encoder= Model(inputs, latent, name="encoder")

# define reconstruct decoder
 decoder = Lambda(repeat)([inputs,latent])
 decoder = LSTM(128, activation='tanh', return_sequences=True, dropout=0.2)(decoder)
 decoder = TimeDistributed(Dense(features))(decoder)
 
 model=Model(inputs=inputs,outputs=[decoder])
 enc=Model(inputs=inputs, outputs=[latent])
return model, enc
但是当我试着跑的时候

    lr = 0.001
from keras import optimizers
adam = optimizers.Adam(lr)

features=257
model, encoder= autoencoder_LSTM(features)
model.compile(loss='mse', optimizer=adam)
interval = 1
X_data=np.array(X_data)
history = model.fit(X_data, X_data,epochs=5).history
我犯了这个错误

 Error when checking input: expected input_1 to have 3 dimensions, but got array with shape (3000, 1)
我怎样才能解决这个问题?我不想使用掩蔽层,也不想使用不同长度的掩蔽层?通常我会创建一个3D阵列(3000,时间步,功能)。问题是时间步长不是固定长度的

谢谢大家!