svpino / tf_object_detection_cm

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

Skipping all the images #14

Closed sushanth-d closed 4 years ago

sushanth-d commented 5 years ago

Hey When I execute the code, the following message is displayed:

Skipped image 1 Skipped image 2 Skipped image 3 Skipped image 4 Skipped image 5 Processed 5 images

Confusion Matrix: [[0. 0. 0. 0.] [0. 0. 0. 0.] [0. 0. 0. 0.] [0. 0. 0. 0.]]

confusion_matrix.py:112: RuntimeWarning: invalid value encountered in double_scalars precision = float(confusion_matrix[id, id] / total_predicted) confusion_matrix.py:113: RuntimeWarning: invalid value encountered in double_scalars recall = float(confusion_matrix[id, id] / total_target) precision_threaded@0.5IOU: nan recall_threaded@0.5IOU: nan precision_ungalvanized@0.5IOU: nan recall_ungalvanized@0.5IOU: nan precision_unthreaded@0.5IOU: nan recall_unthreaded@0.5IOU: nan

As seen above, the images are simply skipped, as a result of which the values of classification matrix and precision is erroneous.

Any help will be much appreciated.

svpino commented 5 years ago

It looks like line 45 in the script is returning None:

decoded_dict = data_parser.parse(example)

I'd recommend checking that and see why it might be happening.

biakota commented 4 years ago

Hi svpino, i got the same sushanth-d issu and decoded_dict = data_parser.parse(example) returns None, what could u suggest me?

sushanth-d commented 4 years ago

@biakota I got this error because I had not converted the tfrecord by running the following command.

A detection record file — This is the file generated by using the /object_detection/inference/infer_detections.py script. This script runs a TFRecord file through your model and saves the results in a detection record file.

Doing this fixed the error.

biakota commented 4 years ago

@biakota I got this error because I had not converted the tfrecord by running the following command.

A detection record file — This is the file generated by using the /object_detection/inference/infer_detections.py script. This script runs a TFRecord file through your model and saves the results in a detection record file.

Doing this fixed the error.

thank a lot @sushanth-d, i just fixed, you are right, i noticed i forgot to run /object_detection/inference/infer_detections.py first before to run the confusion matrix script

sushanth-d commented 4 years ago

Closing the issue

Aysenur112 commented 3 years ago

Hi, I got the same issue although I generated detections_record by using the python inference/infer_detections.py --input_tfrecord_paths=C:/Tensorflow1/models/research/object_detection/test.record --output_tfrecord_path=C:/Tensorflow1/models/research/object_detection/inference_graph/detections8.tfrecord --inference_graph=C:/Tensorflow1/models/research/object_detection/inference_graph/frozen_inference_graph.pb. Could you please help me to solve this issue? @sushanth-d @biakota Thanks.

Aysenur112 commented 3 years ago

Could you please help me to solve above issue? Thanks