https://github.com/FeliMe/residual-score-pitfalls
This repository contains experiments that investigate the pitfalls of residual-based models for anomaly segmentation
https://github.com/FeliMe/residual-score-pitfalls
Last synced: about 1 month ago
JSON representation
This repository contains experiments that investigate the pitfalls of residual-based models for anomaly segmentation
- Host: GitHub
- URL: https://github.com/FeliMe/residual-score-pitfalls
- Owner: FeliMe
- License: mit
- Created: 2021-10-27T07:00:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-15T15:18:14.000Z (over 3 years ago)
- Last Synced: 2024-07-31T20:42:14.371Z (9 months ago)
- Language: Python
- Homepage:
- Size: 176 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Official Repository of: "On the Pitfalls of Using the Residual Error as Anomaly Score"
This repository contains the code to reproduce the experiments from the paper.
Abstract: *Many current state-of-the-art methods for anomaly detection in medical images rely on calculating a residual image between a potentially anomalous input image and its ("healthy") reconstruction. As the reconstruction of the unseen anomalous region should be erroneous, this yields large residuals as a score to detect anomalies in medical images. However, this assumption does not take into account residuals resulting from imperfect reconstructions of the machine learning models used. Such errors can easily overshadow residuals of interest and therefore strongly question the use of residual images as scoring function. Our work explores this fundamental problem of residual images in detail. We theoretically define the problem and thoroughly evaluate the influence of intensity and texture of anomalies against the effect of imperfect reconstructions in a series of experiments.*
## 1. Download and Prepare Data
Download the data from [https://www.synapse.org/#!Synapse:syn21343101/files/](https://www.synapse.org/#!Synapse:syn21343101/files/) and split it into a training and a test set using
```
python dataset.py
```## 2. Run the Experiments
For experiment 3, you will need to train some machine learning models.
Experiment tracking and checkpointing is done with Weights & Biases ([https://wandb.ai](https://wandb.ai)), you can create a free account there and change the account information in `train_autoencoder.py`, `train_vqvae.py`, `models.py`, and `vqvae.py`.## 3. Results
The results of our experiment indicate that there are major flaws with using the pixel-wise residual as an anomaly score in medical grayscale images. Detection performance drops significantly if the intensities of anomal pixels are in regions well covered by normal pixels.
Before histogram equalization:
![]()
![]()
After histogram equalization:
![]()
![]()
This Figures above show reduced anomaly segmentation performance (measured in average precision) when the intensity of the anomaly is in an area well covered by normal pixel intensities.