tyiannak / pyAudioAnalysis

Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications
Apache License 2.0
5.76k stars 1.18k forks source link

UnboundLocalError: local variable 'classifier_par' referenced before assignment #335

Closed InterLinked1 closed 3 years ago

InterLinked1 commented 3 years ago

I had some issues getting everything to work, but once I switched from Python 2 to Python 3, things went uphill pretty quickly. Now, it seems to mostly work, but I'm getting this at the end:

UnboundLocalError: local variable 'classifier_par' referenced before assignment

The file svm_10.arff did get generated, but that was it, which I thought was odd.

Full stack trace:

root@na01:~/pyAudioAnalysis# python3 /etc/asterisk/scripts/detect/gong/gonglearn.py
/usr/lib/python3/dist-packages/sklearn/externals/joblib.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
Traceback (most recent call last):
  File "/etc/asterisk/scripts/detect/gong/gonglearn.py", line 18, in <module>
    extract_features_and_train(dirs, mt, mt, mt, st, st, st, "svm_5", "svm_10", "svm_25")
TypeError: extract_features_and_train() takes from 7 to 9 positional arguments but 10 were given

root@na01:~/pyAudioAnalysis# python3 /etc/asterisk/scripts/detect/gong/gonglearn.py
/usr/lib/python3/dist-packages/sklearn/externals/joblib.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
Analyzing file 1 of 4: /etc/asterisk/scripts/detect/gong/nickel/nickel1.wav
Analyzing file 2 of 4: /etc/asterisk/scripts/detect/gong/nickel/nickel2.wav
Analyzing file 3 of 4: /etc/asterisk/scripts/detect/gong/nickel/nickel3.wav
Analyzing file 4 of 4: /etc/asterisk/scripts/detect/gong/nickel/nickel4.wav
Feature extraction complexity ratio: 23.1 x realtime
Analyzing file 1 of 5: /etc/asterisk/scripts/detect/gong/dime/dime1.wav
Analyzing file 2 of 5: /etc/asterisk/scripts/detect/gong/dime/dime1a.wav
Analyzing file 3 of 5: /etc/asterisk/scripts/detect/gong/dime/dime2.wav
Analyzing file 4 of 5: /etc/asterisk/scripts/detect/gong/dime/dime3.wav
Analyzing file 5 of 5: /etc/asterisk/scripts/detect/gong/dime/dime4.wav
Feature extraction complexity ratio: 20.4 x realtime
Analyzing file 1 of 4: /etc/asterisk/scripts/detect/gong/quarter/quarter1.wav
Analyzing file 2 of 4: /etc/asterisk/scripts/detect/gong/quarter/quarter2.wav
Analyzing file 3 of 4: /etc/asterisk/scripts/detect/gong/quarter/quarter3.wav
Analyzing file 4 of 4: /etc/asterisk/scripts/detect/gong/quarter/quarter4.wav
Feature extraction complexity ratio: 19.7 x realtime
Traceback (most recent call last):
  File "/etc/asterisk/scripts/detect/gong/gonglearn.py", line 18, in <module>
    extract_features_and_train(dirs, mt, mt, st, st, "svm_5", "svm_10", "svm_25")
  File "/root/pyAudioAnalysis/pyAudioAnalysis/audioTrainTest.py", line 342, in extract_features_and_train
    classifier_par, 0, train_percentage)
UnboundLocalError: local variable 'classifier_par' referenced before assignment