8000 GitHub - rohban-lab/COBRA
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rohban-lab/COBRA

Repository files navigation

Mitigating Spurious Negative Pairs for Robust Industrial Anomaly Detection

This repository contains the official PyTorch implementation of our ICLR 2025 paper:
"Mitigating Spurious Negative Pairs for Robust Industrial Anomaly Detection"
by Hossein Mirzaie, Mojtaba Nafez, Jafar Habibi, Mohammad Sabokrou, and Mohammad Hossein Rohban.


🚀 Colab Notebook

For a quick start, try out our training and inference pipeline directly in Google Colab:
👉 Launch Colab Notebook


📁 Datasets

Below are the datasets used in our experiments:


📦 Requirements

Install the required dependencies using:

pip install -r requirements.txt

🏋️‍♂️ Training

In the Colab file, you can find the exact arguments used for both high and low-resolution datasets.

🔹 One-Class Anomaly Detection

To train a one-class anomaly detection model, run:

python train.py --train_time_adv_evaluate --train_time_clean_evaluate \
--one_class_idx $class_num --evaluate_save_step $evaluate_save_step \
--dataset $dataset --model $model --epochs $epochs --batch_size $batch_size \
--epsilon $train_epsilon

Arguments:

  • one_class_idx: Specifies the in-distribution class for one-class training.
  • epsilon: Controls PGD strength during training.

🔹 Unlabeled Multi-Class Anomaly Detection

To train our unlabeled multi-class setup (code & example coming soon):

# Coming soon

📊 Evaluation

In the Colab file, you can find the exact arguments used for both high and low-resolution datasets.

🔹 One-Class Evaluation

python eval.py --out_attack --in_attack \
--one_class_idx $class_num --dataset $dataset --model $model \
--print_score --eps $eval_epsilon --load_path $model_path \
--batch_size $batch_size --test_batch_size $batch_size

Options:

  • out_attack: Apply PGD-100 only on anomalous samples.
  • in_attack: Apply PGD-100 o 62D4 nly on normal samples.
  • one_class_idx: Specifies the target class for evaluation.
  • Use resize_factor and resize_fix to control cropping with RandomResizedCrop().

🔹 Unlabeled Multi-Class Evaluation

# Coming soon

📌 Citation

If you find this work helpful, please consider citing:

@inproceedings{
mirzaei2025adversarially,
title={Adversarially Robust Anomaly Detection through Spurious Negative Pair Mitigation},
author={Hossein Mirzaei and Mojtaba Nafez and Jafar Habibi and Mohammad Sabokrou and Mohammad Hossein Rohban},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=t8fu5m8R5m}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0