Abstract
Contrastive learning has advanced significantly and demonstrates excellent transfer learning capabilities. Knowledge distillation is one of the most effective methods of model compression for computer vision. When combined with contrastive learning, it can achieve even better results. Current knowledge distillation techniques based on contrastive learning struggle to efficiently utilize the information from both student and teacher models, often missing out on optimizing the contrastive framework. This results in a less effective knowledge transfer process, limiting the potential improvements in model performance and representation quality. To address this limitation, we propose a new contrastive distillation learning method by redesigning the contrastive learning framework and incorporating sparse spatial aggregation. This method introduces a novel integration of feature alignment and spatial aggregation mechanism to enhance the learning process. It ensures that the representations obtained by the model fully capture the semantics of the original input. Compared to traditional unsupervised learning methods, our approach demonstrates superior performance in both pre-training and transfer learning. It achieves 71.6 Acc@1, 57.6 AP, 75.8 mIoU, 39.8/34.8 AP on ImageNet linear classification, Pascal VOC object detection, Cityscapes semantic segmentation, MS-COCO object detection and instance segmentation. Moreover, our method exhibits stable training and does not require large pre-training batch-sizes or numerous epochs.
Introduction
In the field of computer vision, Knowledge Distillation (KD) is a cornerstone technique for transferring knowledge from large, resource-intensive "teacher" models to smaller, efficient "student" models. Recently, researchers have integrated KD with Contrastive Learning (CL), a paradigm where models learn by distinguishing between similar and dissimilar image pairs without manual labels.
However, a significant bottleneck exists: most CL-based distillation methods compress an entire image into a single global feature vector. This "global-only" approach often discards critical spatial structures—the relationships between different parts of an object. This lossy transfer prevents the student from fully capturing the teacher's nuanced understanding of visual scenes. To address this, the Contrastive Distillation Learning with Sparse Spatial Aggregation (CDSA) framework is proposed, focusing on capturing intricate spatial relationships and local details that are typically lost in traditional contrastive learning.
Methods
The CDSA framework utilizes a three-branch architecture: a Teacher branch, a Student Query branch, and a Student Key branch.
The core innovation is the Sparse Spatial Aggregation (SSA) layer, which replaces standard Global Average Pooling (GAP) in the student's query branch. The SSA process involves three key steps:
- Feature Transformation: Applying 1x1 convolutions to high-dimensional feature maps to create dual representations.
- Similarity Mapping: Computing cosine similarity between these representations to identify salient spatial regions.
- Selective Aggregation: Sparsely aggregating information to focus on key feature points while reducing redundancy.
Training employs an improved Momentum Update strategy. While the student query branch learns via standard backpropagation, the student key branch is updated as a moving average of the query branch's parameters. A modified InfoNCE loss function encourages the student query to align with the teacher's representation while remaining distinct from a queue of negative samples. This structural asymmetry prevents representation collapse and forces the model to learn more robust, diverse features.
Results and Evaluation
CDSA was evaluated across multiple industry-standard benchmarks, including ImageNet-1M, Pascal VOC, Cityscapes, and MS-COCO. The results consistently outperformed established baselines like MoCo v2 and BYOL:
- ImageNet Classification: CDSA achieved 71.6% Top-1 accuracy with only 100 epochs of pre-training, outperforming the BYOL baseline by 1.4%.
- Object Detection (Pascal VOC): The model reached 58.1 AP, showing a significant lead over MoCo v2 (55.9 AP).
- Semantic Segmentation (Cityscapes): CDSA achieved 76.8 mIoU, demonstrating that the spatial details captured by the SSA layer translate directly to superior pixel-level accuracy.
- Efficiency: Unlike many contrastive methods that require massive hardware clusters and huge batch sizes, CDSA maintains high performance with standard batch sizes and fewer training epochs.
Ablation studies on CIFAR-100 further confirmed the efficacy of the SSA layer, which alone improved Top-1 accuracy by nearly 2%, proving that spatial aggregation is a primary driver of performance gains.
Conclusion
CDSA represents a significant advancement in contrastive distillation by moving beyond "average" global features. By mimicking the human eye's focus on salient boundaries and textures through Sparse Spatial Aggregation, the framework enables a more effective and nuanced knowledge transfer. Future work may explore multi-teacher distillation to aggregate diverse specialized knowledge or apply these spatial techniques to cross-modal learning tasks, such as image-text alignment.
Summary updated