ganomaly
1.0.0
此存储库不再保留。 Ganomaly实施已添加到Anomalib,这是最大的公共收藏集合,即现成的深度学习异常检测算法和基准数据集。
该存储库包含以下论文的Pytorch实施:Ganomaly:通过对抗训练的半监督异常检测[1]
git clone https://github.com/samet-akcay/ganomaly.git
conda create -n ganomaly python=3.7
conda activate ganomaly
conda install -c intel mkl_fft
pip install --user --requirement requirements.txt
要复制MNIST和CIFAR10数据集的论文中的结果,请运行以下命令:
# MNIST
sh experiments/run_mnist.sh
# CIFAR
sh experiments/run_cifar.sh # CIFAR10 要列出参数,请运行以下命令:
python train.py -h
要在MNIST数据集上训练该模型的给定异常类,请运行以下内容:
python train.py
--dataset mnist
--niter <number-of-epochs>
--abnormal_class <0,1,2,3,4,5,6,7,8,9>
--display # optional if you want to visualize
要在CIFAR10数据集上训练该模型的给定异常类,请运行以下内容:
python train.py
--dataset cifar10
--niter <number-of-epochs>
--abnormal_class
<plane, car, bird, cat, deer, dog, frog, horse, ship, truck>
--display # optional if you want to visualize
要在自定义数据集上训练模型,应将数据集复制到./data目录中,并应具有以下目录和文件结构:
Custom Dataset
├── test
│ ├── 0.normal
│ │ └── normal_tst_img_0.png
│ │ └── normal_tst_img_1.png
│ │ ...
│ │ └── normal_tst_img_n.png
│ ├── 1.abnormal
│ │ └── abnormal_tst_img_0.png
│ │ └── abnormal_tst_img_1.png
│ │ ...
│ │ └── abnormal_tst_img_m.png
├── train
│ ├── 0.normal
│ │ └── normal_tst_img_0.png
│ │ └── normal_tst_img_1.png
│ │ ...
│ │ └── normal_tst_img_t.png
然后,模型培训与上面解释的培训MNIST或CIFAR10数据集相同。
python train.py
--dataset <name-of-the-data>
--isize <image-size>
--niter <number-of-epochs>
--display # optional if you want to visualize
有关更多培训选项,请运行python train.py -h 。
如果您使用此存储库或想引用该论文,请使用以下Bibtex条目
@inproceedings{akcay2018ganomaly,
title={Ganomaly: Semi-supervised anomaly detection via adversarial training},
author={Akcay, Samet and Atapour-Abarghouei, Amir and Breckon, Toby P},
booktitle={Asian Conference on Computer Vision},
pages={622--637},
year={2018},
organization={Springer}
}
[1] Akcay S.,Atapour-Abarghouei A.,Breckon TP(2019)Ganomaly:通过对抗训练对半监视的异常检测。在:Jawahar C.,Li H.,Mori G.,Schindler K.(eds)计算机视觉 - ACCV2018。ACCV2018。