Closed iamweiweishi closed 5 years ago
Epoch 1/1 271/271 [==============================] - 3s 12ms/step - loss: 0.0187 - acc: 0.9963 68/68 [==============================] - 0s 2ms/step [3 1 1 0 1 2 1 3 3 0 1 2 2 1 1 1 1 3 2 0 3 0 1 1 1 1 1 2 1 3 1 0 1 3 0 0 3 3 1 0 1 0 1 2 0 3 3 3 0 0 3 1 1 1 0 1 0 3 3 0 3 3 3 1 2 0 0 0] (3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) Accuracy:0.412
Confusion matrix: [[ 0 18 0 0] [ 0 25 0 0] [ 0 7 0 0] [ 0 15 0 3]] Traceback (most recent call last): File "cnn_example.py", line 33, in cnn_example() File "cnn_example.py", line 27, in cnn_example get_feature_vector_from_mfcc(filename, flatten=to_flatten)), File "/home/sww/workspace/speech-emotion-recognition/speechemotionrecognition/dnn.py", line 97, in predictone return np.argmax(self.model.predict(np.array([sample]))) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1149, in predict x, , _ = self._standardize_user_data(x) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 751, in _standardize_user_data exception_prefix='input') File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_utils.py", line 128, in standardize_input_data 'with shape ' + str(data_shape)) ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (1, 198, 39) root@2d14eba3fb00:/home/sww/workspace/speech-emotion-recognition# Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (1, 198, 39)
The training code is: '''
set -x export PYTHONPATH=/path_to/speech-emotion-recognition/:$PYTHONPATH export PATH=/path_to/speech-emotion-recognition/:$PATH cd examples python cnn_example.py '''
There seems to be some problems with the input. Could you pls help me with this? Many Thanks.
Let me look into this and get back to you
same error
Sorry, I couldn't reproduce the error on my side. Please reopen the comment with more information .
Epoch 1/1 271/271 [==============================] - 3s 12ms/step - loss: 0.0187 - acc: 0.9963 68/68 [==============================] - 0s 2ms/step [3 1 1 0 1 2 1 3 3 0 1 2 2 1 1 1 1 3 2 0 3 0 1 1 1 1 1 2 1 3 1 0 1 3 0 0 3 3 1 0 1 0 1 2 0 3 3 3 0 0 3 1 1 1 0 1 0 3 3 0 3 3 3 1 2 0 0 0] (3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) Accuracy:0.412
Confusion matrix: [[ 0 18 0 0] [ 0 25 0 0] [ 0 7 0 0] [ 0 15 0 3]] Traceback (most recent call last): File "cnn_example.py", line 33, in
cnn_example()
File "cnn_example.py", line 27, in cnn_example
get_feature_vector_from_mfcc(filename, flatten=to_flatten)),
File "/home/sww/workspace/speech-emotion-recognition/speechemotionrecognition/dnn.py", line 97, in predictone
return np.argmax(self.model.predict(np.array([sample])))
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1149, in predict
x, , _ = self._standardize_user_data(x)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 751, in _standardize_user_data
exception_prefix='input')
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_utils.py", line 128, in standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (1, 198, 39)
root@2d14eba3fb00:/home/sww/workspace/speech-emotion-recognition# Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (1, 198, 39)
The training code is: '''
!/usr/bin/env bash
set -x export PYTHONPATH=/path_to/speech-emotion-recognition/:$PYTHONPATH export PATH=/path_to/speech-emotion-recognition/:$PATH cd examples python cnn_example.py '''
There seems to be some problems with the input. Could you pls help me with this? Many Thanks.