Official implementation of "Learning Not to Reconstruct" (BMVC 2021)

Overview

Official PyTorch implementation of "Learning Not to Reconstruct Anomalies"

This is the implementation of the paper "Learning Not to Reconstruct Anomalies" (BMVC 2021).

Dependencies

  • Python 3.6
  • PyTorch = 1.7.0
  • Numpy
  • Sklearn

Datasets

  • USCD Ped2 [dataset]
  • CUHK Avenue [dataset]
  • ShanghaiTech [dataset]
  • CIFAR-100 (for patch based pseudo anomalies)
  • ImageNet (for patch based pseudo anomalies)

Download the datasets into dataset folder, like ./dataset/ped2/, ./dataset/avenue/, ./dataset/shanghai/, ./dataset/cifar100/, ./dataset/imagenet/

Training

git clone https://github.com/aseuteurideu/LearningNotToReconstructAnomalies
  • Training baseline
python train.py --dataset_type ped2
  • Training patch based model
python train.py --dataset_type ped2 --pseudo_anomaly_cifar_inpainting_smoothborder 0.2 --max_size 0.5 --max_move 10
  • Training skip frame based model
python train.py --dataset_type ped2 --pseudo_anomaly_jump_inpainting 0.2 --jump 2 3 4 5

Select --dataset_type from ped2, avenue, or shanghai.

For more details, check train.py

Pre-trained models

  • Model in Table 1
Model Dataset AUC Weight
Baseline Ped2 92.49% [ drive ]
Baseline Avenue 81.47% [ drive ]
Baseline ShanghaiTech 71.28% [ drive ]
Patch based Ped2 94.77% [ drive ]
Patch based Avenue 84.91% [ drive ]
Patch based ShanghaiTech 72.46% [ drive ]
Skip frame based Ped2 96.50% [ drive ]
Skip frame based Avenue 84.67% [ drive ]
Skip frame based ShanghaiTech 75.97% [ drive ]
  • Various patch based models on Ped2 (Fig. 5(c))
Intruder Dataset Patching Technique AUC Weight
CIFAR-100 SmoothMixS 94.77% [ drive ]
ImageNet SmoothMixS 93.34% [ drive ]
ShanghaiTech SmoothMixS 94.74% [ drive ]
Ped2 SmoothMixS 94.15% [ drive ]
CIFAR-100 SmoothMixC 94.22% [ drive ]
CIFAR-100 CutMix 93.54% [ drive ]
CIFAR-100 MixUp-patch 94.52% [ drive ]

Evaluation

  • Test the model
python evaluate.py --dataset_type ped2 --model_dir path_to_weight_file.pth
  • Test the model and save result image
python evaluate.py --dataset_type ped2 --model_dir path_to_weight_file.pth --img_dir folder_path_to_save_image_results
  • Test the model and generate demonstration video frames
python evaluate.py --dataset_type ped2 --model_dir path_to_weight_file.pth --vid_dir folder_path_to_save_video_results

Then compile the frames into video. For example, to compile the first video in ubuntu:

ffmpeg -framerate 10 -i frame_00_%04d.png -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p video_00.mp4

Bibtex

@inproceedings{astrid2021learning,
  title={Learning Memory-guided Normality for Anomaly Detection},
  author={Astrid, Marcella and Zaheer, Muhammad Zaigham and Lee, Jae-Yeong and Lee, Seung-Ik},
  booktitle={BMVC},
  year={2021}
}

Acknowledgement

The code is built on top of code provided by Park et al. [ github ] and Gong et al. [ github ]

Owner
Marcella Astrid
PhD candidate at University of Science and Technology, ETRI campus, South Korea
Marcella Astrid
The source code for Generating Training Data with Language Models: Towards Zero-Shot Language Understanding.

SuperGen The source code for Generating Training Data with Language Models: Towards Zero-Shot Language Understanding. Requirements Before running, you

Yu Meng 38 Dec 12, 2022
πŸ… Top 5% in 제2회 μ—°κ΅¬κ°œλ°œνŠΉκ΅¬ 인곡지λŠ₯ κ²½μ§„λŒ€νšŒ AI SPARK μ±Œλ¦°μ§€

AI_SPARK_CHALLENG_Object_Detection 제2회 μ—°κ΅¬κ°œλ°œνŠΉκ΅¬ 인곡지λŠ₯ κ²½μ§„λŒ€νšŒ AI SPARK μ±Œλ¦°μ§€ πŸ… Top 5% in mAP(0.75) (443λͺ… 쀑 13λ“±, mAP: 0.98116) λŒ€νšŒ μ„€λͺ… Edge ν™˜κ²½μ—μ„œμ˜ κ°€μΆ• Object Dete

