Keras how to preprocess input signal

折月煮酒 提交于 2019-12-11 17:31:46

问题


I want to preprocess the input of my Keras model with certain signal processing functions as below. I want these to be part of my model because I will (hopefully) convert these to tf-lite or coreml. So I dont have to re-write these functionality on mobile app again. Although I couldn't figure out how and where I should add these to my model so inputs are preprocessed?

#method to preprocess the model input, when called
def getMfcss();
 stfts = tf.contrib.signal.stft(signals, frame_length=frame_length, frame_step=frame_step, fft_length=fft_length)
 ....
 mfccs = tf.contrib.signal.mfccs_from_log_mel_spectrograms(log_mel_spectrograms)[..., :num_mfccs]

And Model goes something like :

model = Sequential()
model.add(Dense(12, input_dim=16000, activation='relu'))

来源:https://stackoverflow.com/questions/54658336/keras-how-to-preprocess-input-signal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!