CVLAB-Unibo / crossmodal-feature-mapping

Other
35 stars 3 forks source link

Multimodal Industrial Anomaly Detection by Crossmodal Feature Mapping (CVPR 2024)


:rotating_light: This repository contains download links to the datasets, code snippets, and checkpoints of our work "Multimodal Industrial Anomaly Detection by Crossmodal Feature Mapping", CVPR 2024

by Alex Costanzino*, Pierluigi Zama Ramirez*, Giuseppe Lisanti, and Luigi Di Stefano. * Equal Contribution

University of Bologna

[Project Page](https://cvlab-unibo.github.io/CrossmodalFeatureMapping/) | [Paper](https://arxiv.org/abs/2312.04521)

## :bookmark_tabs: Table of Contents 1. [Introduction](#clapper-introduction) 2. [Datasets](#file_cabinet) 3. [Checkpoints](#inbox_tray) 4. [Code](#memo-code) 6. [Contacts](#envelope-contacts)

:clapper: Introduction

Recent advancements have shown the potential of leveraging both point clouds and images to localize anomalies. Nevertheless, their applicability in industrial manufacturing is often constrained by significant drawbacks, such as the use of memory banks, which lead to a substantial increase in terms of memory footprint and inference time. We propose a novel light and fast framework that learns to map features from one modality to the other on nominal samples and detect anomalies by pinpointing inconsistencies between observed and mapped features. Extensive experiments show that our approach achieves state-of-the-art detection and segmentation performance, in both the standard and few-shot settings, on the MVTec 3D-AD dataset while achieving faster inference and occupying less memory than previous multimodal AD methods. Furthermore, we propose a layer pruning technique to improve memory and time efficiency with a marginal sacrifice in performance.

Alt text

:fountain_pen: If you find this code useful in your research, please cite:

@inproceedings{costanzino2024cross,
    title = {Multimodal Industrial Anomaly Detection by Crossmodal Feature Mapping},
    author = {Costanzino, Alex and Zama Ramirez, Pierluigi and Lisanti, Giuseppe and Di Stefano, Luigi},
    booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
    note = {CVPR},
    year = {2024},
}

:file_cabinet: Datasets

In our experiments, we employed two datasets featuring rgb images and point clouds: MVTec 3D-AD and Eyecandies. You can preprocess them with the scripts contained in processing.

:inbox_tray: Checkpoints

Here, you can download the weights of CFMs employed in the results of Table 1 and Table 2 of our paper.

To use these weights, please follow these steps:

  1. Create a folder named checkpoints/checkpoints_CFM_mvtec in the project directory;
  2. Download the weights [Download];
  3. Copy the downloaded weights into the checkpoints_CFM_mvtec folder.

:memo: Code

**Warning**: - The code utilizes `wandb` during training to log results. Please be sure to have a wandb account. Otherwise, if you prefer to not use `wandb`, disable it in `cfm_training.py` with the `flag mode = 'disabled'`.

:hammer_and_wrench: Setup Instructions

Dependencies: Ensure that you have installed all the necessary dependencies. The list of dependencies can be found in the ./requirements.txt file.

:rocket: Inference CFMs

The cfm_inference.py script test the CFMs. It can be used to generate anomaly maps.

You can specify the following options:

You can reproduce the results of Table 1 and Table 2 of the paper by running 02_eval_mvtec.sh.

If you haven't downloaded the checkpoints yet, you can find the download links in the Checkpoints section above.

:rocket: Train CFMs

To train CFMs refer to the example in 01_train_mvtec.sh and 03_train_eyecandies.sh.

The cfm_training.py script train the CFMs.

You can specify the following options:

:envelope: Contacts

For questions, please send an email to alex.costanzino@unibo.it or pierluigi.zama@unibo.it.

:pray: Acknowledgements

We would like to extend our sincere appreciation to the authors of the following projects for making their code available, which we have utilized in our work: