GithubHelp home page GithubHelp logo

attentionnet_adgan's Introduction

Attention-Map-Guided-Two-stage-Anomaly-Detection-using-Hard-Augmentation-Pytorch

(Back to menu)

Anomaly Detection Network

implement from paper Attention Map-Guided Two-stage Anomaly Detection using Hard Augmentation https://arxiv.org/pdf/1805.08318.pdf , l just implement Attention Network .

The Attention Network is able to generate Attention maps that show which part of region in image is anomaly and normal,

and able to find anomaly images by loss value, it means if loss value is greater than particular loss threshold, it will regard as anomaly image

but the acc is lower than skip-Attention GANomaly, so need ADGAN to further detect anomaly images.

below image ref. from paper https://arxiv.org/pdf/1805.08318.pdf

image

Implement-Issue

(Back to menu)

-Generate fake image have some black images

-Train attetion failed if the input_attn = 1, but succeed when input_attn=empty

-The cutout augmentation is not real, needs to further implement paper method

-Maybe it is not easy to implement in tensorflow2

-The loss function is not same as paper, maybe result in false result

Hard-Augmentation

l just implement cutout augmgnetation...

(Back to menu)

Generator + Discriminator model

Table of contents

Requirement

pip install -r requirements.txt

implement

(Back to menu)

SkipCBAM-AutoEncoder

(Back to menu)

  1. implement skip-CBAM-GANomaly first, and then start adding self-Attention into skip-CBAM-GANomaly network

CBAM-ori

Self-Attention

(Back to menu)

below image is self-Attention network , ref. from paper https://arxiv.org/pdf/1805.08318.pdf

image

AttentionNetwork

(Back to menu) CBAM

ADGAN

(Back to menu)

Ongoing~~~~

Train-on-custom-dataset

(Back to menu)

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 menu)

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

image

Test

(Back to menu)

python test.py --nomal-dir "[test normal dataset dir]" --abnormal-dir "[test abnormal dataset dir]" --view-img --img-size 32

Lose-value-distribution

(Back to menu)

Blue : normal dataset

Orange : abnormal dataset

image

image

image

Reference

(Back to menu)

GANomaly: Semi-Supervised Anomaly Detection via Adversarial Training

https://arxiv.org/abs/1805.06725

Skip-GANomaly: Skip Connected and Adversarially Trained Encoder-Decoder Anomaly Detection

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

Attention Map-Guided Two-stage Anomaly Detection using Hard Augmentation

https://arxiv.org/pdf/1805.08318.pdf

attentionnet_adgan's People

Contributors

cuteboyqq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.