TL;DR
This paper introduces GAN Compression, a general framework to significantly reduce the computational cost of conditional GANs (cGANs) for interactive applications. By combining knowledge distillation with neural architecture search, they achieve up to a 29x reduction in computation while preserving image quality, making real-time cGAN deployment feasible on edge devices.
What Problem Does This Paper Address?
Conditional GANs (cGANs) are powerful tools for generating realistic images based on specific inputs, enabling applications like image editing and virtual reality. However, these models are notoriously computationally expensive, often requiring orders of magnitude more computation (MACs) than standard image recognition networks. For instance, GauGAN can consume 281G MACs per image, making them impractical for real-time, on-device applications where computational resources are limited. Existing compression techniques, often designed for recognition networks, struggle with the unique challenges of GANs, such as training instability and distinct generator architectures.
Methods
The authors propose a two-pronged approach:
- Stabilizing GAN Training and Unifying Learning:
- Knowledge Distillation: They transfer knowledge from intermediate layers of the original "teacher" GAN generator to a smaller "student" generator. This helps stabilize training and improve performance, especially for compressed models.
- Unpaired to Paired Learning: For unpaired training settings, they create "pseudo pairs" by using the teacher's output as the ground truth for the student. This transforms unpaired learning into a more stable paired learning scenario.
- Finding Efficient Architectures via Neural Architecture Search (NAS):
- Custom Search Space: Instead of reusing existing efficient CNN designs (like MobileNet), they define a search space tailored for cGAN generators. They found that certain layers (e.g., ResBlocks) are more robust to compression than others (e.g., upsampling layers), guiding their search space design.
- Once-for-All Network & Weight Sharing: To accelerate NAS, they train a single "once-for-all" network that supports various channel configurations. This allows evaluating many sub-networks without retraining, decoupling training from the search process.
- Fast GAN Compression: An optimized pipeline that simplifies training by removing the need for a separate mobile teacher network and pre-distillation. It also uses evolutionary search instead of brute-force search for faster and broader exploration of the architecture space.
Datasets
The authors evaluate their methods on several standard datasets:
- Edges→Shoes: Used for Pix2pix and MUNIT.
- Cityscapes: Used for Pix2pix and GauGAN.
- Horse→Zebra: Used for CycleGAN.
- Map→Aerial Photo: Used for Pix2pix.
- COCO-Stuff: Used for GauGAN.
Key Insights and Ideas
- GANs are fundamentally different from recognition CNNs: Directly applying compression techniques designed for recognition networks to GAN generators often leads to poor performance due to GANs' unique training dynamics and architectural characteristics.
- Intermediate layer distillation is crucial for GANs: Mimicking only the output of a teacher GAN is less effective than distilling knowledge from its intermediate feature representations, especially in paired settings.
- Unpaired GAN training can be stabilized by pseudo-pairing: Transforming unpaired training into a pseudo-paired setting using the teacher's output significantly improves stability and performance, particularly for smaller, compressed models.
- NAS tailored for GANs is more effective: A search space designed with an understanding of GAN generator architectures (e.g., layer sensitivity to compression) yields better results than generic CNN search spaces.
- "Once-for-all" networks with weight sharing are key to efficient NAS: This technique allows for rapid evaluation of numerous sub-architectures without the prohibitive cost of retraining each one.
Key Results
- Significant Computation Reduction: The proposed GAN Compression and Fast GAN Compression methods achieve substantial reductions in MACs:
- CycleGAN: 21x
- Pix2pix: 12x
- MUNIT: 29x
- GauGAN: 9x
- Preserved Visual Fidelity: These compression ratios are achieved with minimal degradation in image quality, as measured by FID and mIoU.
- Improved Training Efficiency: Fast GAN Compression reduces training time by 1.7-3.7x and search time by 3.5-12x compared to the original GAN Compression pipeline.
- Real-world Deployment: The compressed Pix2pix model was successfully deployed on a mobile device (Jetson Nano) for an interactive edge-to-shoe application.
- Outperforms Baselines: The methods consistently outperform naive compression (e.g., uniformly scaling channels) and prior GAN-specific compression techniques.
Limitations and Future Work
- Computational Cost of Training: While the inference is accelerated, the initial training of the "once-for-all" network and the search process can still be computationally intensive, though Fast GAN Compression significantly mitigates this.
- Hyperparameter Tuning: The paper mentions that each term in the loss function (reconstruction, distillation) has hyperparameters that need careful tuning, and the specific epochs for different training stages are also detailed.
- Future Work: The authors suggest exploring more efficient NAS strategies and further optimizing the training pipeline for even greater speedups. They also highlight the potential for interactive cGAN applications on edge devices.
Summary updated