cuteboyqq / Skip-Attention-GANomaly-tf2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skip-Attension-GANomaly-tensorflow2

(Back to top)

Generator + Discriminator model

Table of contents

Requirement

pip install -r requirements.txt

implement

(Back to top)

Unet

(Back to top)

image

CBAM-Convolutional-Block-Attention-Module

(Back to top)

image

Channel-Attension-module

(Back to top)

image

Spatial-Attension-module

(Back to top)

image

Train-on-custom-dataset

(Back to top)

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

(Back to top)

python train.py --img-dir "[train dataset dir]" --batch-size 64 --img-size 32 --epoch 20

Test

(Back to top)

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 infer_normal1

dataset :factory noline , top: input images, bottom: reconstruct images infer_abnormal3

Lose-value-distribution

(Back to top)

Blue : normal dataset

Orange : abnormal dataset

train 128x128

loss_distribution

Reference

(Back to top)

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

About


Languages

Language:Python 64.9%Language:Jupyter Notebook 34.8%Language:Dockerfile 0.3%