问题描述
我正在研究由 tensorflow 提供的 simple_audio 命令识别模型。我已成功将模型转换为 tflite 模型。但是,转换后的模型的准确性已经急剧下降。我对这两个模型使用了相同的测试数据集,但后者表现不佳。我也尝试过量化感知训练,但没有太大变化。 我使用 signal.stft 来推导给定音频文件的频谱图,因为我不能在推理代码中使用 tf.stft。我尝试了很多不同的方法来调试它,但遇到了问题。
我能想到的唯一区别在于生成频谱图的过程。
IN TF 模型是这样完成的:
def get_spectrogram(waveform):
zero_padding = tf.zeros([16000] - tf.shape(waveform),dtype=tf.float32)
waveform = tf.cast(waveform,tf.float32)
equal_length = tf.concat([waveform,zero_padding],0)
spectrogram = tf.signal.stft(
equal_length,frame_length=255,frame_step=128)
spectrogram = tf.abs(spectrogram)
return spectrogram
虽然在 tflite 模型中它写成:
def get_spectrogram1(mySound):
y=np.shape(mySound)
res = int(''.join(map(str,y)))
zero_padding=np.zeros((16000) - res,dtype=np.float32)
equal_length=np.concatenate((mySound,zero_padding),axis=0)
f,t,Zw= signal.stft(equal_length,nperseg=247,noverlap=122)
Zw=np.absolute(Zw)
return Zw
有人可以指出一些选项或建议吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)