我有两种类型的音频数据集的wav格式。我试图用这样的方式训练keras模型,即输入,即音频'a‘被转换成输出,它将是音频'b’。目前我是这样做的:
X_train,X_test,y_train,y_test=get_audio_sets() # returns wav files' numpy arrays of same size for training and validation
input_ = Input(shape=(192000,1)) #input layer
x=LSTM(64)(input_)
x=Dense(512, name='dense1')(x)
x=LeakyReLU()(x)
# the audio is very poor here, training is quite slow and I think having 192000 output units is not a good idea
output=Dense(192000, activation='tanh')(x) # range is from -1,1
model = Model(input_, output)
adam=Adam(lr=0.0001)
model.compile(optimizer=adam, loss='mae') #compile the model
model.summary()
from keras.callbacks import TensorBoard
#early stoping is used to prevent overfitting
es=keras.callbacks.EarlyStopping(monitor='val_loss', min_delta=0, patience=10, verbose=0, mode='auto',baseline=None, restore_best_weights=True)
#train the model
model.fit(X_train, y_train,
epochs=10,
batch_size=32,
shuffle=False,
validation_data=(X_test, y_test),
callbacks=[es])所有的特征和标签都有相同的形状,因此可以用一种端到端的方式进行训练。但我不确定192000台的产量是否是一个好的解决方案。也许seq2seq模型在这里会更好?但是为了这个问题,我很难在keras中修改代码。有人能好心地帮助我做一个角角模型,它可以通过提供音频作为输入特征和另一个音频作为输出来训练吗?听力可以是英语到德语组,法语到意大利语,噪音音频到清晰音频,等等。任何帮助都将不胜感激!
发布于 2020-05-23 10:37:23
音频/语音合成相当复杂。
您可以设计一个模型,它将音频->转换为mel-spectogram ->,通过mel ->获得mel-spectogram ->,使用反向操作+griffin获取音频。
librosa是一个很不错的库:https://librosa.github.io/librosa/generated/librosa.feature.melspectrogram.html
https://stackoverflow.com/questions/61952658
复制相似问题