CADet: Fully Self-Supervised Out-Of-Distribution Detection With Contrastive Learning (2210.01742v4)
Abstract: Handling out-of-distribution (OOD) samples has become a major stake in the real-world deployment of machine learning systems. This work explores the use of self-supervised contrastive learning to the simultaneous detection of two types of OOD samples: unseen classes and adversarial perturbations. First, we pair self-supervised contrastive learning with the maximum mean discrepancy (MMD) two-sample test. This approach enables us to robustly test whether two independent sets of samples originate from the same distribution, and we demonstrate its effectiveness by discriminating between CIFAR-10 and CIFAR-10.1 with higher confidence than previous work. Motivated by this success, we introduce CADet (Contrastive Anomaly Detection), a novel method for OOD detection of single samples. CADet draws inspiration from MMD, but leverages the similarity between contrastive transformations of a same sample. CADet outperforms existing adversarial detection methods in identifying adversarially perturbed samples on ImageNet and achieves comparable performance to unseen label detection methods on two challenging benchmarks: ImageNet-O and iNaturalist. Significantly, CADet is fully self-supervised and requires neither labels for in-distribution samples nor access to OOD examples.
- Adversarial example detection using latent neighborhood graph. In International Conference on Computer Vision, 2021.
- L. Bergman and Y. Hoshen. Classification-based anomaly detection for general data. arXiv preprint arXiv:2005.02359, 2020.
- N. Carlini and D. Wagner. Towards evaluating the robustness of neural networks. In Symposium on Security and Privacy, 2017.
- A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, 2020a.
- Big self-supervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029, 2020b.
- X. Cheng and A. Cloninger. Classification logit two-sample testing by neural networks. arXiv preprint arXiv:1909.11298, 2019.
- Waic, but why? generative ensembles for robust anomaly detection. arXiv preprint arXiv:1810.01392, 2018.
- Fast two-sample testing with analytic representations of probability measures. arXiv preprint arXiv:1506.04725, 2015.
- Image anomaly detection with generative adversarial networks. In Joint european conference on machine learning and knowledge discovery in databases, 2018.
- Density estimation using real nvp. arXiv preprint arXiv:1605.08803, 2016.
- Y. Du and I. Mordatch. Implicit generation and modeling with energy based models. In Advances in Neural Information Processing Systems, 2019.
- Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017.
- Maximum mean discrepancy test is aware of adversarial attacks. In M. Meila and T. Z. 0001, editors, Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pages 3564–3575. PMLR, 2021. URL http://proceedings.mlr.press/v139/gao21b.html.
- I. Golan and R. El-Yaniv. Deep anomaly detection using geometric transformations. In Advances in Neural Information Processing Systems, 2018.
- Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
- Your classifier is secretly an energy based model and you should treat it like one. arXiv preprint arXiv:1912.03263, 2019.
- A fast, consistent kernel two-sample test. In Y. Bengio, D. Schuurmans, J. Lafferty, C. Williams, and A. Culotta, editors, Advances in Neural Information Processing Systems, 2009.
- A kernel two-sample test. Journal of Machine Learning Research, 13(1):723–773, 2012.
- M. Gutmann and A. Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In International Conference on Artificial Intelligence and Statistics, 2010.
- Dimensionality reduction by learning an invariant mapping. In Computer Vision and Pattern Recognition, 2006.
- Momentum contrast for unsupervised visual representation learning. In Conference on Computer Vision and Pattern Recognition, 2020.
- D. Hendrycks and K. Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016.
- Scaling out-of-distribution detection for real-world settings. arXiv preprint arXiv:1911.11132, 2019a.
- Using self-supervised learning can improve model robustness and uncertainty. In Advances in Neural Information Processing Systems, 2019b.
- Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2021.
- A new defense against adversarial images: Turning a weakness into a strength. In Advances in Neural Information Processing Systems, 2019.
- R. Huang and Y. Li. Mos: Towards scaling out-of-distribution detection for large semantic space. arXiv preprint arXiv:2105.01879, 2021.
- Interpretable distribution features with maximum testing power. arXiv preprint arXiv:1605.06796, 2016.
- Rodd: A self-supervised approach for robust out-of-distribution detection. arXiv preprint arXiv:2204.02553, 2022.
- Visual odometry based on stereo image sequences with ransac-based outlier rejection scheme. In 2010 IEEE Intelligent Vehicles Symposium, pages 486–492, 2010. doi: 10.1109/IVS.2010.5548123.
- A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
- A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Advances in Neural Information Processing Systems, 2018.
- Enhancing the reliability of out-of-distribution image detection in neural networks. arXiv preprint arXiv:1706.02690, 2017.
- Learning deep kernels for non-parametric two-sample tests. In International Conference on Machine Learning, 2020a.
- H. Liu and P. Abbeel. Hybrid discriminative-generative training via contrastive learning. arXiv preprint arXiv:2007.09070, 2020.
- Energy-based out-of-distribution detection. In Advances in Neural Information Processing Systems, 2020b.
- Energy-based out-of-distribution detection. arXiv preprint arXiv:2010.03759, 2020c.
- J. Lust and A. P. Condurache. Gran: an efficient gradient-norm based detector for adversarial and misclassified examples. arXiv preprint arXiv:2004.09179, 2020.
- Characterizing adversarial subspaces using local intrinsic dimensionality. arXiv preprint arXiv:1801.02613, 2018a.
- Characterizing adversarial subspaces using local intrinsic dimensionality. CoRR, abs/1801.02613, 2018b. URL http://arxiv.org/abs/1801.02613.
- Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
- On detecting adversarial perturbations. arXiv preprint arXiv:1702.04267, 2017.
- Self-supervised learning for generalizable out-of-distribution detection. In AAAI Conference on Artificial Intelligence, 2020.
- Do deep generative models know what they don’t know? arXiv preprint arXiv:1810.09136, 2018.
- Detecting out-of-distribution inputs to deep generative models using a test for typicality. arXiv preprint arXiv:1906.02994, 2019.
- Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011.
- N. Papernot and P. McDaniel. Deep k-nearest neighbors: Towards confident, interpretable and robust deep learning. arXiv preprint arXiv:1803.04765, 2018.
- Ocgan: One-class novelty detection using gans with constrained latent representations. In Conference on Computer Vision and Pattern Recognition, 2019.
- Generative probabilistic novelty detection with adversarial autoencoders. In Advances in neural information processing systems, 2018.
- Do imagenet classifiers generalize to imagenet? arXiv preprint arXiv:1902.10811, 2019.
- Likelihood ratios for out-of-distribution detection. In Advances in Neural Information Processing Systems, 2019.
- Deep one-class classification. In International Conference on Machine Learning, 2018.
- Unsupervised anomaly detection with generative adversarial networks to guide marker discovery. arXiv preprint arXiv:1703.05921, 2017a.
- Unsupervised anomaly detection with generative adversarial networks to guide marker discovery. In International conference on information processing in medical imaging, 2017b.
- Support vector method for novelty detection. In Advances in neural information processing systems, 1999.
- Ssd: A unified framework for self-supervised outlier detection. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=v5gjXpmR8J.
- Input complexity and out-of-distribution detection with likelihood-based generative models. arXiv preprint arXiv:1909.11480, 2019.
- React: Out-of-distribution detection with rectified activations. arXiv preprint arXiv:2111.12797, 2021.
- Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016.
- Csi: Novelty detection via contrastive learning on distributionally shifted instances. In Advances in Neural Information Processing Systems, 2020.
- A. Uwimana1 and R. Senanayake. Out of distribution detection and adversarial attacks on deep neural networks for robust medical image analysis. arXiv preprint arXiv:2107.04882, 2021.
- Vim: Out-of-distribution with virtual-logit matching. In Conference on Computer Vision and Pattern Recognition, 2022.
- Learning deep kernels for exponential family densities. In International Conference on Machine Learning, 2019.
- Contrastive training for improved out-of-distribution detection. arXiv preprint arXiv:2007.05566, 2020.
- Unsupervised feature learning via non-parametric instance discrimination. In Conference on Computer Vision and Pattern Recognition, 2018.
- Feature squeezing: Detecting adversarial examples in deep neural networks. CoRR, abs/1704.01155, 2017. URL http://arxiv.org/abs/1704.01155.
- Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
- Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
- Deep structured energy based models for anomaly detection. In International Conference on Machine Learning, 2016.
- Deep autoencoding gaussian mixture model for unsupervised anomaly detection. In International Conference on Learning Representations, 2018.
- F. Zuo and Q. Zeng. Exploiting the sensitivity of l2 adversarial examples to erase-and-restore. In Asia Conference on Computer and Communications Security, 2021.
- Charles Guille-Escuret (10 papers)
- David Vazquez (73 papers)
- Ioannis Mitliagkas (61 papers)
- Joao Monteiro (25 papers)
- Pau Rodriguez (35 papers)