Learning Affinity-Aware Upsampling for Deep Image Matting

Yutong Dai, Hao Lu, Chunhua Shen

Abstract

Deep image matting requires precise restoration of fine details, a task often hindered by standard upsampling operators that ignore local structural similarities. This paper introduces Affinity-Aware Upsampling ($A^2U$), a learnable operator that leverages second-order pixel relationships to guide the upsampling process. By employing a low-rank bilinear model, $A^2U$ remains computationally efficient while significantly enhancing the connectivity of thin structures. Evaluated on major benchmarks, $A^2U$ achieves state-of-the-art performance, outperforming existing models by 8% with only 40% of the computational complexity.

Introduction

In dense prediction tasks such as semantic segmentation and image matting, networks must upsample low-resolution feature maps to the original image dimensions. Traditional methods like bilinear interpolation or nearest-neighbor use fixed mathematical rules that are content-agnostic. Even learnable upsamplers like CARAFE or IndexNet typically rely on first-order features, failing to capture the structural "affinity"—the similarity between neighboring pixels.

This paper addresses this gap by introducing $A^2U$, which models pixel similarities during the upsampling stage to prevent detail loss in complex regions like hair, smoke, or fine meshes. By modeling affinity earlier in the network, the operator acts as a structural guide, helping the network "connect the dots" for thin structures.

The Affinity-Aware Upsampling ($A^2U$) Operator

The core contribution is the $A^2U$ operator, which frames upsampling as a dot product between a kernel and a local feature patch. Unlike previous approaches that generate kernels from simple feature maps, $A^2U$ generates kernels based on the bilinear similarity between feature pairs, capturing how pixels relate to one another.

The architecture of the $A^2U$ operator, illustrating the use of low-rank bilinear modeling to generate affinity-aware kernels.

To maintain efficiency, the authors utilize a low-rank bilinear model, factorizing the large affinity matrix into smaller, manageable components. This approach adds minimal parameters (less than 0.5%) while providing a substantial performance boost. The operator is flexible, supporting both static and dynamic implementations, and can be paired with an affinity-aware downsampling counterpart to maintain consistency across the encoder-decoder architecture.

Experimental Validation

The researchers validated $A^2U$ across several benchmarks:

  • Adobe Image Matting (Composition-1k): The primary large-scale benchmark for deep image matting.
  • alphamatting.com: A famous online benchmark for evaluating matting algorithms.
  • Distinctions-646: A newer, diverse dataset used to test generalization.
  • MNIST & Fashion-MNIST: Used for initial proof-of-concept reconstruction tasks.

Results and Key Insights

$A^2U$ demonstrates superior performance in preserving thin structures and fuzzy boundaries. On the Composition-1k dataset, it achieved a 14% relative improvement in the Sum of Absolute Differences (SAD) metric over strong baselines.

Qualitative comparison showing $A^2U$'s ability to maintain connectivity in fine mesh structures compared to standard methods.

Key findings include:

  • Efficiency: $A^2U$ outperformed the previous state-of-the-art (GCA Matting) by 8% while requiring only 40% of the model complexity.
  • Benchmark Ranking: At the time of publication, the method ranked #1 on the alphamatting.com benchmark for Gradient error.
  • Structural Integrity: Qualitative results show that $A^2U$ is significantly better at maintaining the connectivity of thin structures, such as the holes in a fine mesh net or individual strands of hair.
  • Symmetric Design: The paper demonstrates that using affinity-aware kernels for both downsampling and upsampling preserves spatial information more effectively than standard pooling layers.

Conclusion

While $A^2U$ excels in matting and reconstruction, its effectiveness in other dense tasks like depth estimation or optical flow remains to be fully explored. The authors found that larger upsampling kernels do not always lead to better results, suggesting a "sweet spot" for local context. Future work will focus on extending $A^2U$ to a wider range of spatial prediction problems where fine detail is paramount.

Summary updated

BibTeX
@inproceedings{dai2021learning,
  author = {Yutong Dai and Hao Lu and Chunhua Shen},
  title = {{Learning Affinity-Aware Upsampling for Deep Image Matting}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00677},
}
Figure