Questions tagged [keras-metrics]

11 questions
6
votes
2 answers

tf.keras.metrics.MeanIoU with sigmoid layer

I have a network for semantic segmentation and the last layer of my model applies a sigmoid activation, so all predictions are scaled between 0-1. There is this validation metric tf.keras.metrics.MeanIoU(num_classes), which compares classified…
WillemBoone
  • 93
  • 1
  • 6
4
votes
1 answer

Custom metric for Keras model, using Tensorflow 2.1

I would like to add a custom metric to model with Keras, I'm debugging my working code and I don't find a method to do the operations I need. The problem could be described as a multi classification trough logistic multinomial regression. The custom…
L F
  • 548
  • 1
  • 7
  • 22
3
votes
2 answers

Whats the output for Keras categorical_accuracy metrics?

I cant find proper description of metrics outputs. For example if I use model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) then I get loss and accuracy tr_loss, tr_acc = model.train_on_batch(X, Y) if I compile…
Boppity Bop
  • 9,613
  • 13
  • 72
  • 151
1
vote
0 answers

Why keras AUC returns zero when multi-label is set?

I'm trying to understand how tf.keras.metrics.AUC(multi_label=True) works. From the docs, I'm led to understand that when working with multi-label vectors, each class is computed individually, then averaged. However, I can't seem to get the…
rodrigo-silveira
  • 12,607
  • 11
  • 69
  • 123
1
vote
1 answer

ValueError: Shapes (None,) and (None, 1) are incompatible

I have the following model : model = Sequential() model.add(layers.InputLayer(input_shape=(5,))) model.add(layers.Dense(20, activation='relu')) model.add(layers.Dense(30,…
mira
  • 41
  • 1
  • 5
1
vote
0 answers

Custom keras metric with tensorflowflow functions. Uninitialized variables

I am running a model with a custom metric in tensorflow 1.14, and I have issues with uninitialized variables. def metric(y_true, y_pred): # some math operations all in tensorflow # ... return tf.metrics.mean(tf.reduce_sum(my_mat,…
SA3709
  • 192
  • 2
  • 11
0
votes
0 answers

Why does IoU as metrics for Semantic Segmentation raise a values error in Keras?

Applying a binary semantic segmentation model ( "unet", tensorflow.keras) with classes 0 and 1, works well when compiled as follows, with metrics "accuracy" or "Binary…
0
votes
0 answers

How do I solve Kera's MeanIoU Confusion matrix error?

I am using Tensorflow 2.8. When I try evaluating my pre-trained(pix2pix) image segmentation model using MeanIoU, I get the errors below: Node: 'confusion_matrix/assert_non_negative_1/assert_less_equal/Assert/AssertGuard/Assert' 2 root error(s)…
sajeyks mwangi
  • 549
  • 8
  • 20
0
votes
1 answer

Tensorflow metrics with residual not zero during training

currently I am working on an image error classifier using tensorflow and the on ImageNet pre-trained EfficientNetB0 from keras applications. As metrics, I am using false positive (fp), true positive (tp), false negative (fn), true negative (tn),…
0
votes
1 answer

Separating custom keras metric inputs into two seperate metrics and finding median error

I have a ResNet network that I am using for a camera pose network. I have replaced the final classifier layer with a 1024 dense layer and then a 7 dense layer (first 3 for xyz, final 4 for quaternion). My problem is that I want to record the xyz…
0
votes
1 answer

How to use False Positives metric in Tensorflow 2.0?

In Tensorflow 2.0, I'm trying to build a model that classifies my objects onto two categories: positives and negatives. I want to use tf.keras.metrics.FalsePositives and tf.keras.metrics.FalseNegatives metrics to see how the model improves with…
Volodymyr Frolov
  • 1,256
  • 5
  • 16
  • 25