svpino / tf_object_detection_cm

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

RuntimeWarning: invalid value encountered in double_scalars #22

Open acikgozf opened 4 years ago

acikgozf commented 4 years ago

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

confusion_matrix.py:115: RuntimeWarning: invalid value encountered in double_scalars precision = (confusion_matrix[id, id] / total_predicted) confusion_matrix.py:116: RuntimeWarning: invalid value encountered in double_scalars recall = (confusion_matrix[id, id] / totaltarget) category precision@0.5IOU recall_@0.5IOU 0 Her2 NaN NaN 1 LuminalA NaN NaN 2 LuminalB NaN NaN 3 Triple NaN NaN

svpino commented 4 years ago

Can you provide more information so I can try to reproduce your problem?

MuhammadAliShahzad commented 4 years ago

@svpino This is a division by Zero error. on line 121 precision = float(confusion_matrix[id, id] / total_predicted) If you fix the division by zero, this should solve the problem if total_predicted == 0: precision = 0.0 else: precision = float(confusion_matrix[id, id] / total_predicted)

svpino commented 4 years ago

Feel free to send a Pull request. I'll review and merge it.

Thanks!

svpino.

On Tue, Feb 18, 2020 at 4:43 PM MuhammadAliShahzad notifications@github.com wrote:

@svpino https://github.com/svpino This is a division by Zero error. on line 121 precision = float(confusion_matrix[id, id] / total_predicted) If you fix the division by zero, this should solve the problem if total_predicted == 0: precision = 0.0 else: precision = float(confusion_matrix[id, id] / total_predicted)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/svpino/tf_object_detection_cm/issues/22?email_source=notifications&email_token=AAITCSSBGT2XXXH5ESO7C3LRDRI6PA5CNFSM4KIUMPCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFKS2A#issuecomment-587901288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITCST7AMMK2VGGRH5WWWDRDRI6PANCNFSM4KIUMPCA .

ghost commented 4 years ago

Hi @svpino if i have ground truth and prediction value both in txt file then how can i used your repo? can you please explained me. Help is deep appreciate