MiteshPuthran / Speech-Emotion-Analyzer

The neural network model is capable of detecting five different male/female emotions from audio speeches. (Deep Learning, NLP, Python)
MIT License
1.29k stars 436 forks source link

Getting error on loading model weights: ValueError: axes don't match array #29

Closed harirawat closed 5 years ago

harirawat commented 5 years ago

I am loading the weights of the pre-trained model by writing model.load_weights("saved_models/Emotion_Voice_Detection_Model.h5")

This is generating the following error.

Traceback (most recent call last):
  File "C:\anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 56, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
AttributeError: 'Dataset' object has no attribute 'transpose'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "final_results_gender_test.py", line 172, in <module>
    model.load_weights("saved_models/Emotion_Voice_Detection_Model.h5")
  File "C:\anaconda3\lib\site-packages\keras\models.py", line 738, in load_weights
    topology.load_weights_from_hdf5_group(f, layers, reshape=reshape)
  File "C:\anaconda3\lib\site-packages\keras\engine\topology.py", line 3369, in load_weights_from_hdf5_group
    reshape=reshape)
  File "C:\anaconda3\lib\site-packages\keras\engine\topology.py", line 3141, in preprocess_weights_for_loading
    weights[0] = np.transpose(weights[0], (3, 2, 0, 1))
  File "C:\anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 639, in transpose
    return _wrapfunc(a, 'transpose', axes)
  File "C:\anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 66, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "C:\anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 46, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: axes don't match array

Keras - 2.1.5 Tensorflow - 1.8.0

MiteshPuthran commented 5 years ago

Kindly refer to cell number 137