I use tf.keras.metrics.MeanIoU in my model (I only have 2 classes), but it gives me different result than if I apply the equation IOU = true_positive / (
tf.keras.metrics.MeanIoU
IOU = true_positive / (