Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. def add_volume_iou_metrics(inputs, outputs):
  2. """Computes the per-instance volume IOU.
  3.  
  4. Args:
  5. inputs: Input dictionary of the voxel generation model.
  6. outputs: Output dictionary returned by the voxel generation model.
  7.  
  8. Returns:
  9. names_to_values: metrics->values (dict).
  10. names_to_updates: metrics->ops (dict).
  11.  
  12. """
  13. names_to_values = dict()
  14. names_to_updates = dict()
  15. print("*************************")
  16. print(inputs)
  17. print(outputs)
  18. labels = tf.greater_equal(inputs, 0.5)
  19. predictions = tf.greater_equal(outputs, 0.5)
  20. labels = (2 - tf.to_int32(labels))-1 #normalisieren auf 1,2 (we think 2 is empty/free), 1 is ground truth occupied
  21. predictions = (3 - tf.to_int32(predictions) * 2)-1 # 3=predicted free, 1=predicted occupied,
  22. #so we get intersection only for number 1, predicted occupied
  23. #labels= tf.Print(labels, [labels], message="This is the labels: ", summarize=100)
  24. #labels= tf.Print(labels, [predictions], message="This is the predictions: ",summarize=100)
  25. tmp_values, tmp_updates = tf.metrics.mean_iou(
  26. labels=labels,# we add -1 because the tf metrics expects it probably to start from zero
  27. predictions=predictions,
  28. num_classes=3)
  29. tmp_values=tf.Print(tmp_values,[tmp_values])
  30. names_to_values['volume_iou'] = tmp_values * 3.0
  31. names_to_updates['volume_iou'] = tmp_updates
  32. return names_to_values, names_to_updates
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement