Git Product home page Git Product logo

cman_pytorch's Introduction

Code_CMAN

This is the source code of our work "Cognitive Memory-Augmented Network for Visual Anomaly Detection".

network

Installation and Requirements

Installation

We recommended the following dependencies:

  • python 3.6
  • numpy 1.16.2
  • torch 1.3.1
  • ptable 0.9.2
  • scikit-learn 0.22.2
  • tqdm 4.42.1
  • scipy 1.1.0

Testing

Datasets and Checkpoints

  • MNIST and CIFAR-10 will be downloaded for you by torchvision.

  • Checkpoints for mnist and cifar10 datasets are available here (code: z9jt).

  • The folder structure of checkpoints is listed as follow.

  |-- checkpoints',
    |-- mem_cifar',
    |   |-- 0.pkl',
    |   |-- 1.pkl',
    |   |-- 2.pkl',
    |   |-- 3.pkl',
    |   |-- 4.pkl',
    |   |-- 5.pkl',
    |   |-- 6.pkl',
    |   |-- 7.pkl',
    |   |-- 8.pkl',
    |   |-- 9.pkl',
    |-- mem_mnist',
        |-- 0.pkl',
        |-- 1.pkl',
        |-- 2.pkl',
        |-- 3.pkl',
        |-- 4.pkl',
        |-- 5.pkl',
        |-- 6.pkl',
        |-- 7.pkl',
        |-- 8.pkl',
        |-- 9.pkl',

Run!

Once your setup is complete, running tests is as simple as running test.py. Usage:

usage: python test.py [-h] [--dataset DATASET] [--path PATH]
                      [--checkpoints CHECKPOINTS]

optional arguments:
  -h, --help  show this help message and exit
  --dataset, DATASET  The name of the dataset to perform tests. 
                      Choose among `mnist`, 'cifar' (default: None)
  --path, PATH        The file path of the dataset to perform tests.
                      (default: None)
  --checkpoints, CHECKPOINTS
                      The checkpoints path of the dataset to perform tests.
                      (default: None)

Example:

Testing on MNIST dataset.

python test.py --dataset 'mnist' --path 'dataset_path' --checkpoints 'checkpoints/mem_mnist'

Testing on CIFAR10 dataset.

python test.py --dataset 'cifar10' --path 'dataset_path' --checkpoints 'checkpoints/mem_cifar10'

Results

Experimental details is explained in our paper "Cognitive Memory-Augmented Network for Visual Anomaly Detection". We list some of the experimental results as follows.

Video Dataset

We have performed the proposed method on video dataset. The AUC results of different methods are listed as follow:

video_result

And the examples of score results, obtained by the proposed CMAN method on UCSD Ped2 and ShanghaiTech datasets, are listed as follow:

examples

Image Dataset

We have also performed the proposed method on image dataset. The AUC results of different methods are listed as follows:

mnist_result

cifar10_result

Visual inspection task

We have also conducted a visual inspection experiment on the MVTec dataset, compared with stateof-the-art methods. The performance of the proposed method on visual inspection task is listed as follow:

mvtec_result

This code follows the basic structure from Latent Space Autoregression for Novelty Detection and memae-anomaly-detection.

cman_pytorch's People

Contributors

cman-code avatar

Watchers

James Cloos 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.