All Projects → shellysheynin → A-Hierarchical-Transformation-Discriminating-Generative-Model-for-Few-Shot-Anomaly-Detection

shellysheynin / A-Hierarchical-Transformation-Discriminating-Generative-Model-for-Few-Shot-Anomaly-Detection

Licence: other
Official pytorch implementation of the paper: "A Hierarchical Transformation-Discriminating Generative Model for Few Shot Anomaly Detection"

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to A-Hierarchical-Transformation-Discriminating-Generative-Model-for-Few-Shot-Anomaly-Detection

Remixautoml
R package for automation of machine learning, forecasting, feature engineering, model evaluation, model interpretation, data generation, and recommenders.
Stars: ✭ 159 (+278.57%)
Mutual labels:  supervised-learning, anomaly-detection
rails
Rails translation made _('simple').
Stars: ✭ 65 (+54.76%)
Mutual labels:  localization
deviation-network-image
Official PyTorch implementation of the paper “Explainable Deep Few-shot Anomaly Detection with Deviation Networks”, weakly/partially supervised anomaly detection, few-shot anomaly detection, image defect detection.
Stars: ✭ 47 (+11.9%)
Mutual labels:  anomaly-detection
UE4-BYGLocalization
Simple CSV localization system for Unreal Engine 4
Stars: ✭ 54 (+28.57%)
Mutual labels:  localization
hrt-bus-api
API and Map app that transform, store, and expose HRT Bus data through a RESTful HTTP endpoint. Python, Heroku, @bschoenfeld
Stars: ✭ 18 (-57.14%)
Mutual labels:  official
Yarhl
Yet Another ROM Hacking Library
Stars: ✭ 48 (+14.29%)
Mutual labels:  localization
anovos
Anovos - An Open Source Library for Scalable feature engineering Using Apache-Spark
Stars: ✭ 77 (+83.33%)
Mutual labels:  transformation
figma-static-localizer
A Figma plugin for static localization
Stars: ✭ 30 (-28.57%)
Mutual labels:  localization
pole-localization
Online Range Image-based Pole Extractor for Long-term LiDAR Localization in Urban Environments
Stars: ✭ 107 (+154.76%)
Mutual labels:  localization
spydrnet
A flexible framework for analyzing and transforming FPGA netlists. Official repository.
Stars: ✭ 49 (+16.67%)
Mutual labels:  transformation
designing-with-libreoffice
The work to translate Designing with LibreOffice book into traditional Chinese.
Stars: ✭ 17 (-59.52%)
Mutual labels:  localization
The-Supervised-Learning-Workshop
An Interactive Approach to Understanding Supervised Learning Algorithms
Stars: ✭ 24 (-42.86%)
Mutual labels:  supervised-learning
traffic
A quick and dirty vehicle speed detector using video + anomaly detection
Stars: ✭ 21 (-50%)
Mutual labels:  anomaly-detection
ailia-models
The collection of pre-trained, state-of-the-art AI models for ailia SDK
Stars: ✭ 1,102 (+2523.81%)
Mutual labels:  anomaly-detection
Localizr.swift
Simplified and automated Localization process library in IOS. Please check https://github.com/michaelhenry/Localizr for more info.
Stars: ✭ 18 (-57.14%)
Mutual labels:  localization
TRAR-VQA
[ICCV 2021] TRAR: Routing the Attention Spans in Transformers for Visual Question Answering -- Official Implementation
Stars: ✭ 49 (+16.67%)
Mutual labels:  official
translation-generator
Generate translation files for your Angular project
Stars: ✭ 17 (-59.52%)
Mutual labels:  localization
Cerebrum
Crossmodal Supervised Learning Toolkit using High-Performance Extreme Learning Machines over the audio-visual-textual data
Stars: ✭ 41 (-2.38%)
Mutual labels:  supervised-learning
XGBOD
Supplementary material for IJCNN paper "XGBOD: Improving Supervised Outlier Detection with Unsupervised Representation Learning"
Stars: ✭ 59 (+40.48%)
Mutual labels:  anomaly-detection
cargo-i18n
A Rust Cargo sub-command and libraries to extract and build localization resources to embed in your application/library
Stars: ✭ 88 (+109.52%)
Mutual labels:  localization

A Hierarchical Transformation-Discriminating Generative Model for Few Shot Anomaly Detection

Project | Arxiv

Official pytorch implementation of the paper: "HTDG: A Hierarchical Transformation-Discriminating Generative Model for Few Shot Anomaly Detection"

Abstract

Anomaly detection, the task of identifying unusual samples in data, often relies on a large set of training samples. In this work, we consider the setting of few-shot anomaly detection in images, where only a few images are given at training. We devise a hierarchical generative model that captures the multi-scale patch distribution of each training image. We further enhance the representation of our model by using image transformations and optimize scale-specific patch-discriminators to distinguish between real and fake patches of the image, as well as between different transformations applied to those patches. The anomaly score is obtained by aggregating the patch-based votes of the correct transformation across scales and image regions. We demonstrate the superiority of our method on both the one-shot and few-shot settings, on the datasets of Paris, CIFAR10, MNIST and FashionMNIST as well as in the setting of defect detection on MVTec. In all cases, our method outperforms the recent baseline methods.

Code

Install dependencies

python -m pip install -r requirements.txt

Train

To train the model on mvtec/paris/cifar/mnist/fashionMnist:

python main_train.py  --num_images <num_training_images>  --pos_class <normal_class_in_dataset> --index_download <index_of_training_image> --dataset <name_of_dataset>

Common training options:

--min_size                  image minimal size at the coarser scale (default 25)
--max_size                  image minimal size at the coarser scale (default 64)
--niter                     number of iterations to train per scale
--num_images                number of images to train on (1,5,10 in the paper)
--size_image                the original image size 
--fraction_defect           the number of patches to consider in defect detection (recommended arguments: 0.01-0.1)
--pos_class                 the normal class to train on
--dataset                   paris/cifar/mnist/fashionmnist/mvtec
--random_images_download    "True" if training random images from the normal class (otherwise, specify the index of the training image in --index_download)
--devices_ids                for 10shot we have used --device_ids = 0 1 

Results and applications

Illustration of classification decisions made by a single-shot model trained on the Paris dataset. The first column is the training sample, then are random samples generated by the trained generative model. The other columns present samples from the test set of the Paris dataset that are either true positive (TP), true negative (TN), false positive (FP) or false negative (TN).

The model can be also used for defect detection. For example, in the following image we show localization of defects in MVTec test images for one-shot defect detection. In the top row there are the original images, in which the anomaly region is delineated in red. In the bottom row, the localization provided by our method.

See section 3.3 in our paper for more details.

Citation

If you use this code for your research, please cite our paper

Acknowledgements

The implementation is based on the architecture of SinGAN

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].