Models: deeplabv3+ how to print per_class_iou

Created on 4 May 2018  路  9Comments  路  Source: tensorflow/models

i train my own dataset on deeplabv3+,i want to know how to print per_class_iou,could you help me?

awaiting response

Most helpful comment

All 9 comments

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
What is the top-level directory of the model you are using
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce

Not quite sure what you are trying to do here, are you trying to show the iou for each of the detected object during testing time? During evaluation stage, the model only log the mean iou, which is available as a summary tensor. See https://github.com/tensorflow/models/blob/master/research/deeplab/eval.py#L149.

Also adding the owner of deeplab for more inputs.

https://stackoverflow.com/questions/40340728/tensorflow-how-can-i-get-the-total-cm-in-tf-contrib-metrics-streaming-mean-iou
I found this solution, but I did not try. You can see it will be helpful or not.

I have the same problem锛乄ho can solve this problem?

I tried adding
metric_map[prediction_tag_confMatrix] = tf.contrib.metrics.confusion_matrix(labels, predictions, num_classes=dataset.num_classes)
but keep getting the error

_TypeError: Tensor objects are not iterable when eager execution is not enabled. To iterate over this tensor use tf.map_fn._ at line metrics_to_values, metrics_to_updates = ( tf.contrib.metrics.aggregate_metric_map(metric_map))
Anyone knows how fix this?

@alexw92 I have solved.
add this in line 142 of eval.py
# compute each class's iou
mean_iou_v, update_op = my_metrics.iou( predictions, labels, dataset.num_classes,weights=weights)
for index in range(0,dataset.num_classes):
metric_map['class_'+str(index)+'_iou'] = (mean_iou_v[index], update_op[index])

@MrZhousf
Awesome work, thank you very much!!

Closing as this is resolved

Was this page helpful?
0 / 5 - 0 ratings