EGC: Image Generation and Classification via a Single Energy-Based Model

Learning image classification and image generation using the same set of network parameters is a challenging problem. Recent advanced approaches perform well in one task often exhibit poor performance in the other. This work introduces an energy-based classifier and generator, namely EGC, which can achieve superior performance in both tasks using a single neural network. Unlike a conventional classifier that outputs a label given an image ( i.e ., a conditional distribution p ( y | x ) ), the forward pass in EGC is a classifier that outputs a joint distribution p ( x , y ) , enabling an image generator in its backward pass by marginalizing out the label y . This is done by estimating the classification probability given a noisy image from the diffusion process in the forward pass, while denoising it using the score function estimated in the backward pass. EGC achieves competitive generation results compared with state-of-the-art approaches on ImageNet-1k, CelebA-HQ and LSUN Church, while achieving superior classification accuracy and robustness against adversarial attacks on CIFAR-10. This work represents the first successful attempt to simultaneously excel in both tasks using a single set of network parameters. We believe that EGC bridges the gap between discriminative and generative learning. Code will be released at https://github.com/GuoQiushan/EGC.

[1]  Jinwoo Shin,et al.  Guiding Energy-based Models via Contrastive Latent Variables , 2023, ICLR.

[2]  Qiang Qiu,et al.  Energy-Inspired Self-Supervised Pretraining for Vision Models , 2023, ICLR.

[3]  Song-Chun Zhu,et al.  Learning Probabilistic Models from Generator Latent Spaces with Hat EBM , 2022, NeurIPS.

[4]  Tian Han,et al.  Adaptive Multi-stage Density Ratio Estimation for Learning Latent Space Energy-based Model , 2022, NeurIPS.

[5]  Jonathan Ho Classifier-Free Diffusion Guidance , 2022, ArXiv.

[6]  Chongxuan Li,et al.  EGSDE: Unpaired Image-to-Image Translation via Energy-Guided Stochastic Differential Equations , 2022, NeurIPS.

[7]  Jianwen Xie,et al.  A Tale of Two Flows: Cooperative Learning of Langevin Flow and Normalizing Flow Toward Energy-Based Model , 2022, ICLR.

[8]  Zhouchen Lin,et al.  A Unified Contrastive Energy-based Model for Understanding the Generative Ability of Adversarial Training , 2022, ICLR.

[9]  L. Gool,et al.  RePaint: Inpainting using Denoising Diffusion Probabilistic Models , 2022, 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).

[10]  B. Ommer,et al.  High-Resolution Image Synthesis with Latent Diffusion Models , 2021, 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).

[11]  Gustavo K. Rohde,et al.  Learning Energy-Based Models with Adversarial Training , 2020, ECCV.

[12]  Prafulla Dhariwal,et al.  Diffusion Models Beat GANs on Image Synthesis , 2021, NeurIPS.

[13]  Hung-Yu Tseng,et al.  Regularizing Generative Adversarial Networks under Limited Data , 2021, 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).

[14]  Ilya Sutskever,et al.  Learning Transferable Visual Models From Natural Language Supervision , 2021, ICML.

[15]  Prafulla Dhariwal,et al.  Improved Denoising Diffusion Probabilistic Models , 2021, ICML.

[16]  Jianwen Xie,et al.  Learning Energy-Based Model with Variational Auto-Encoder as Amortized Sampler , 2020, AAAI.

[17]  B. Ommer,et al.  Taming Transformers for High-Resolution Image Synthesis , 2020, 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).

[18]  Ying Nian Wu,et al.  Learning Energy-Based Models by Diffusion Recovery Likelihood , 2020, ICLR.

[19]  Shuang Li,et al.  Improved Contrastive Divergence Training of Energy Based Models , 2020, ICML.

[20]  Jiaming Song,et al.  Denoising Diffusion Implicit Models , 2020, ICLR.

[21]  J. Kautz,et al.  VAEBM: A Symbiosis between Variational Autoencoders and Energy-based Models , 2020, ICLR.

[22]  Ping Li,et al.  Learning Energy-Based Generative Models via Coarse-to-Fine Expanding and Sampling , 2021, ICLR.

[23]  Yixuan Li,et al.  Energy-based Out-of-distribution Detection , 2020, NeurIPS.

[24]  Jan Kautz,et al.  NVAE: A Deep Hierarchical Variational Autoencoder , 2020, NeurIPS.

