tf_object_detection_cm icon indicating copy to clipboard operation
tf_object_detection_cm copied to clipboard

RuntimeWarning: invalid value encountered in double_scalars

Open acikgozf opened this issue 5 years ago • 4 comments

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] / total_target) category [email protected] [email protected] 0 Her2 NaN NaN 1 LuminalA NaN NaN 2 LuminalB NaN NaN 3 Triple NaN NaN

acikgozf avatar Jan 18 '20 18:01 acikgozf

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

svpino avatar Jan 19 '20 23:01 svpino

@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)

MuhammadAliShahzad avatar Feb 18 '20 21:02 MuhammadAliShahzad

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 [email protected] 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 .

svpino avatar Feb 18 '20 22:02 svpino

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

ghost avatar Aug 08 '20 09:08 ghost