'Is there a convenient way to get scores, labels, num_gt of a TensorFlow Object Detection model?

Is there a way to get a score, labels, num_gt in the Tensorflow Object Detection API? I already found a function in tensorflow/models/research/object_detection/utils/metrics.py that is used to generate plots of precision and recall but I don't understand that from where I get the values of scores, labels, num_gt.Can somebody help me?

I am following this tutorial "https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/2.2.0/training.html" and you can find "metrics.py" from this github repository https://github.com/tensorflow/models/blob/master/research/object_detection/utils/metrics.py

import matplotlib.pyplot as plt
import numpy as np 
from object_detection.utils.metrics import compute_precision_recall
num_gt =                       #Number of ground truth instances
scores =                       #A float numpy array representing detection score
labels =                       #A float numpy array representing weighted true/false positive labels
precision, recall = compute_precision_recall(scores, labels, num_gt)
plt.figure()
plt.step(recall, precision, where='post')
plt.xlabel('Recall')
plt.ylabel('Precision')
plt.xlim((0, 1))
plt.ylim((0, 1))
plt.show()
plt.close()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source