An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
Currently, min_max values for normalization are updated every validation epoch. This update keeps irrelevant values from previous epochs by comparing new and old ones:
self.max = torch.max(self.max, torch.max(predictions))
It seems like it does not affect most of the models, but with at least EfficientAD, the final anomaly maps after training are normalized the wrong way (see #2139 or this discussion).
This fix resets min_max values at the beginning of every validation epoch to ensure that only values from the recent one will be used for normalization.
๐ ๏ธ Fixes #2027, thank you @CarlosNacher for pointing this problem out! Partially fixes #2139.
โจ Changes
Select what type of change your PR is:
[x] ๐ Bug fix (non-breaking change which fixes an issue)
[ ] ๐จ 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).
๐ Description
Currently, min_max values for normalization are updated every validation epoch. This update keeps irrelevant values from previous epochs by comparing new and old ones:
self.max = torch.max(self.max, torch.max(predictions))
It seems like it does not affect most of the models, but with at least EfficientAD, the final anomaly maps after training are normalized the wrong way (see #2139 or this discussion).
This fix resets min_max values at the beginning of every validation epoch to ensure that only values from the recent one will be used for normalization.
๐ ๏ธ Fixes #2027, thank you @CarlosNacher for pointing this problem out! Partially fixes #2139.
โจ Changes
Select what type of change your PR is:
โ Checklist
Before you submit your pull request, please make sure you have completed the following steps:
For more information about code review checklists, see the Code Review Checklist.