Matic Fučka, Vitjan Zavrtanik, Danijel Skočaj
University of Ljubljana, Faculty of Computer and Information Science
Overview | Get Started | Results | Reference | Questions
This repository contains official PyTorch implementation for SALAD - Semantics-Aware Logical Anomaly Detection (Accepted to ICCV 2025).
SALAD (Semantics-Aware Logical Anomaly Detection) extends surface anomaly detection to capture both structural (scratches, dents) and logical (missing/misplaced parts) anomalies. First, we introduce a novel composition map generation process, that enables direct extraction of composition maps from the image without the need for hand labels or category-specific procedures.
Second, it introduces a compositional branch that learns the normality distribution of object composition maps. SALAD sets a new state-of-the-art on MVTec LOCO (96.1% AUROC).
Create a Python environment and install required packages:
conda create -n SALAD python=3.10 pip
conda activate SALAD
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install opencv-python
pip install segment-anything
pip install segment-anything-hq
pip install scikit-learn
pip install timm
pip install positional-encodings[pytorch]
pip install imgaug
pip install numpy==1.26
pip install pandasDownload MVTec LOCO from this link or via the supplemented script:
./download_loco.shAlready generated composition maps can be downloaded via the following script:
./download_composition_maps.shIn the case you wish to generate your own composition maps first generate background masks with SAM (download the pretrained weights using the script download_sam.sh) run:
python python create_fg_masks.pyThen create the pseudo labels with:
python python create_pseudo_labels.py --category <category_name>In the end train a composition map segmentation model with:
python train_composition_segmentation_model.py --category <category_name>Run the training and evaluation with:
python train_salad.py --category <category_name>NOTE: ImageNet has to be downloaded to enable training of EfficientAD.
Run evaluation only:
python test_salad.py --category <category_name>Download the pretrained weights using the following script:
./download_pretrained_weights.shand evaluate it with the evaluation command above.
If you found this work useful, consider citing our paper and giving this repo a ⭐ 😃
@InProceedings{fucka_salad,
title={{SALAD} -- {S}emantics-{A}ware {L}ogical {A}nomaly {D}etection},
author={Fu{\v{c}}ka, Matic and Zavrtanik, Vitjan and Sko{\v{c}}aj, Danijel},
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
year={2025},
month={October}
}For issues or questions, please open a GitHub issue or email the author directly.
Thanks to ComAD and EfficientAD for inspiration.


