Abstract
Semantic segmentation models are computationally intensive, posing challenges for deployment on resource-constrained devices. While network pruning is a standard compression technique, context-agnostic methods often degrade segmentation performance by removing channels critical for spatial reasoning. We introduce Context-Aware Pruning (CAP), a framework that identifies and preserves channels carrying vital contextual information. CAP achieves up to 63% parameter reduction while maintaining or even enhancing accuracy on standard benchmarks like Cityscapes and CamVid.
Introduction
Deep learning models for semantic segmentation require pixel-level predictions, making them significantly heavier than classification models. Standard pruning techniques often fail in this domain because they are "context-agnostic." In segmentation, a pixel's label frequently depends on its surrounding context—for instance, identifying a "sidewalk" relies on its proximity to a "road." Existing pruning methods may inadvertently remove channels responsible for these spatial relationships, leading to substantial accuracy drops. CAP addresses this by using context as a prior for identifying redundancy.
Context-Aware Pruning Framework
The CAP framework introduces two primary components to integrate context into the pruning process:
- Context-aware Guiding Module (CAGM): Positioned near pooling layers where global context is aggregated, the CAGM calculates a Channel Affinity Matrix to analyze inter-channel interactions. This is condensed into a Contextual Guiding Vector ($\beta$), which ranks channels based on their contribution to the overall scene context.
- Context-aware Guided Sparsification (CAGS): This mechanism targets the scaling factors ($\gamma$) in Batch Normalization (BN) layers. Unlike standard L1 regularization that penalizes all channels equally, CAGS uses the guiding vector $\beta$ to apply a weighted penalty. Channels deemed contextually important receive a "tax break" (lower penalty), while less useful channels are pushed toward zero more aggressively.
Importantly, the CAGM is only utilized during the training and pruning phase. It is removed during inference, ensuring the final pruned model incurs no additional architectural overhead.
Experimental Results
The framework was evaluated on the Cityscapes and CamVid datasets across various architectures, including PSPNet101, ICNet, and SegNet.
Quantitative Performance
CAP consistently outperformed state-of-the-art pruning baselines like Network Slimming (NS) and FPGM:
- SegNet (Cityscapes): Achieved a 63.46% reduction in parameters and a 45.43% reduction in FLOPs, while increasing mIoU from 56.10% to 61.16%.
- ICNet (Cityscapes): Reduced parameters by 54.46% and improved mIoU from 59.68% to 62.38%, demonstrating that even highly optimized real-time models can be further compressed.
- PSPNet101 (Cityscapes): Reduced parameters by 32.08% while maintaining a high mIoU of 77.82% (compared to 78.40% for the unpruned version).
Qualitative Analysis
Visual results indicate that CAP-pruned models are superior at preserving small objects and sharp boundaries. Context-agnostic methods often suffer from information loss in complex regions, whereas CAP's adaptive penalization protects the most informative features during the sparsification process.
Conclusion
CAP demonstrates that contextual information is a powerful signal for identifying redundancy in segmentation networks. By making pruning "context-aware," we can achieve significant compression without sacrificing—and sometimes even improving—segmentation quality. Future work may explore combining CAP with quantization or applying these principles to other dense prediction tasks like depth estimation.
Summary updated