Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"[BUG]: NaN metric values" #569

Open
FatemehEsfahani opened this issue Jun 13, 2024 · 0 comments
Open

"[BUG]: NaN metric values" #569

FatemehEsfahani opened this issue Jun 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@FatemehEsfahani
Copy link

Describe the bug
When a class does not show up in a batch, the corresponding row in the confusing matrix becomes zero. As a result, division by zero happens and performance metrics for that class becomes NaN.

# Calculate metrics from the confusion matrix:

To Reproduce
Steps to reproduce the behavior:

  1. Test with an image whose label has 3 classes including background class (i.e. class_0, class_1, class_2) in which only class_0 and class_1 are available.

Expected behavior
The metric calculation should handle division by zero and set a value (i.e., 0) when a class is absent.

Screenshots
Example of the confusion matrix for a batch:
image
Then, the metrics for class_2, based on the following formula becomes NaN:
image

Additional context
Small epsilon value can be added in the denominator of each metric calculation formua to avoid devision by zero. Something like the following:
image

@FatemehEsfahani FatemehEsfahani added the bug Something isn't working label Jun 13, 2024
@FatemehEsfahani FatemehEsfahani changed the title "[BUG]: [BUG NAME]" "[BUG]: NaN metric values" Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant