Abstract
Classic variational autoencoders are used to learn complex data distributions, that are built on standard function approximators. Especially, VAE has shown promise on a lot of complex task. In this paper, a new autoencoder model - classification supervised autoencoder (CSAE) based on predefined evenly-distributed class centroids (PEDCC) is proposed. Our method uses PEDCC of latent variables to train the network to ensure the maximization of inter-class distance and the minimization of inner-class distance. Instead of learning mean/variance of latent variables distribution and taking reparameterization of VAE, latent variables of CSAE are directly used to classify and as input of decoder. In addition, a new loss function is proposed to combine the loss function of classification. Based on the basic structure of the universal autoencoder, we realized the comprehensive optimal results of encoding, decoding, classification, and good model generalization performance at the same time. Theoretical advantages are reflected in experimental results.
Introduction
Variational Auto-Encoders (VAEs) have become a cornerstone of generative modeling, yet they face two significant challenges: image blurriness and latent space overlap. The blurriness often stems from the reliance on Mean Squared Error (MSE) loss, which fails to capture high-frequency structural details. Meanwhile, the latent space often suffers from class entanglement, where similar categories (e.g., digits '4' and '9' in MNIST) cluster too closely, leading to classification errors and poor generative diversity.
To address these issues, we propose the Classification Supervised Auto-Encoder (CSAE). Unlike traditional VAEs that attempt to learn a latent distribution through probabilistic reparameterization, CSAE adopts a geometric approach. By mapping data to Predefined Evenly-Distributed Class Centroids (PEDCC) on a hypersphere, we explicitly maximize the distance between classes while minimizing variance within them.
Methodology
The CSAE architecture integrates an encoder-decoder framework with a specialized classifier and a dual-loss system. The encoder maps input data directly to a latent space where classification occurs via a Nearest Class Mean (NCM) classifier based on PEDCC.
As shown in the architecture above, the model utilizes two primary loss functions:
- Loss1 (Classification Loss): This ensures that the latent representations are pulled toward their respective predefined centroids.
- Loss2 (Reconstruction Loss): To combat blurriness, we introduce a Wavelet-based loss. By performing a Wavelet Transform on both the input and reconstructed images, we apply an L1 loss to high-frequency components (horizontal, vertical, and diagonal details), forcing the model to preserve sharp edges.
The PEDCC Framework
The core innovation of this work is the use of PEDCC to structure the latent space. Instead of allowing the network to find an arbitrary distribution, we use a physical model simulating repulsive forces to place class centers on a $d$-dimensional hypersphere. This ensures that every class is mathematically as far from others as possible.
This geometric "social distancing" of data points prevents the overlap common in standard VAEs. By abandoning the Kullback-Leibler (KL) divergence in favor of fixed geometric targets, training becomes more stable and the resulting classification more robust.
Experimental Results
The CSAE was evaluated on MNIST, FashionMNIST, and FaceScrub datasets. The results demonstrate superior performance in both classification and reconstruction quality:
- Classification Accuracy: The model achieved 99.52% on MNIST, outperforming standard CNN baselines. On more complex datasets like FaceScrub, it maintained a high accuracy of 92.84%.
- Reconstruction Quality: Visual comparisons indicate that CSAE produces significantly sharper images than traditional Conditional VAEs (CVAEs). The Wavelet loss successfully preserved intricate facial features and digit boundaries that are typically lost to MSE-induced blur.
- Generalization: When tested on unseen EMNIST letters, the CSAE maintained structural integrity in its reconstructions, whereas CVAEs often collapsed the unknown inputs into the nearest known digit class.
Conclusion
By rethinking the latent space as a structured geometric environment rather than a learned probability distribution, the CSAE provides a robust framework for simultaneous classification and high-quality image generation. The combination of PEDCC for class separation and Wavelet loss for structural detail offers a significant improvement over standard auto-encoding techniques. Future work will explore the application of this framework to more complex, unaligned natural scenes and automated tuning of the noise injection parameters.
Summary updated