日常记录:CNN for Single Channel Speech Enhancement
记录在运行CNN for Single Channel Speech Enhancement 的开源代码时出现的一些bug,以及解决方法。
前言
本人深度学习小白一个,更没有太多的实战经验,主要研究方向是single channel speech enhancement。
由于导师要求跑一个deep learning-based method,时间比较紧,就先找了个开源的代码跑跑看。
写这篇blog也是为了记录跑程序过程中的一些bug,还希望有经验的人多多指教。
准备工作
首先要把自己的speech data和noise data放在相应的文件中,修改SENN_rain.py中的location。
这点在readme中也说的比较清楚了。
但是,用于validation的speech和noise到底要用多少,我暂时真的还不是很懂,多跑几次看下效果吧。
install tensorflow==0.11.0
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl
pip install --upgrade $TF_BINARY_URL
install numpy==1.11.0
pip install numpy==1.11.0
install librosa==0.5.1
pip install librosa==0.5.1
error1
TypeError: expected string or buffer
运行到librosa相关代码是出现这类问题,这是因为joblib的版本不对应,应该安装joblib==0.11版本。
pip/conda uninstall joblib
pip/conda install joblib==0.11
注:‘/’符号表示二者均可,取其一。
error2
TypeError: 'numpy.float64' object cannot be interpreted as an index #4
第一次出现这个error时,我按照stackoverflow上的提示将1.15.1版本的numpy改成了1.11.0版本的numpy,但是发现在运行的时候依旧出现了这个错误,后来还是找到了解决方法:
Yes i did some research and discovered that floating point indices was finally removed from numpy 1.12.
so the walk around was the cast all indices to int.
data_frames = stride_tricks.as_strided(
data,
shape=(int(num_iter), int(self.N_IN), 2, int(self.frame_length)),
strides=(
int(data.strides[1] * self.frame_move),
int(data.strides[1] * self.frame_move),
int(data.strides[0]),
int(data.strides[1])))
This works fine.
error3
'ImportError: numpy.core.multiarray failed to import
解决方法: 安装了两个不同版本的numpy,卸载其中一个numpy即可。