emotion-recognition-neural-networks
emotion-recognition-neural-networks copied to clipboard
'numpy.ndarray' object has no attribute 'index' ??
face_image = feelings_faces[result[0].index(max(result[0]))] AttributeError: 'numpy.ndarray' object has no attribute 'index'
is the error I get after the webcam loads then just crashes, when i debug the code in spyder the feelings_faces and results both have values in their arrays
:+1 I am curious, how do you know your webcam loads? I use a Macbook Pro and the camera light never turn on and I get the same error are yours.
actually fix is easy:
face_image = feelings_faces[result[0].tolist().index(max(result[0]))]
.tolist()
is the fix ;-)
Now I have to figure out why it always think that I am happy...
@AlainPilon Your model is probably not loaded ~Or you are a real happy guy hehe
~Or you are a real happy guy :-)
I did manage to make it output some other emotion but they had so be very contrived (as in I had to do some pretty bad acting to get them). I will do more tests this week.
yeah i managed to eventually find out the same fix with the tolist() feature.
I find the code run in such a way that the first emotion it sees is what it likes to stick with i have an alternative version of the code trained with a different CNN that give a faster changing response to emotions, though sometimes its get a bit silly jumping between two , even when you try your hardest to keep the same face.
@paulkirkland probably need to change to a LTSM to keep track of the last emotion to make it "stick". But that is out of my comfort zone for now ;-)
@paulkirkland Maybe without training a different network, you can take that output, as a noisy detection, and use mean shift, or kalman filtering to reduce the noise.
@paulkirkland sir can you kindly share your model and code that overcame this issue. It will be very helpful
Hi @paulkirkland, I have also gotten this problem long time. Could you please help me to solve this problem. How can I fix this point. Thank you very much.
data[np.argmax(labels[i]), result[0].index(max(result[0]))] += 1 AttributeError: 'numpy.ndarray' object has no attribute 'index' Solution??
The baseline predictions are the historical averages
baseline_preds = test_features.index('averages') AttributeError: 'numpy.ndarray' object has no attribute 'index'
whats is the solution?