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。