[25]  Pieter Abbeel,et al.  Denoising Diffusion Probabilistic Models , 2020, NeurIPS.

[26]  Stefano Ermon,et al.  Improved Techniques for Training Score-Based Generative Models , 2020, NeurIPS.

[27]  Tero Karras,et al.  Training Generative Adversarial Networks with Limited Data , 2020, NeurIPS.

[28]  Jianfeng Gao,et al.  Feature Quantization Improves GAN Training , 2020, ICML.

[29]  Mohammad Norouzi,et al.  Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One , 2019, ICLR.

[30]  Tero Karras,et al.  Analyzing and Improving the Image Quality of StyleGAN , 2019, 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).

[31]  Andrew M. Dai,et al.  Flow Contrastive Estimation of Energy-Based Models , 2019, 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).

[32]  Yang Song,et al.  Generative Modeling by Estimating Gradients of the Data Distribution , 2019, NeurIPS.

[33]  David Duvenaud,et al.  Residual Flows for Invertible Generative Modeling , 2019, NeurIPS.

[34]  Song-Chun Zhu,et al.  On Learning Non-Convergent Short-Run MCMC Toward Energy-Based Model , 2019, ArXiv.

[35]  Igor Mordatch,et al.  Implicit Generation and Generalization with Energy Based Models , 2018 .

[36]  Yoshua Bengio,et al.  Maximum Entropy Generators for Energy-Based Models , 2019, ArXiv.

[37]  Prafulla Dhariwal,et al.  Glow: Generative Flow with Invertible 1x1 Convolutions , 2018, NeurIPS.

[38]  Yuichi Yoshida,et al.  Spectral Normalization for Generative Adversarial Networks , 2018, ICLR.

[39]  Zhuowen Tu,et al.  Wasserstein Introspective Neural Networks , 2017, 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition.

[40]  Jaakko Lehtinen,et al.  Progressive Growing of GANs for Improved Quality, Stability, and Variation , 2017, ICLR.

[41]  Yang Lu,et al.  Learning Generative ConvNets via Multi-grid Modeling and Sampling , 2017, 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition.

[42]  Aleksander Madry,et al.  Towards Deep Learning Models Resistant to Adversarial Attacks , 2017, ICLR.

[43]  Surya Ganguli,et al.  Variational Walkback: Learning a Transition Operator as a Stochastic Recurrent Net , 2017, NIPS.

[44]  Zhuowen Tu,et al.  Introspective Neural Networks for Generative Modeling , 2017, 2017 IEEE International Conference on Computer Vision (ICCV).

[45]  Sepp Hochreiter,et al.  GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium , 2017, NIPS.

[46]  Zhuowen Tu,et al.  Introspective Classification with Convolutional Nets , 2017, NIPS.

[47]  Sergey Levine,et al.  A Connection between Generative Adversarial Networks, Inverse Reinforcement Learning, and Energy-Based Models , 2016, ArXiv.

[48]  Wojciech Zaremba,et al.  Improved Techniques for Training GANs , 2016, NIPS.

[49]  Nikos Komodakis,et al.  Wide Residual Networks , 2016, BMVC.

[50]  Yoshua Bengio,et al.  Deep Directed Generative Models with Energy-Based Probability Estimation , 2016, ArXiv.

[51]  Yang Lu,et al.  A Theory of Generative ConvNet , 2016, ICML.

[52]  Yinda Zhang,et al.  LSUN: Construction of a Large-scale Image Dataset using Deep Learning with Humans in the Loop , 2015, ArXiv.

[53]  Surya Ganguli,et al.  Deep Unsupervised Learning using Nonequilibrium Thermodynamics , 2015, ICML.

[54]  Jonathon Shlens,et al.  Explaining and Harnessing Adversarial Examples , 2014, ICLR.

[55]  B. Efron Tweedie’s Formula and Selection Bias , 2011, Journal of the American Statistical Association.

[56]  Radford M. Neal MCMC Using Hamiltonian Dynamics , 2011, 1206.1901.

[57]  Fei-Fei Li,et al.  ImageNet: A large-scale hierarchical image database , 2009, 2009 IEEE Conference on Computer Vision and Pattern Recognition.

[58]  Alex Krizhevsky,et al.  Learning Multiple Layers of Features from Tiny Images , 2009 .

[59]  Fu Jie Huang,et al.  A Tutorial on Energy-Based Learning , 2006 .