Code repository for the 2025 MICCAI Workshop MLMI paper
Normal fine-grained tissue variability, such as that present in pulmonary anatomy, is a major challenge for existing generative anomaly detection (AD) methods.
Here, we propose a novel generative AD approach addressing this issue. It consists of an image-to-image translation for anomaly-free reconstruction and a subsequent patch similarity scoring between observed and generated image pairs for precise anomaly localization.
AREPAS uses two networks:
-
Reconstruction network
Designed to reconstruct the real image without anomalies from the Canny-edge representation of the observed image. -
Patch similarity network
A Siamese network trained using randomly sampled patch pairs:- Same spatial locations → label
1 - Different spatial locations → label
0
These patch pairs are used to train the network with a contrastive loss.
- Same spatial locations → label
During inference, an ensemble of patch-level similarity scores is computed from identical locations in the real and reconstructed image pairs and aggregated to obtain an anomaly heatmap.
The provided notebook contains a simplified demonstration of how to run AREPAS:
- Load the example dataset.
- Run the reconstruction network to generate anomaly-free images.
- Sample patch pairs from real and reconstructed images.
- Compute patch-level similarity scores.
- Aggregate scores to produce an anomaly heatmap.
See the notebook for detailed instructions and example outputs.