On Compressing U-net Using Knowledge Distillation

Karttikeya Mangalam, Mathieu SalzamannarXiv 2018

Abstract

We study the use of knowledge distillation to compress the U-net architecture. We show that, while standard distillation is not sufficient to reliably train a compressed U-net, introducing other regularization methods, such as batch normalization and class re-weighting, in knowledge distillation significantly improves the training process. This allows us to compress a U-net by over 1000x, i.e., to 0.1% of its original number of parameters, at a negligible decrease in performance.

Introduction

Deep learning architectures like U-net have become the gold standard for image segmentation tasks. However, these models are heavily parameterized, often containing tens of millions of weights, which restricts their deployment in resource-constrained environments like mobile devices or edge hardware.

To solve this, researchers often use knowledge distillation (KD), a compression technique where a smaller "student" network is trained to mimic the outputs of a larger, pre-trained "teacher" network. While KD is popular, standard distillation techniques often fail when trying to drastically shrink the U-net architecture. This paper addresses the challenge of successfully distilling a U-net into a micro-sized footprint without destroying its segmentation capabilities.

Methods

The compression process is approached in two phases. First, the number of channels in the U-net is reduced to create a smaller "teacher" network. Then, knowledge distillation is used to train an even smaller "student" network.

The U-net architecture modified with Batch Normalization and standard segmentation operations.

Standard distillation was found to fail for the smallest student networks. To stabilize training, two vital modifications were introduced:

  1. Batch Normalization: Added to every convolutional layer in the contracting path to reduce internal covariate shift.
  2. Class Re-weighting: To address massive class imbalance in the Electron Microscopy (EM) Mitochondria Segmentation dataset, the loss function was modified to heavily penalize errors on the minority class (foreground pixels).

Results

The experiments revealed that U-nets are massively over-parameterized for some tasks. A reduction from a 64-channel U-net to a 4-channel U-net dropped parameters from ~31 million to ~122,000 with zero loss in accuracy.

Comparison of model size and segmentation performance (IoU) across different U-net configurations.

While vanilla distillation failed to push compression further, the proposed architectural modifications enabled the training of a 2-channel student network. As shown in the results, the final model achieved a 1000x compression ratio, retaining only 0.1% of the original parameters while maintaining a highly competitive Intersection over Union (IoU) score of 0.759, compared to the original 0.804.

Conclusion

This work demonstrates that extreme compression of U-net architectures is possible through knowledge distillation when supported by appropriate architectural regularizations. By adding batch normalization and correcting for class imbalance, the student network's training stabilized enough to learn the teacher's representations effectively. While currently tested on binary biomedical segmentation, future work will investigate if these techniques generalize to more complex, multi-class segmentation tasks.

Summary updated

BibTeX
@misc{mangalam2018compressing,
  author = {Karttikeya Mangalam and Mathieu Salzamann},
  title = {{On Compressing U-net Using Knowledge Distillation}},
  year = {2018},
  eprint = {1812.00249},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.00249},
}
Figure