Update accuracy_utils.py

fix v2 compatibility.
This commit is contained in:
Judd 2020-02-14 14:33:34 +08:00 committed by GitHub
parent 5d00764f95
commit 19ecdb017a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,14 +137,14 @@ class StreamingAccuracyStats(object):
def print_accuracy_stats(self):
"""Write a human-readable description of the statistics to stdout."""
if self._how_many_gt == 0:
tf.logging.info('No ground truth yet, {}false positives'.format(
tf.compat.v1.logging.info('No ground truth yet, {}false positives'.format(
self._how_many_fp))
else:
any_match_percentage = self._how_many_gt_matched / self._how_many_gt * 100
correct_match_percentage = self._how_many_c / self._how_many_gt * 100
wrong_match_percentage = self._how_many_w / self._how_many_gt * 100
false_positive_percentage = self._how_many_fp / self._how_many_gt * 100
tf.logging.info('{:.1f}% matched, {:.1f}% correct, {:.1f}% wrong, '
tf.compat.v1.logging.info('{:.1f}% matched, {:.1f}% correct, {:.1f}% wrong, '
'{:.1f}% false positive'.format(
any_match_percentage, correct_match_percentage,
wrong_match_percentage, false_positive_percentage))