Semi-Supervised Wide-Angle Portraits Correction by Multi-Scale Transformer

Fushun Zhu, Shan Zhao, Peng Wang, Hao Wang, Hua Yan, Shuaicheng LiuCVPR 2021

Abstract

We propose a semi-supervised network for wide-angle portraits correction. Wide-angle images often suffer from skew and distortion affected by perspective distortion, especially noticeable at the face regions. Previous deep learning based approaches need the ground-truth correction flow maps for training guidance. However, such labels are expensive, which can only be obtained manually. In this work, we design a semi-supervised scheme and build a high-quality unlabeled dataset with rich scenarios, allowing us to simultaneously use labeled and unlabeled data to improve performance. Specifically, our semi-supervised scheme takes advantage of the consistency mechanism, with several novel components such as direction and range consistency (DRC) and regression consistency (RC). Furthermore, different from the existing methods, we propose the Multi-Scale Swin-Unet (MS-Unet) based on the multi-scale swin transformer block (MSTB), which can simultaneously learn short-distance and long-distance information to avoid artifacts.

Introduction

Wide-angle lenses are ubiquitous on modern smartphones, but they introduce severe perspective distortions—straight architectural lines bend, and faces near the edges of the frame stretch unnaturally. Correcting this requires a delicate balance: backgrounds need perspective projection to keep lines straight, while faces need stereographic projection to look natural.

Recent deep learning methods treat this as a pixel-level flow map regression problem, predicting how each pixel should shift to undistort the image. However, generating ground-truth correction flow maps for training is a painstakingly manual and expensive process. Consequently, existing fully-supervised models are bottlenecked by small dataset sizes, leading to artifacts and poor generalization in diverse, real-world scenarios.

Proposed Method

The authors tackle the data bottleneck with a semi-supervised learning framework and a custom transformer architecture called MS-Unet.

Semi-Supervised Strategy

To learn from unlabeled data, the framework introduces a surrogate task—semantic segmentation. They enforce Direction and Range Consistency (DRC) by converting predicted flow maps into multi-class segmentation masks based on the direction and magnitude of pixel shifts. This forces the network to maintain regional smoothness without needing exact ground truth. They also use Regression Consistency (RC) via a Siamese network, ensuring that differently augmented versions of the same unlabeled image produce consistent correction maps.

The proposed training strategy for both labeled and unlabeled images, highlighting the DRC and RC consistency losses.

MS-Unet Architecture

Standard Swin-Transformers struggle with local-scale information (like varying face sizes). MS-Unet uses a Multi-Scale Swin-Transformer Block (MSTB) equipped with a Dense Connection Module (DCM) to capture both local details (via depthwise separable convolutions) and long-range dependencies (via self-attention). Additionally, the authors replace standard U-Net skip connections with a custom Skip Fusion Block (SFB) to better fuse hierarchical features between the encoder and decoder.

The architecture of the proposed Multi-Scale Swin-Unet (MS-Unet) and its constituent blocks.

Datasets

  • Labeled Data: The model utilizes an existing wide-angle dataset containing over 5,000 training and 129 testing images captured across 5 different smartphones.
  • Unlabeled Data: The authors collected a new dataset of over 5,000 unannotated, distorted images from 4 modern smartphones (Samsung Note 10, Xiaomi 11, vivo X23, and vivo iQOO) to power their semi-supervised training pipeline.

Key Insights and Results

  • Segmentation as a Surrogate: Converting continuous flow map regression into a discrete segmentation task is a clever way to enforce regional consistency. It forces the network to group pixels that move in similar directions, reducing localized artifacts and tearing.
  • State-of-the-Art Accuracy: On standard test sets, the method achieved a LineAcc (line straightness) of 67.209 and ShapeAcc (face naturalness) of 97.500, outperforming previous top methods. Adding the 5,000 unlabeled images steadily improved LineAcc from 66.871 to 67.209.
  • Speed and Efficiency: The MS-Unet model is relatively lightweight at 8.79M parameters and runs at ~40 FPS on a single RTX 2080Ti GPU, making it viable for real-world smartphone deployment.

Conclusion

This work demonstrates that manually undistorting thousands of images is not strictly necessary to improve model robustness. By leveraging raw, distorted images through DRC and RC consistency losses, the proposed MS-Unet pushes the boundaries of wide-angle portrait correction. While the training pipeline involves multiple steps, the resulting model is efficient enough for mobile applications. Future work may explore end-to-end training regimes or further architecture optimization for edge devices.

Summary updated

BibTeX
@inproceedings{zhu2021semi,
  author = {Fushun Zhu and Shan Zhao and Peng Wang and Hao Wang and Hua Yan and Shuaicheng Liu},
  title = {{Semi-Supervised Wide-Angle Portraits Correction by Multi-Scale Transformer}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=P50OIrviwV9},
}
Figure