Official implementation of MIAS-SAM

April 22, 2026 ยท View on GitHub

This is the official implementation of MIAS-SAM, published at BMVC 2025.

Setup and run

  1. Clone the repository
git clone anonymized_link
cd MIAS-SAM
  1. Install dependencies
python3 setup.py
  1. Prepare the data

Download the datasets (or prepare your own)

Dataset should have the following structure:

./datasets/{dataset}/train/good/{images} #Normal train data
./datasets/{dataset}/test/test/good/{images} #Normal test data
./datasets/{dataset}/test/test/Ungood/{images} #Anomalous test data
./datasets/{dataset}/test/test_labels/good/{images} #Empty normal GT (black images)
./datasets/{dataset}/test/test_labels/Ungood/{images} #Anomalous test data GT images

Download the pretarined weights of SAM (or your pretrained ones)

Place the weights under ./checkpoints

  1. Run the code!
python3 run_mias.py

Parameters:

device: Select the device to run the code {cuda}
dataset: name of the dataset {BRAIN}
size: dataloader desired shape
save: log images
load: load Faiss index

Results

Citation

If you find this work useful, please cite:

@inproceedings{colussi2025miassam,
  title     = {MIAS-SAM: Medical Image Anomaly Segmentation without thresholding},
  author    = {Colussi, Marco and Ahmetovic, Dragan and Mascetti, Sergio},
  booktitle = {Proceedings of the British Machine Vision Conference (BMVC)},
  year      = {2025},
  url       = {https://bmva-archive.org.uk/bmvc/2025/assets/papers/Paper_1121/paper.pdf}
}