首页 > 解决方案 > Keras如何预处理输入信号

问题描述

我想使用以下某些信号处理功能预处理我的 Keras 模型的输入。我希望这些成为我模型的一部分,因为我将(希望)将它们转换为 tf-lite 或 coreml。所以我不必再次在移动应用程序上重新编写这些功能。虽然我不知道应该如何以及在何处将这些添加到我的模型中,以便对输入进行预处理?

#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]

模型类似于:

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

标签: tensorflowkerastensorflow-litecoremltools

解决方案


推荐阅读