Automatic Diffusion Models for Anomaly Detection
The introduction of diffusion models in anomaly detection has paved the way for more effective and accurate image reconstruction in pathologies. Diffusion models work by iteratively adding noise to the inputs and then de-noising them back to the original input. The intuition behind using these models for the task of unsupervised anomaly detection is that the noising process disrupts the anomalies and the reconstructions would only include healthy samples. See the de-noising process below:
However, diffusion models pose a significant challenge to accurate anomaly detection. One important parameter that needs to be tuned is the amount of noise added before the de-noising process. This can be controlled by the noise level parameter $t$. The larger $t$, the more the image is disturbed and the probability of removing the anomalous tissues increases. However, the added noise disrupts the whole image, resulting in the inability to reconstruct healthy tissues accurately and introducing false positive detection. We refer to this challenge as the noise paradox of diffusion models which can be visualised below:
Furthermore, different anomaly distributions reach the optimum detection using different noise levels or different noise types, e.g. Simplex noise works better for larger anomalies, but falls short in detecting subtle lesions. We refer to this challenge as the unknown unknownness dilemma, as the true anomaly distribution at inference time should remain unknown.
In this project, we propose to mitigate these challenges using automatic masking. We, therefore, require a single pre-trained diffusion model and considerably improve the results by doing smart sampling. See below the proposed method. We first generate initial anomaly likelihood maps from differences between inputs and pseudo-healthy reconstruction from heavily noised inputs ($t=200$). We then refine the initial estimate by systematically adding more ‘healthy’ original context to the reconstruction, which we harmonize and in-paint, by performing re-sampling:
Through this, we are able to preserve original healthy tissue, while replacing anomalous regions with pseudo-healthy generations. This allows us to produce accurate pseudo-healthy reconstructions and effectively localize anomalies:
Curious to know more about this project? Check our publications below.