Industrial KNN Anomaly Detection
🔗 Github repo 🔗 Streamlit demo 🔗 Paperwith code submission
This project contains the implementation of three anomaly detection methods for visual inspection:
- SPADE (Cohen et al. 2021) - knn in the latent space and distance to feature maps.
- PaDiM* (Defard et al. 2020) - (Mahalanobis) distance to multivariate Gaussian of feature maps.
- PatchCore (Roth et al. 2021) - knn in the latent space by distance to avg-pooled feature columns.
The great thing about these models is that they don't need weight optimization and only use normal/healthy training samples. This means that we can leverage pretrained vision backbones out of the box. Moreover, it was possible to make some very nice abstractions since the methods mostly differ in their heads and the way they run inference.
The models are backbone-agnostic and coupled with the Pytorch image models library. This means you can easily do some sweeps and keep your models up to date with the cutting edge.