I have a dataset of two types of audios in wav format. I am trying to train the keras model in such a fashion that input which is audio 'a' gets converted to output which will be audio 'b'. Currently I am doing it like this:
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])
All the features and labels have the same shape, hence it can be trained in an end to end manner. But I am not sure that having 192000 units in output is a good solution. Maybe a seq2seq model will be better here? But I am struggling to change code in keras for this problem. Can someone kindly help me in making a keras model which can be trained by giving audio as an input feature and another audio as an output? The audios can be of English to German set, French to Italian, Noisy audio to clear audio, etc. Any help will be highly appreciated!