emotion-recognition-neural-networks icon indicating copy to clipboard operation
emotion-recognition-neural-networks copied to clipboard

'numpy.ndarray' object has no attribute 'index' ??

Open ghost opened this issue 7 years ago • 11 comments

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

ghost avatar Sep 01 '17 10:09 ghost

:+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.

AlainPilon avatar Sep 08 '17 19:09 AlainPilon

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 avatar Sep 08 '17 19:09 AlainPilon

@AlainPilon Your model is probably not loaded ~Or you are a real happy guy hehe

AdrienPlayerium avatar Sep 11 '17 07:09 AdrienPlayerium

~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.

AlainPilon avatar Sep 11 '17 12:09 AlainPilon

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 avatar Sep 11 '17 16:09 paulkirkland

@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 ;-)

AlainPilon avatar Sep 11 '17 16:09 AlainPilon

@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.

AdrienPlayerium avatar Sep 12 '17 00:09 AdrienPlayerium

@paulkirkland sir can you kindly share your model and code that overcame this issue. It will be very helpful

ashukumar12d avatar Jan 18 '18 16:01 ashukumar12d

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.

BePhamVietnamese avatar May 05 '18 07:05 BePhamVietnamese

data[np.argmax(labels[i]), result[0].index(max(result[0]))] += 1 AttributeError: 'numpy.ndarray' object has no attribute 'index' Solution??

SwapnilAkash avatar Jul 16 '18 10:07 SwapnilAkash

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?

Shetuu avatar Jul 28 '18 21:07 Shetuu