3 Sep 19, 2022
Improving Factual Consistency of Abstractive Text Summarization

Improving Factual Consistency of Abstractive Text Summarization We provide the code for the papers: "Entity-level Factual Consistency of Abstractive T

61 Nov 27, 2022
Deep Learning for Natural Language Processing SS 2021 (TU Darmstadt)

Deep Learning for Natural Language Processing SS 2021 (TU Darmstadt) Task Training huge unsupervised deep neural networks yields to strong progress in

Oliver Hahn 1 Jan 26, 2022
Code & Models for Temporal Segment Networks (TSN) in ECCV 2016

Temporal Segment Networks (TSN) We have released MMAction, a full-fledged action understanding toolbox based on PyTorch. It includes implementation fo

1.4k Jan 01, 2023
It helps user to learn Pick-up lines and share if he has a better one

Pick-up-Lines-Generator(Open Source) It helps user to learn Pick-up lines Share and Add one or many to the DataBase Unique SQLite DataBase AI Undercon

knock_nott 0 May 04, 2022
SegTransVAE: Hybrid CNN - Transformer with Regularization for medical image segmentation

SegTransVAE: Hybrid CNN - Transformer with Regularization for medical image segmentation This repo is the official implementation for SegTransVAE. Seg

Nguyen Truong Hai 4 Aug 04, 2022
This repository contains the code for the paper "PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization"

PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization News: [2020/05/04] Added EGL rendering option for training data g

Shunsuke Saito 1.5k Jan 03, 2023
A Deep Reinforcement Learning Framework for Stock Market Trading

DQN-Trading This is a framework based on deep reinforcement learning for stock market trading. This project is the implementation code for the two pap

61 Jan 01, 2023
Flaxformer: transformer architectures in JAX/Flax

Flaxformer is a transformer library for primarily NLP and multimodal research at Google.

Google 116 Jan 05, 2023
Implementation of average- and worst-case robust flatness measures for adversarial training.

Relating Adversarially Robust Generalization to Flat Minima This repository contains code corresponding to the MLSys'21 paper: D. Stutz, M. Hein, B. S

David Stutz 13 Nov 27, 2022
Relaxed-machines - explorations in neuro-symbolic differentiable interpreters

Relaxed Machines Explorations in neuro-symbolic differentiable interpreters. Baby steps: inc_stop Libraries JAX Haiku Optax Resources Chapter 3 (βˆ‚4: A

Nada Amin 6 Feb 02, 2022
Official implementation of EfficientPose

EfficientPose This is the official implementation of EfficientPose. We based our work on the Keras EfficientDet implementation xuannianz/EfficientDet

2 May 17, 2022
PyTorch code for the ICCV'21 paper: "Always Be Dreaming: A New Approach for Class-Incremental Learning"

Always Be Dreaming: A New Approach for Data-Free Class-Incremental Learning PyTorch code for the ICCV 2021 paper: Always Be Dreaming: A New Approach f

49 Dec 21, 2022
IDA file loader for UF2, created for the DEFCON 29 hardware badge

UF2 Loader for IDA The DEFCON 29 badge uses the UF2 bootloader, which conveniently allows you to dump and flash the firmware over USB as a mass storag

Kevin Colley 6 Feb 08, 2022
A Python Reconnection Tool for alt:V

altv-reconnect What? It invokes a reconnect in the altV Client Dev Console. You get to determine when your local client should reconnect when developi

8 Jun 30, 2022
Molecular Sets (MOSES): A benchmarking platform for molecular generation models

Molecular Sets (MOSES): A benchmarking platform for molecular generation models Deep generative models are rapidly becoming popular for the discovery

Neelesh C A 3 Oct 14, 2022
This repository stores the code to reproduce the results published in "TiWS-iForest: Isolation Forest in Weakly Supervised and Tiny ML scenarios"

TinyWeaklyIsolationForest This repository stores the code to reproduce the results published in "TiWS-iForest: Isolation Forest in Weakly Supervised a

2 Mar 21, 2022
DSAC* for Visual Camera Re-Localization (RGB or RGB-D)

DSAC* for Visual Camera Re-Localization (RGB or RGB-D) Introduction Installation Data Structure Supported Datasets 7Scenes 12Scenes Cambridge Landmark

Visual Learning Lab 143 Dec 22, 2022
Blender add-on: Add to Cameras menu: View β†’ Camera, View β†’ Add Camera, Camera β†’ View, Previous Camera, Next Camera

Blender add-on: Camera additions In 3D view, it adds these actions to the View|Cameras menu: View β†’ Camera : set the current camera to the 3D view Vie

German Bauer 11 Feb 08, 2022