pyAudioAnalysis cannot import normalize_features

524 views Asked by At

I am done with installing pyAudioAnalysis, and I am importing now:

from pyAudioAnalysis.MidTermFeatures import mid_feature_extraction as mT
from pyAudioAnalysis.audioBasicIO import read_audio_file, stereo_to_mono
from pyAudioAnalysis.audioSegmentation import labels_to_segments
from pyAudioAnalysis.audioTrainTest import normalize_features

But I got error message:

ImportError: cannot import name 'normalize_features' from 'pyAudioAnalysis.audioTrainTest' (D:\anaconda\lib\site-packages\pyAudioAnalysis\audioTrainTest.py)

I went to the py it refers to, it is like this:

from __future__ import print_function
from imblearn.under_sampling import RandomUnderSampler
from imblearn.over_sampling import SMOTE
from sklearn.model_selection import GroupShuffleSplit
from pyAudioAnalysis import audioBasicIO
from pyAudioAnalysis import MidTermFeatures as aF
import sys
import numpy as np
import os
import glob
import pickle as cPickle
import csv
import ntpath
from scipy import linalg as la
from scipy.spatial import distance
import sklearn.svm
import sklearn.decomposition
import sklearn.ensemble
import plotly
import plotly.subplots
import plotly.graph_objs as go
import sklearn.metrics
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
sys.path.insert(0, os.path.join(
    os.path.dirname(os.path.realpath(__file__)), "../"))

shortTermWindow = 0.050
shortTermStep = 0.050
eps = 0.00000001

I am a newbie and I don't know if there's anything wrong with this. There's no problem when only running other 3 lines. Any ideas? I searched online but almost no post related. Thanks in advance!

1

There are 1 answers

0
Ujjawal shah On

I guess it's a Python version issue. I had the same error and solved it by running the script file on Python 3.6.5. pyaudioanalysis appears to function without any issues on Python version 3.6, in contrast to other versions.