I wrote this function that takes in an image and generates a prediction. The level of confidence for the prediction that the function reports is greater than 100% many times. Sometimes the prediction is correct and reports a high level of confidence. Sometimes it is incorrect and still reports a high level of confidence. Can you please help me identify the error in my level of confidence code?
CodePudding user response:
If you want your output to be between 0 and 1, you should use either a 'sigmoid'
or 'softmax'
activation in your last layer:
outputs = tf.keras.layers.Dense(3, activation='softmax')(x)
Careful, however, because softmax output can't really be interpreted as probability.