Does tf.model.metrics or compile use the maximum output of softmax?

Hello! I am very new to programming and not from the field so I would greatly appreciate any help.

I made a U-Net model to segment tumors and have used the softmax function in the last convolutional layer. I have a multi-class segmentation, meaning that my output has four channels, and each element has a value of 0-1 in each of those channels due to softmax.

I then used the tf.keras.metrics to calculate my metrics and this function was inputed as an argument into the tf.model.compile function.
My question is - how does tf.model.metrics work on decimal values from 0 to 1? Doesn’t it need that the values first be passed through the argmax function to get either 0 or 1 in each individual channel?

I hope my question is clear and I am not asking too much. Thank you in advance.

Hi @iredena ,

I don’t think so, tf.model.metrics and compile do not directly use the maximum output of softmax.
However, they work seamlessly with softmax to calculate various metrics relevant to classification tasks.

1. Softmax Activation:

  • Converts raw scores into probabilities for each class in the final layer, ensuring they sum to 1.
  • Does not directly select the maximum value.

2. Metrics Calculation:

  • These metrics often use the argmax of softmax output to determine predicted classes, but the calculation itself doesn’t involve directly using the maximum value.

3. Model Compilation:

  • compile method configures training process, including loss function and optimizer.
  • Optimizer uses loss to update model weights, indirectly influenced by softmax but not directly using its maximum value.

I hope above differences clears your doubts.

Thanks.