Abstract
Modern face recognition models rely on classification paradigms that scale poorly with the number of identities, creating a "GPU Memory Wall." We present the Virtual Fully-Connected (FC) Layer, which reduces the parameter count of the final classification layer by over two orders of magnitude. By employing parameter sharing through "anchors" and a dynamic re-grouping strategy to resolve intra-batch conflicts, our method allows researchers to train state-of-the-art models on millions of identities using a single GPU. Experimental results on benchmarks like IJB-C and MegaFace demonstrate that Virtual FC achieves superior performance compared to metric learning and existing memory-efficient classification methods.
Introduction: The GPU Memory Wall
In the standard classification paradigm for face recognition, a deep neural network maps an image to a feature vector, which is then passed through a Fully-Connected (FC) layer. Each unique identity in the training set requires a dedicated weight vector in this FC layer. As datasets scale to millions of identities—a necessity for industrial-grade performance—the memory required for these weights grows linearly. For a dataset with 10 million identities and 512-dimensional features, the FC layer alone exceeds 5 billion parameters, far surpassing the memory capacity of standard GPUs.
Existing solutions like Model Parallelism or Partial FC distribute or sample these parameters but do not fundamentally reduce the total parameter count. This leaves large-scale training inaccessible to researchers without massive compute clusters.
The Virtual FC Layer
The Virtual FC layer addresses this bottleneck by decoupling the number of parameters from the number of identities.
Parameter Sharing via Anchors
Instead of maintaining $N$ weight vectors for $N$ identities, Virtual FC divides identities into $M$ groups ($M \ll N$). Each group shares a single "anchor" column in the weight matrix. These anchors function in two modes:
- Corresponding Anchors: When an identity from a group is present in the current training mini-batch, the anchor is dynamically calculated as the weighted average (centroid) of the features for that identity. This explicitly forces the network to learn discriminative features centered around these anchors.
- Free Anchors: If no identities from a group are present in the batch, the anchor acts as a standard learnable weight vector updated via Stochastic Gradient Descent (SGD).
Dynamic Re-grouping Strategy
A critical challenge in parameter sharing is "conflict"—when multiple identities from the same group appear in the same mini-batch. To resolve this, the authors implement a dynamic re-grouping strategy. If a conflict occurs, one identity is temporarily assigned to an available "free anchor" for that iteration, ensuring that all identities in a batch can be optimized independently and discriminatively.
Experimental Evaluation
The authors evaluated Virtual FC using standard backbones (CASIA-Net, ResNet-50, ResNet-101) trained on MS-Celeb-1M and CASIA-WebFace. Performance was measured across several benchmarks, including LFW, CFP, IJB-A/B/C, and MegaFace.
Key Results
The Virtual FC layer achieves a parameter compression of over 100x compared to a standard FC layer. Despite this massive reduction, it consistently outperforms metric learning approaches (like N-pair or Multi-similarity loss) and other optimized classification layers like TCP.
On the challenging IJB-C dataset with a ResNet-101 backbone, Virtual FC achieved 95.30% accuracy, surpassing the TCP method (94.22%) and significantly outperforming metric learning baselines. Furthermore, the method allows for "Upper Boundary" performance (matching a full FC layer) while utilizing only 1% of the typical computational resources for the final layer.
Conclusion and Future Work
The Virtual FC layer provides a path forward for large-scale face recognition on commodity hardware. By treating weights as dynamic centroids and managing identity groups through a re-grouping strategy, it bridges the gap between the memory efficiency of metric learning and the high performance of classification. While the method currently faces challenges when training from scratch due to initial feature noise, it is highly effective for fine-tuning and multi-task learning scenarios. Future research aims to stabilize the anchor generation process to enable robust training from random initialization.
Summary updated