anomalib
anomalib copied to clipboard
Allow passing metrics objects directly to `create_metrics_collection`
๐ Description
- Adds the ability to pass metric objects directly.
- Alternative to solution proposed in https://github.com/openvinotoolkit/anomalib/issues/2205
To test
from torchmetrics.classification import Accuracy, Precision, Recall
from anomalib.data import MVTec
from anomalib.engine import Engine
from anomalib.models import Padim
if __name__ == "__main__":
model = Padim()
data = MVTec()
engine = Engine(image_metrics=[Accuracy(task="binary"), Precision(task="binary"), Recall(task="binary")])
engine.train(model, datamodule=data)
โจ Changes
Select what type of change your PR is:
- [ ] ๐ Bug fix (non-breaking change which fixes an issue)
- [x] ๐จ Refactor (non-breaking change which refactors the code base)
- [ ] ๐ New feature (non-breaking change which adds functionality)
- [ ] ๐ฅ Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] ๐ Documentation update
- [ ] ๐ Security update
โ Checklist
Before you submit your pull request, please make sure you have completed the following steps:
- [ ] ๐ I have summarized my changes in the CHANGELOG and followed the guidelines for my type of change (skip for minor changes, documentation updates, and test enhancements).
- [ ] ๐ I have made the necessary updates to the documentation (if applicable).
- [ ] ๐งช I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).
For more information about code review checklists, see the Code Review Checklist.