xxxyyy
xxxyyy

Reputation: 13

How to evaluate multi output model in keras?

I have a model with multiple outputs. I want to evaluate the losses of all outputs. I have programmed my code like in this example: How to evaluate a multi input/output model in keras? as:

model.compile(optimizer='rmsprop', loss={'main_output': 'categorical_crossentropy', 'aux_output': 'categorical_crossentropy'}, loss_weights={'main_output': 1., 'aux_output': 0.2}, metrics=['acc'])

res = model.evaluate(x={'main_input': x1test, 'aux_input': x2test}, y={'main_output': ytest, 'aux_output': ytest})

I have two environments, one with Kersas 2.10 and one with Kersas 3.33. In Keras 2.10 in res I get all the losses and the weighted averaged loss. In Keras 3.33 in res I only get the weighted averaged loss and not the two individual losses. However, I need those individual losses. Do you know how I can get these in Keras 3.33?

EDIT: Seems to be a common problem in Keras 3.x https://github.com/keras-team/keras/issues/18993

Upvotes: 0

Views: 38

Answers (0)

Related Questions