anomalib
anomalib copied to clipboard
pixel metrics calculation process bugs
Once I tried to get pixel metrics like "precision" and "recall", so I set the config in .yaml file as following:
metrics:
image:
- F1Score
- AUROC
pixel:
- Precision
- F1Score
- Recall
threshold:
image_default: 3
pixel_default: 15
adaptive: false
But finally I got just "precision" value while the "f1 score" and "recall" as 0.0000
So I changed the code in anomalib/utils/metrics/collection.py as following:
def update(self, *args, **kwargs) -> None:
"""Add data to the metrics."""
# super().update(*args, **kwargs) # remove this line
# my addition
for metric in self.values():
if callable(getattr(metric, 'update')):
getattr(metric, 'update')(*args, **kwargs)
###
self._update_called = True
Then I got correct results.
Are you using the latest changes from the development branch? Just adding Precision
to the config.yaml works when I try it. Here are my changes
Hi @MacavityT, can you provide the details of your system. Hardware, software. When I try this on my system with the default settings, it works as well. Here is my configuration;
And here is the results
@samet-akcay I also met this problem on my machine. I want to add metrics as A、P、R to code, but A、P、R always got value 0.0 or 1.0 in the log. Was this a bug?How can I solve it?
metrics:
image:
- F1Score
- AUROC
- Accuracy
- Precision
- Recall
pixel:
- F1Score
- AUROC
threshold:
image_default: 0
pixel_default: 0
adaptive: true
My machine's setting is Windows 10 home Chinese--AMD Ryzen 5 4600H--anomalib Version0.3.3.
I am closing this as this is not reproducible in the current version on Anomalib.