Home

Awesome

Adversarially Learned One-Class Classifier for Novelty Detection (ALOCC-CVPR2018)

[CVPR Poster] [presentation] [Project] [Paper] [tensorflow code] [keras code]

This work was inspired by the success of generative adversarial networks (GANs) for training deep models in unsupervised and semi-supervised settings. We proposed an end-to-end architecture for one-class classification. The architecture is composed of two deep networks, each of which trained by competing with each other while collaborating to understand the underlying concept in the target class, and then classify the testing samples. One network works as the novelty detector, while the other supports it by enhancing the inlier samples and distorting the outliers. The intuition is that the separability of the enhanced inliers and distorted outliers is much better than deciding on the original samples.

Here is the preliminary version of the code on grayscale databases.

Please feel free to contact me if you have any questions.

overview

<p align="center"><img src='imgs/overview.jpg'></p>

Note: The current software works well with TensorFlow 1.2

Prerequisites

Getting Started

Installation

# GPU version
pip install tensorflow-gpu

#CPU version
pip install tensorflow
pip install numpy scipy scikit-image imageio matplotlib pillow
git clone https://github.com/khalooei/ALOCC-CVPR2018
cd ALOCC-CVPR2018
<p align="center"><img src='imgs/architecture.jpg'></p>

ALOCC train

mkdir dataset
cd dataset
wget http://www.svcl.ucsd.edu/projects/anomaly/UCSD_Anomaly_Dataset.tar.gz
tar -xzf UCSD_Anomaly_Dataset.tar.gz
# for train on UCSD and patch_size 45*45
python train.py --dataset UCSD --dataset_address ./dataset/UCSD_Anomaly_Dataset.v1p2/UCSDped2/Train --input_height 45 --output_height 45 

# for train on MNIST
python train.py --dataset mnist --dataset_address ./dataset/mnist/ --input_height 28 --output_height 28
<hr>

ALOCC's Cheat sheet

--dataset MyDataSetName --dataset_address ./pathOfMyDataSetName
--input_height 60 --output_height 60
<hr> - To view the training results, access them within the export directory.

ALOCC test

# for test on UCSD and patch_size 45*45 and some specific dir like ['Test004'], etc. We prefer to open test.py file and edit every thing that you want
python test.py --dataset UCSD --dataset_address ./dataset/UCSD_Anomaly_Dataset.v1p2/UCSDped2/Train --input_height 45 --output_height 45 

# for test on MNIST
python test.py --dataset mnist --dataset_address ./dataset/mnist/ --input_height 28 --output_height 28
<hr>

Apply a pre-trained model (ALOCC)

./checkpoints/{datasetname}_{batch_size}_{patch_size}
<hr>

MNIST

input: <br> <img src='imgs/MNIST__ALOCC_input.jpg' align="center" width=384> <br> Generated: <br> <img src='imgs/MNIST__ALOCC_generated.jpg' align="center" width=384>

UCSD

input: <br> <img src='imgs/UCSD__ALOCC_input.jpg' align="center" width=384> <br> Generated: <br> <img src='imgs/UCSD__ALOCC_generated.jpg' align="center" width=384>

<hr>

Citation

If you use this code or idea for your research, please cite our papers.

@inproceedings{sabokrou2018adversarially,
  title={Adversarially Learned One-Class Classifier for Novelty Detection},
  author={Sabokrou, Mohammad and Khalooei, Mohammad and Fathy, Mahmood and Adeli, Ehsan},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={3379--3388},
  year={2018}
}