Skip-Attension-GANomaly-tensorflow2
Generator + Discriminator model
Table of contents
- Skip-Attension-GANomaly-Pytorch
- Requirement
- implement
- Train-on-custom-dataset
- Train
- Test
- Lose-value-distribution
- Reference
Requirement
pip install -r requirements.txt
implement
Unet
CBAM-Convolutional-Block-Attention-Module
Channel-Attension-module
Spatial-Attension-module
Train-on-custom-dataset
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
Train
python train.py --img-dir "[train dataset dir]" --batch-size 64 --img-size 32 --epoch 20
Test
python test.py --nomal-dir "[test normal dataset dir]" --abnormal-dir "[test abnormal dataset dir]" --view-img --img-size 32
Example : Train dataset : factory line only
dataset :factory line , top: input images, bottom: reconstruct images
dataset :factory noline , top: input images, bottom: reconstruct images
Lose-value-distribution
Blue : normal dataset
Orange : abnormal dataset
train 128x128
Reference
GANomaly: Semi-Supervised Anomaly Detection via Adversarial Training
https://arxiv.org/abs/1805.06725
CBAM: Convolutional Block Attention Module
https://arxiv.org/pdf/1807.06521.pdf
SAGAN: Skip-Attention GAN For Anomaly Detection
http://personal.ee.surrey.ac.uk/Personal/W.Wang/papers/LiuLZHW_ICIP_2021.pdf