Real-Time Selfie Video Stabilization

Jiyang Yu, Ravi Ramamoorthi, Ke-Li Cheng, Michel Sarkis, Ning Bi

Abstract

Selfie video stabilization presents unique challenges due to large foreground occlusions, independent motion between the subject and background, and human sensitivity to facial distortions. We present an unsupervised deep learning approach that achieves real-time stabilization at 26 fps. Our system utilizes a two-branch 1D convolutional neural network to independently process background and foreground motion, predicting Moving Least Squares (MLS) warps. By maintaining linearity in the network and employing a grid-based MLS approximation, the method provides smooth, high-quality stabilization without the "jello effect" or facial warping common in existing real-time solutions.

Introduction

Stabilizing "selfie" videos is significantly more complex than landscape stabilization. The primary difficulties stem from the subject's head occupying a large portion of the frame, which occludes background features necessary for traditional camera motion tracking. Furthermore, the foreground and background often exhibit independent motion; stabilizing for one frequently results in violent shaking of the other.

Finally, the "uncanny valley" effect makes humans highly sensitive to even minor facial distortions (wobble) introduced by stabilization algorithms. While high-quality offline methods exist, they are too slow for mobile applications, and current real-time methods often fail to handle complex local motions like rolling shutter artifacts.

Methodology

The proposed pipeline treats the foreground and background as distinct entities to balance their respective stability requirements.

  1. Motion Detection: The system employs a segmentation network to isolate the subject and a 3D face-fitting model (3DDFA) to track face vertices. Simultaneously, sparse background feature points are tracked using KLT tracking.
  2. Two-Branch Stabilization Network: A 1D CNN with two branches processes background and face motion separately. A key architectural finding was that removing activation layers (maintaining linearity) improved performance, as stabilization is inherently a linear geometric relationship where corrective displacement should scale directly with input shake.
  3. Rigid Moving Least Squares (MLS) Warping: To deform the image while maintaining local rigidity—crucial for facial integrity—the system uses MLS.
  4. Real-Time Optimization: To achieve 26 fps, the authors implemented a grid approximation for MLS, calculating warps for a sparse 20x20 grid and using bilinear interpolation to fill the remaining pixels. This reduced processing time from 1 second to 4 milliseconds per frame.
  5. User Control: A parameter ($\lambda$) allows for adjustable weighting between face and background stabilization.
Overview of the stabilization pipeline, including feature tracking (A), the two-branch network (B), MLS warping (C), and quantitative motion analysis (D).

Datasets and Evaluation

The research introduced a new Selfie Video Dataset containing 1,005 video clips with per-frame foreground masks, a significant expansion over previous datasets. Evaluation was conducted on 25 "wild" selfie videos featuring challenging conditions such as low light, multiple faces, and accessories like sunglasses.

Key Results

The system operates at 26 fps on a desktop GPU (NVIDIA 2080Ti), outperforming previous optimization-based methods by orders of magnitude. Quantitative evaluations using Cropping, Distortion, and Stability metrics show that this method surpasses industry standards like MeshFlow and Bundled Paths. Qualitatively, the approach avoids the "jello effect" and maintains a larger frame size with higher stability scores than competitors like Steadiface.

Conclusion and Future Work

This unsupervised approach demonstrates that real-time, high-quality selfie stabilization is achievable by separating foreground and background motion processing. While the system currently relies on 2D tracking, future improvements could include integrating gyroscope data to enhance robustness in feature-poor environments (e.g., low light or plain backgrounds). Additionally, optimizing kernels for mobile hardware will be essential for direct on-device smartphone implementation.

Summary updated

Abstract

We propose a novel real-time selfie video stabilization method. Our method is completely automatic and runs at 26 fps. We use a 1D linear convolutional network to directly infer the rigid moving least squares warping which implicitly balances between the global rigidity and local flexibility. Our network structure is specifically designed to stabilize the background and foreground at the same time, while providing optional control of stabilization focus (relative importance of foreground vs. background) to the users. To train our network, we collect a selfie video dataset with 1005 videos, which is significantly larger than previous selfie video datasets. We also propose a grid approximation to the rigid moving least squares that enables the real-time frame warping. Our method is fully automatic and produces visually and quantitatively better results than previous real-time general video stabilization methods. Compared to previous offline selfie video methods, our approach produces comparable quality with a speed improvement of orders of magnitude. Our code and selfie video dataset is available at https://github.com/jiy173/selfievideostabilization.
BibTeX
@inproceedings{yu2021real,
  author = {Jiyang Yu and Ravi Ramamoorthi and Ke-Li Cheng and Michel Sarkis and Ning Bi},
  title = {{Real-Time Selfie Video Stabilization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=cukEKvCpCG},
}
Figure