Implementation of the paper Learning Deep Features for One-Class Classification, https://arxiv.org/abs/1801.05365.
Deep learning based one class classification code targeting one class image classification. Tests carried out on Abnormal image detection, Novel image detection and Active Authentication reported state of the art results.
This document outlines how to use the deep one-class classification source code. Author : Pramuditha Perera (pramuditha.perera@rutgers.edu)
If you found this code useful please cite our paper:
@ARTICLE{2018arXiv180105365P,
author = {{Perera}, P. and {Patel}, V.~M.},
title = "{Learning Deep Features for One-Class Classification}",
journal = {ArXiv e-prints},
archivePrefix = "arXiv",
eprint = {1801.05365},,
year = 2018,
month = jan,
}
Two sub directories 'Abnormal_Object_Dataset' and 'Normal_Object_Dataset' should exist in caffe/data. Each sub folder (of each class) should ne numbered started from 1.
There exists four modes of operation. To test just first class:
Using Alexnet features $python examples/DeepOneClass/run.py --dataset data/ --backbone Alex --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task abnormal --type feature
Using VGG16 features $python examples/DeepOneClass/run.py --dataset data/ --backbone VGG --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task abnormal --type feature
Using Alexnet DOC (ours) $python examples/DeepOneClass/run.py --dataset data/ --backbone Alex --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task abnormal
Using VGG16 DOC (ours) $python examples/DeepOneClass/run.py --dataset data/ --backbone VGG --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task abnormal
If all 6 classes needs to be tested replace --noneclass 6.
Novelty Detection
Novelty detection dataset should be stored in the caffe/data/novelty directory. Each subfolder (of each class) should ne numbered started from 1.
There exists four modes of operation. To test just first class:
Using Alexnet features $python examples/DeepOneClass/run.py --dataset data/ --backbone Alex --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task novelty --type feature
Using VGG16 features $python examples/DeepOneClass/run.py --dataset data/ --backbone VGG --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task novelty --type feature
Using Alexnet DOC (ours) $python examples/DeepOneClass/run.py --dataset data/ --backbone Alex --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task novelty
Using VGG16 DOC (ours) $python examples/DeepOneClass/run.py --dataset data/ --backbone VGG --cafferoot /home/labuser/caffe/ --nclass 6 --noneclass 1 --task novelty
If 40 classes needs to be tested instead of just the first, replace --noneclass 40.
1.--name : Name of the network. Used to name the performance curve plot and text output containing match scores.
2.--type : Type of CNN : oneclass / feature. When oneclass is used classification is done using DOC. Otherwise pre-trained deep features are used.
3.--output : Output directory name.
4.--dataset : Specify the path to the training dataset. Eg: data/abnormal/
5.--cafferoot : Specify the path to the caffe installation. Default is : /home/labuser/caffe/
6.--backbone : Specify the backbone: VGG/Alex
7.--nclass : Number of total classes in the dataset. 256 for novelty detection and 6 for abnormal image detection.
8.--noneclass : Number of classes to be considered for one-class testing. We used 40 for novelty detection. 6 for abnormal image detection.
9.--task : Specify oneclass task novelty/ abnormal
10.--niter : Number of training iterations
11.--visualize : True/ False specifies whether it is required to generate ROC curve plot.
A text file with one-class score values will be written to the output folder. If '--visualize' option is set to True, a ROC curve will also be generated.