svpino / tf_object_detection_cm

Confusion Matrix in Object Detection with TensorFlow
78 stars 36 forks source link

How to generate confusion matrix for tensorflow 2 object detection Api #45

Open Annieliaquat opened 2 years ago

Annieliaquat commented 2 years ago

I have trained my tensorflow 2 object detection Api. I got to know from an old github issue that

"In the old API workflow trained model detection/evaluation was accomplished using an infer_detections.py script included in the API. This would would use a frozen_inference_graph to produce a detections.record with model detections. We would then give this detections.record file to confusion_matrix.py to generate confusion matrix.

In the new worfklow (TF v2) there is no infer_detections and the frozen_inference_graph is no longer used. You now need to export your trained model to a saved_model file (exporter_main_v2.py), and then provide that saved_model directory and your test data set (as tfrecord) to the newest version of the confusion matrix script: confusion_matrix_tf2.py "

My question is that how test.TFrecord file will generate confusion matrix? Because confusion matrix need a prediction and true values. However, test.TFrecord has already images with labels, so it will be considered as True values.

So can someone please explain me how the test. TFrecord file will be able to generate confusion matrix??