ICME2023--A Semantic-awareness Normalizing Flow Model for Anomaly Detection.
Anomaly detection in computer vision aims to detect outliers from input image data. Examples include texture defect detection and semantic discrepancy detection. However, existing methods are limited in detecting both types of anomalies, especially for the latter. In this work, we propose a novel semantics-aware normalizing flow model to address the above challenges. First, we employ the semantic features extracted from a backbone network as the initial input of the normalizing flow model, which learns the mapping from the normal data to a normal distribution according to semantic attributes, thus enhances the discrimination of semantic anomaly detection. Second, we design a new feature fusion module in the normalizing flow model to integrate texture features and semantic features, which can substantially improve the fitting of the distribution function with input data, thus achieving improved performance for the detection of both types of anomalies. Extensive experiments on five well-known datasets for semantic anomaly detection show that the proposed method outperforms the state-of-the-art baselines.
- First clone the repository
git clone https://github.com/SYLan2019/SANF-AD.git
- Create the virtual environment via conda
conda create -n SANF-AD python=3.8
- Activate the virtual environment.
conda activate SANF-AD
- Install the dependencies.
pip install --user --requirement requirements.txt
All configurations concerning data, model, training etc, can be found in config.py. The default configuration will run a training with paper-given parameters on the Cifar10 dataset.
To replicate the results in the paper for CIFAR10 dataset, please set the paramater pretrained = False in config.py and run the following commands to extract features:
# CIFAR
python extractor.py
Then run the following code to train the model on the features of dataset Cifar10
python main.py