Classify and generate: Using classification latent space representations for image generations

Saisubramaniam Gopalakrishnan, Pranshu Ranjan Singh, Yasin Yazici, Chuan-Sheng Foo, Vijay Chandrasekhar, Arulmurugan Ambikapathi · DOI · OpenReview

Abstract

Traditional generative models like GANs and VAEs often rely on complex priors or adversarial training to produce realistic images. This paper introduces ReGene (Representation-based Generations), a framework that repurposes the latent space of a standard image classifier for generative tasks. By applying convex combinations to supervised latent representations, ReGene produces class-consistent, high-quality images without the stability issues of GANs or the blurriness of VAEs.

Introduction

In deep learning, discriminative and generative models are typically treated as distinct architectures. Classifiers focus on extracting class-specific features, often resulting in "sparse" latent spaces not intended for reconstruction. Conversely, generative models like Variational Autoencoders (VAEs) often produce blurry outputs due to rigid mathematical priors, while Generative Adversarial Networks (GANs) can suffer from training instability.

The ReGene framework challenges this dichotomy by asking: Can we leverage the rich feature representations of a pre-trained classifier to generate new data? If a classifier has learned the essential features of a class, its latent space should theoretically contain sufficient information to synthesize new, class-consistent samples.

Methodology: The ReGene Framework

The ReGene framework consists of three primary stages: encoding, decoding, and generation through latent space manipulation.

The ReGene framework architecture: (Top) Training the classifier and decoder. (Bottom) Generating new images via convex combinations of latent vectors.
  1. The Encoder (Classifier): A standard architecture (e.g., VGG-style) is trained for supervised image classification. It maps an input image $x$ to a latent representation $z$.
  2. The Decoder: A separate network is trained to "invert" the classifier's mapping. It takes $z$ and reconstructs the image. To ensure high fidelity, the authors employ a weighted combination of Mean Absolute Error (MAE), Structural Similarity Index (SSIM), and Perceptual Loss.
  3. Convex Combinations: Unlike GANs that sample from random noise, ReGene generates new samples by interpolating between existing latent vectors of the same class. A new latent point $z_{new}$ is defined as: $$z_{new} = \sum \theta_i z_i, \quad \text{where } \sum \theta_i = 1$$ The authors provide mathematical proof (Lemma 1 and Theorem 2) showing that in a supervised latent space, a convex combination of points from the same class is theoretically guaranteed to remain within that class's manifold.

Experimental Results

The framework was evaluated on several standard benchmarks, including MNIST, Fashion MNIST, CIFAR-10, CelebA, and an Anime face dataset.

Qualitative results across multiple datasets, including MNIST, Fashion MNIST, CIFAR-10, CelebA, and Anime faces.

Class Consistency and Fidelity

ReGene demonstrates superior class consistency. On the CIFAR-10 dataset, a "neutral" ResNet56 classifier identified ReGene's generated images with 91.37% accuracy, significantly higher than SNGAN (87.3%) or WGAN-GP (85%). This suggests that the classifier-based latent space preserves essential class features better than traditional adversarial noise-to-image mappings.

The "Recon vs Gen" Metric

The authors argue that standard Fréchet Inception Distance (FID) scores can be misleading for non-adversarial models due to decoder-induced noise. When comparing original images to generated ones (Org vs Gen), ReGene achieved an FID of 16.3 on MNIST. However, when comparing reconstructed images to generated ones (Recon vs Gen) to isolate the generation quality from the decoder's reconstruction error, the score dropped to a remarkable 3.03, surpassing many complex generative models.

Discussion and Conclusion

ReGene proves that classifiers naturally learn structured latent spaces that are highly effective for generation. By avoiding predefined priors, the model avoids the "blurriness" often seen in VAEs. However, the approach is limited by the "Decoder Bottleneck" — the final image quality is strictly dependent on the decoder's ability to capture fine details during the reconstruction phase.

Future work involves exploring more sophisticated decoder architectures and extending the framework to non-image domains. ReGene opens a new path for "recycling" pre-trained discriminative models for generative applications.

Summary updated

BibTeX
@inproceedings{gopalakrishnan2021classify,
  author = {Saisubramaniam Gopalakrishnan and Pranshu Ranjan Singh and Yasin Yazici and Chuan-Sheng Foo and Vijay Chandrasekhar and Arulmurugan Ambikapathi},
  title = {{Classify and generate: Using classification latent space representations for image generations}},
  booktitle = {Neurocomputing},
  year = {2021},
  doi = {10.1016/j.neucom.2021.10.090},
}
Figure