cuteboyqq / Skip-SelfAttension-GANomaly-Pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skip-SelfAttension-GANomaly-Pytorch

(Back to top)

Generator + Discriminator model

Table of contents

Requirement

pip install -r requirements.txt

implement

(Back to top)

  1. Encoder-Decoder use Unet
  2. Use self-Attension

image

Unet-Network

(Back to top) image

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_abnormal1

Lose-value-distribution

(Back to top)

Blue : normal dataset

Orange : abnormal dataset

loss_distribution

Reference

(Back to top)

https://arxiv.org/abs/1805.06725

https://arxiv.org/pdf/1901.08954.pdf

About


Languages

Language:Python 100.0%