Return of emotion labels

Hello community. I made an emotion recognition model. I would like to know which object returns these emotions because I need to store the emotions labels in a database

Hi @jonata_paulino you could use the predict function of the model class to get the predicted outputs of the model or use the predict_on_batch function to predict over a batch of samples.

You could read more here

Hi @Shirshak_Ghatak, thanks for the reply. I’m going to study and if I get it I’ll post it here. It cost.

Hi @Shirshak_Ghatak, I couldn’t find what I need in that article, or I didn’t read it right. Actually what I’m looking for is which object gives me the outputs of face classifications such as happy, sad etc… They are shown in the bounding boxes in my model, but I don’t know how to store them in a database data for example. Thanks.

Ok so I did completely misinterpret your question earlier, :sweat_smile: so apologies for that as well as for the late reply. But this is what I think should be the solution.

So essentially what you can do is once your model has been trained. You can define a new layer as

layer_output=model.get_layer(‘layer name’).output

Insert the layer name as the softmax layer or whatever you output layer is, because we want the outputs in this case.Next we define a new model providing the output layer as layer_output.

output_model=tf.keras.models.Model(inputs=model.input,outputs=layer_output)

Then whatever dataset you want to get the outputs of run prediction on it.

outputs=output_model.predict(data)

This will provide you with the softmax outputs for each label, you can then use np.argmax to get the actual labels.

Hope this helped

1 Like

Oops, no need to apologize, I’m the one who appreciates your willingness to help. I’ll test it, but I’m pretty sure it’s the same. Thanks a lot for your help, really appreciate it.

1 Like