我尝试使用librosa将原始音频转换为mel-spectrumogram并得到此错误。起初,它运行完美,但在我安装tensorflow和keras后,它出错了。我已经卸载了tensorflow并再试一次,但它仍然有这个错误。
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-7d05a4b64ba1> in <module>()
1 import matplotlib.pyplot as plt
----> 2 import librosa
3 import librosa.display
4 import os
5 import numpy as np
D:\download\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\lib\site-packages\librosa\__init__.py in <module>()
12 from . import core
13 from . import beat
---> 14 from . import decompose
15 from . import effects
16 from . import feature
D:\download\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\lib\site-packages\librosa\decompose.py in <module>()
17 from scipy.ndimage import median_filter
18
---> 19 import sklearn.decomposition
20
21 from . import core
...
D:\download\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\lib\site-packages\sklearn\metrics\cluster\unsupervised.py in <module>()
10 from ...utils import check_random_state
11 from ...utils import check_X_y
---> 12 from ..pairwise import pairwise_distances
13 from ...preprocessing import LabelEncoder
14
D:\download\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64\lib\site-packages\sklearn\metrics\pairwise.py in <module>()
28 from ..externals.joblib import cpu_count
29
---> 30 from .pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
31
32
ImportError: DLL load failed: The specified module could not be found.
我认为它是由lib sklearn的模块成对引起的,但我不确定。这是我的代码
import matplotlib.pyplot as plt
import librosa
import librosa.display
import os
import numpy as np
TRAIN_DATA_DIR = "genres/blues/"
num_files = 0
list_files = []
for filename in os.listdir(TRAIN_DATA_DIR):
if (filename.endswith(".au")):
num_files+=1
list_files.append(filename)
print(filename)
fullpath = os.path.join(TRAIN_DATA_DIR, filename)
y, sr = librosa.load(fullpath)
librosa.feature.melspectrogram(y=y, sr=sr)
D = np.abs(librosa.stft(y))**2
S = librosa.feature.melspectrogram(S=D)
S = librosa.feature.melspectrogram(y=y, sr=sr, n_mels=128, max=8000)
我从很多来源搜索过但却找不到希望。请帮我。我怎样才能解决这个问题? 感谢