av-savchenko/face-emotion-recognition

Confidence range for inference using python library

varunsingh3000 opened this issue · 4 comments

Hi,

First of all, thank you so much for such a convenient setup to use!

I'm using the python library face emotion in my code with the model_name = 'enet_b0_8_best_afew'.
I was wondering what is the range of the confidence returned by the library or this model in particular.
I wasn't able to figure that out.

Thank you

Could you kindly clarify what do you exactly mean by "the range of confidence"? It is rather hard to estimate the confidence interval without relation to a concrete dataset. I tested my models on several datasets, and their accuracy varies significantly, though extracted facial features can be classified rather accurately (compared to the state-of-the-art) in all cases. In the main readme file of repository you could see the quality metrics for different models. If you want to apply the model as-is without training a classifier, then I should say that EfficientNet-B0 models should be used. I experimentally noticed, that enet_b0_8_best_vgaf and enet_b0_8_va_mtl are usually the best models, and enet_b0_8_best_afew has similar but slighly lower accuracy.

Oh, I meant the confidence with which emotion is predicted like a range of 0.00 to 1.00 but I think I got it the number shown beside the label is the accuracy scores for the emotions.

Thanks, I hope I understand the question. By default, the PyTorch models return logits - output of the last layer before applying softmax. If you want to compute "probabilities", you need to apply softmax to the outputs of this model. It is an easy call of get_probabs() function (see example in abaw4_mtl_train.ipynb). But my HSEmotion library supports special flag logits, so you can call fer.predict_emotions(face_img,logits=False) to get values between 0 and 1 with sum equal to 1. Please, see example

Got it. Thanks!