1
votes

I use CNN for semantic segmentation, create 4 output branches, and customize the loss function.

I'm using the following versions:

  • Keras 2.2.4
  • Python 3.6.8
  • tensorflow 1.12.0

When I training,acc and val_acc are not displayed on the progress bar,But loss and val_loss are normally displayed.

 436/436 [==============================] - 160s 367ms/step - loss: 0.4628 - output_0_loss: 0.0351 - output_1_loss: 0.0698 - output_2_loss: 0.1572 - output_3_loss: 0.2008 - output_0_acc: 0.6728 - output_1_acc: 0.6944 - output_2_acc: 0.8087 - output_3_acc: 0.7010 - val_loss: 0.3001 - val_output_0_loss: 0.0145 - val_output_1_loss: 0.0261 - val_output_2_loss: 0.1511 - val_output_3_loss: 0.1083 - val_output_0_acc: 0.9742 - val_output_1_acc: 0.8642 - val_output_2_acc: 0.7887 - val_output_3_acc: 0.8423

My loss function is binary_crossentropy,I use the metric is ['accuracy']:

model.compile(loss=my_binary_crossentropy,
                  optimizer=optimizer_name,
                  metrics=['accuracy'])

The acc and val_acc in history is None:

epoch-loss:[0.44138801848175424, 0.31117319703451685] epoch-acc:[None, None] epoch-val_loss:[0.2681478185099933, 0.21369548345525233] epoch-val_acc:[None, None]

How should I deal with this problem or where to debug it?

1
Please do not use the comments space to add such info - edit & update your post insteaddesertnaut
There are entries in the progress bar output_X_acc and val_output_X_acc, which do provide the required accuracies per output (see also answer below).desertnaut

1 Answers

0
votes

You have a model with multiple outputs, to train this model keras will use a single loss function that is a weighted combination of the loss for each output, but the same cannot be done for non-loss metrics. Accuracy is only defined for individual outputs, so you get one accuracy training/validation metric for each output, which is the correct behavior. There will not be any acc or val_acc that is for the whole model.