Abstract: Pixel-Wise Contrastive Distillation (PCD) is a framework designed to enhance the performance of compact neural networks on dense prediction tasks such as object detection and semantic segmentation. By transitioning from image-level to pixel-level distillation and employing a "SpatialAdaptor" to retain teacher knowledge, PCD enables small models to achieve state-of-the-art results, often surpassing supervised pre-training baselines.
Introduction
Self-supervised learning (SSL) has significantly advanced large-scale models, yet small models like ResNet-18 continue to lag. Conventional distillation methods often operate at the image level, compressing spatial information into a single vector. While effective for classification, this approach is suboptimal for dense prediction tasks where spatial precision is paramount. Furthermore, small models suffer from limited Effective Receptive Fields (ERF), hindering their ability to capture long-range context compared to their larger counterparts.
Methodology
PCD addresses these issues through three core components:
- Pixel-level Contrastive Loss: Instead of comparing whole-image embeddings, PCD compares individual pixels between the student and teacher feature maps. It "attracts" corresponding pixels (positive pairs) and "repulses" negative pixels stored in a memory queue.
- SpatialAdaptor: This component reformulates the teacher's fully-connected projection heads into $1 \times 1$ convolutions with a "Channel-Wise ReLU." This allows the student to benefit from the teacher's projection head knowledge while maintaining 2D spatial maps.
- Multi-head Self-Attention (MHSA): To help the student model capture more context, an MHSA module is added during pre-training to enlarge the student's receptive field. This module is discarded during fine-tuning, ensuring no additional inference cost.
Experimental Results
The models were pre-trained on ImageNet (without labels) and evaluated on transferability to dense tasks including PASCAL VOC, COCO (object detection and instance segmentation), and CityScapes (semantic segmentation).
PCD consistently outperforms previous self-supervised distillation methods across all dense benchmarks. As shown in the results table, a ResNet-18 backbone distilled via PCD achieved 37.4 AP$_{\text{bbox}}$ on COCO, significantly higher than the 36.3 AP of a supervised ResNet-18. On CityScapes, it achieved 71.8 mIoU, outperforming the teacher-supervised baseline of 70.2.
Key Insights and Conclusion
The success of PCD highlights that for dense prediction, the "where" matters as much as the "what." Image-level distillation provides a gradient independent of pixel position, whereas PCD provides the spatially-detailed guidance essential for detection. Furthermore, the teacher's projection head contains non-negligible knowledge that should not be discarded. By using the SpatialAdaptor to keep the head spatially aware, the distillation process becomes much more informative.
While PCD excels in CNN-to-CNN distillation, cross-architecture distillation (e.g., ViT to CNN) remains a challenge due to resolution mismatches. Future research will focus on more sophisticated alignment methods for these disparate spatial maps.
Summary updated