Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predict.py not working with librosa feature extraction #38

Open
soul0101 opened this issue Aug 21, 2022 · 1 comment
Open

predict.py not working with librosa feature extraction #38

soul0101 opened this issue Aug 21, 2022 · 1 comment

Comments

@soul0101
Copy link

When I try to use librosa for feature extraction I am met with the following error:

Traceback (most recent call last):
  File "C:\Users\91983\Documents\Speech-Emotion-Analyzer\Speech-Emotion-Recognition\predict.py", line 41, in <module>
    predict(config, audio_path, model)
  File "C:\Users\91983\Documents\Speech-Emotion-Analyzer\Speech-Emotion-Recognition\predict.py", line 29, in predict
    result = model.predict(test_feature)
  File "C:\Users\91983\Documents\Speech-Emotion-Analyzer\Speech-Emotion-Recognition\models\ml.py", line 62, in predict
    return self.model.predict(samples)
  File "C:\Users\91983\anaconda3\envs\face\lib\site-packages\sklearn\svm\_base.py", line 810, in predict
    y = super().predict(X)
  File "C:\Users\91983\anaconda3\envs\face\lib\site-packages\sklearn\svm\_base.py", line 433, in predict
    X = self._validate_for_predict(X)
  File "C:\Users\91983\anaconda3\envs\face\lib\site-packages\sklearn\svm\_base.py", line 611, in _validate_for_predict
    X = self._validate_data(
  File "C:\Users\91983\anaconda3\envs\face\lib\site-packages\sklearn\base.py", line 600, in _validate_data
    self._check_n_features(X, reset=reset)
  File "C:\Users\91983\anaconda3\envs\face\lib\site-packages\sklearn\base.py", line 400, in _check_n_features
    raise ValueError(
ValueError: X has 312 features, but SVC is expecting 1582 features as input.
@Renovamen
Copy link
Owner

Features extracted by librosa have 312 dimensions, while those extracted by Opensmile have 1582 dimensions. So I believe you are feeding librosa features (312) to the model trained on Opensmial features (1582). Try checking the feature_method and checkpoint_name in configs/svm.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants