CIRKDV2: Cross-Image Relational Knowledge Distillation with Contextual Modeling for Efficient Semantic Segmentation

Chuanguang Yang, Yu Wang, Chengqing Yu, Xinqiang Yu, Weilun Feng, Yuqi Li, Zhulin An, Libo Huang, Boyu Diao, Fei Wang, Fuzhen Zhuang, Yongjun Xu, Yingli Tian, Tingwen Huang, Yongduan SongarXiv 2026

TL;DR

When compressing massive vision models into nimble, phone-friendly ones for pixel-level image understanding, traditional methods force the smaller "student" model to mimic the "teacher" one isolated image at a time. CIRKDV2 breaks out of this single-image silo, teaching compact models to understand how pixels, object regions, and semantic concepts relate across an entire dataset, while also bridging the "tunnel vision" gap between small and large networks. The result is sharper, faster semantic segmentation without adding a single extra computation at deployment.

What Problem Does This Paper Address?

Semantic segmentation—labeling every single pixel in an image as "road," "sky," or "pedestrian"—is essential for self-driving cars and robotics, but top-performing models are far too heavy for mobile hardware. To shrink them, researchers use Knowledge Distillation (KD), where a compact student network learns to mimic a massive, pre-trained teacher network.

Because segmentation requires structured spatial understanding, modern KD methods teach the student how pixels relate to one another. However, existing methods suffer from two blind spots:

  1. Single-Image Myopia: They only model relationships within a single image. A "car" pixel in Tuesday’s rainy photo never gets compared to a "car" pixel in Friday’s sunny photo, starving the student of dataset-wide context.
  2. The Receptive Field Gap: When directly aligning raw features, teachers (which have larger kernels and deeper layers) "see" a much wider area of the image per pixel than students. Forcing a student pixel with tunnel vision to directly copy a teacher pixel with panoramic vision causes a semantic mismatch.
Fig. 1. Overview of intra-image (left) and our proposed cross-image relational distillation (right). The circles with the same color denote pixel embeddings from the same image. ti and si represent the pixel embeddings of the i-th pixel location tagged in an image from the teacher and student, respectively. The dotted line shows the similarity relationship between two pixels. The circles and lines construct a relational graph.

Methods

CIRKDV2 (an expansion of the authors' earlier CIRKD framework) introduces an omni-dimensional distillation pipeline that operates strictly during training—meaning zero extra overhead during inference.

Fig. 2. Overview of our proposed CIRKDV2.

Here is what makes it tick:

  • Cross-Image Relational Distillation: Instead of relying solely on the current mini-batch (which is tiny in memory-heavy segmentation tasks), the authors borrow a trick from self-supervised learning: online memory queues. Because the teacher is frozen, its historical embeddings never go "stale." The framework maintains queues to align similarity distributions (via KL-divergence) across three dimensions:
  • Pixel-to-Pixel and Pixel-to-Region (comparing pixels to class-averaged prototypes).
  • Channel-to-Channel (new in V2): Since individual feature map channels often act as category-specific masks (see below), CIRKDV2 aligns how semantic channels correlate across different images, preceded by an MSE loss (and a temporary $1\times1$ conv projection head if dimensions mismatch) so student and teacher channels speak the same language.
  • Contextual Feature Distillation (new in V2): To fix the receptive field gap before aligning pixel features, the student’s feature map is passed through a training-only self-attention module. This aggregates wider spatial context into each student pixel embedding so it matches the teacher's semantic scope before MSE alignment.
Fig. 4. Visualization of channel semantics over DeepLabV3 on Cityscapes. Each heatmap corresponds to one channel.

Datasets

The authors evaluate CIRKDV2 on four standard, publicly available semantic segmentation benchmarks (no new datasets are introduced):

  • Cityscapes: 5,000 urban driving scenes across 19 classes.
  • ADE20K: 25,000 images across diverse scenes with 150 challenging categories.
  • Pascal VOC (augmented): ~13,500 images focused on 20 foreground object classes plus background.
  • COCO-Stuff-164K: A massive, complex benchmark of 164,000 images spanning 172 "thing" and "stuff" classes.

Key Insights and Ideas

  • Channels are more talkative than pixels: In ablation studies, channel-to-channel relational distillation outperformed both pixel-to-pixel and pixel-to-region distillation. Modeling how whole semantic masks interact across images carries denser, more informative structure than individual pixel pairs.
  • "Hardest negative" mining backfires in segmentation: In contrastive learning, hunting for the hardest examples usually helps. Here, simple random class-balanced sampling from the memory bank beat hardest and semi-hard sampling. Why? In dense pixel datasets, the "hardest" pixels are often mislabeled boundaries or noisy outliers rather than clean, informative contrasts.
  • Architecture-agnostic resilience: Raw feature-alignment methods (like LAD) shine when teacher and student share the same architecture family (e.g., ResNet-101 to ResNet-18), but stumble on heterogeneous pairs (e.g., CNN teacher to MobileNet or Vision Transformer student). Relational distillation transfers structural geometry rather than raw representations, working smoothly across mismatched backbones.
  • Frozen queues rescue rare classes: Storing class-balanced prototypes from a frozen teacher preserves clean signals for rare classes (like fences, walls, and trucks) that otherwise appear too infrequently in small mini-batches.

Key Results

Measuring mean Intersection-over-Union (mIoU), CIRKDV2 consistently beats state-of-the-art distillation methods (including CIRKD, Af-DCD, and LAD) across CNNs (DeepLabV3, PSPNet, UperNet) and Transformers (MobileViT, SegFormer):

  • Cityscapes: Boosts DeepLabV3-ResNet-18 from 73.56% to 75.60% mIoU, and lightweight MobileViT-XXS (2.4M params) from 66.24% to 68.91%. Rare classes see dramatic jumps over LAD (+5.81% on truck, +5.18% on fence).
  • ADE20K: Pushes DeepLabV3-ResNet-18 from 36.92% to 39.82% mIoU, closing the performance gap to the 79M-parameter ResNet-101 teacher (43.83%) by nearly half.
  • Foundation Models (SAM): Distilling SAM-ViT-Large into SAM-ViT-Tiny on COCO-Stuff-164K yields 30.80% mIoU, outperforming the baseline by +3.16% and MobileSAM by +1.89%.
  • Efficiency: Memory queues take ~500MB total (<1% of GPU memory). Training takes ~6.25% longer per step than Af-DCD, with zero added latency or parameters at inference.

Limitations and Future Work

While inference remains completely free of extra cost, CIRKDV2 introduces training-time overhead—requiring 17s per step and 11.7GB GPU memory on ADE20K compared to 12s and 8.5GB for simpler feature-alignment methods like LAD, alongside managing multiple hyper-parameters (four loss weights and three separate memory queues). For future work, the authors express hope that these findings will inspire more advanced segmentation distillation methods centered on global relational modeling and contextual feature alignment.

Summary updated

Abstract

Existing Knowledge Distillation (KD) methods for semantic segmentation often guide the student to mimic the teacher's structured information generated from an individual image. However, they ignore the global semantic relations across various images that are valuable for KD. This paper proposes Cross-Image Relational KD V2 (CIRKDV2), which focuses on transferring structured pixel-to-pixel, pixel-to-region, and channel-to-channel relations modeled from global images in the dataset. A large teacher network often constructs a well-structured feature space in terms of global contextual dependencies. CIRKDV2 makes the student mimic the better structured semantic relations of the teacher, thus improving the feature representational capability. Beyond relational distillation, we further propose contextual feature distillation by using context aggregation to augment student pixel embeddings to match the semantic level with the teacher. This avoids the semantic gap problem between the teacher and student occurred in traditional feature distillation studies. Experimental results on Cityscapes, ADE20K, Pascal VOC, and COCO-Stuff-164K demonstrate that CIRKDV2 outperforms the state-of-the-art semantic segmentation distillation methods by large margins across various network architectures. Our code and pre-trained models are publicly available at https://github.com/winycg/CIRKD.
BibTeX
@misc{yang2026cirkdv,
  author = {Chuanguang Yang and Yu Wang and Chengqing Yu and Xinqiang Yu and Weilun Feng and Yuqi Li and Zhulin An and Libo Huang and Boyu Diao and Fei Wang and Fuzhen Zhuang and Yongjun Xu and Yingli Tian and Tingwen Huang and Yongduan Song},
  title = {{CIRKDV2: Cross-Image Relational Knowledge Distillation with Contextual Modeling for Efficient Semantic Segmentation}},
  year = {2026},
  eprint = {2611.34795},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.34795},
}
Figure