Deep Fusion Network for Image Completion

Xin Hong, Pengfei Xiong, Renhe Ji, Haoqiang Fan

Abstract

Image completion often suffers from visible artifacts at the boundaries between generated and original pixels. We present the Deep Fusion Network (DFNet), which utilizes a learnable fusion block to predict alpha composition maps for seamless blending. By integrating these blocks across multiple scales within a U-Net architecture, DFNet achieves superior structural consistency and natural texture transitions, outperforming existing state-of-the-art methods in both visual quality and boundary accuracy.

Introduction

Image completion, or inpainting, aims to fill missing regions of an image to produce a result that is visually indistinguishable from a complete, natural image. While deep learning models have significantly improved the realism of generated textures, a persistent challenge remains: the boundary problem. Most existing models struggle to harmoniously blend newly generated pixels with the original content, often resulting in visible seams, color shifts, or structural discontinuities at the edges of the missing regions.

Previous solutions often relied on post-processing techniques like Poisson blending, which are computationally expensive and not integrated into the end-to-end learning process. The Deep Fusion Network (DFNet) addresses this by treating the creation of smooth transitions as a fundamental part of the generation process.

Methodology

The core innovation of DFNet is the fusion block, which shifts the network's objective from simply predicting a final image to learning how to compose one.

The Fusion Block

Instead of outputting a completed patch directly, the network predicts a "raw completion" ($C$) and an alpha composition map ($\alpha$). The final output is a weighted blend: $$\text{Result} = \alpha \odot C + (1 - \alpha) \odot I_{orig}$$ where $I_{orig}$ is the original image. This alpha map serves as a learnable, soft transition mask, allowing the network to dynamically determine the optimal blend between generated and original content near the boundaries.

Multi-Scale Constraints

DFNet embeds these fusion blocks into multiple decoder layers of a U-Net architecture. This multi-scale approach allows the network to refine global structural information at lower resolutions and fine-tune intricate texture details at higher resolutions.

Loss Functions

The model is optimized using a combination of losses:

  • Structure Loss: A weighted reconstruction loss focused on the global layout.
  • Texture Loss: A combination of Perceptual loss, Style loss (using Gram matrices), and Total Variation (TV) loss to ensure the generated area matches the surrounding environment's visual characteristics.

Experiments and Results

DFNet was evaluated on the Places2 and CelebA datasets. To quantify the seamlessness of the results, the authors introduced the Boundary Pixels Error (BPE), which measures the mean absolute error specifically in a narrow band around the hole's boundary.

Qualitative comparison of DFNet (Ours) against EdgeConnect. DFNet demonstrates significantly smoother transitions and fewer boundary artifacts, as highlighted in the zoomed-in insets.

Key Findings

  • Quantitative Performance: On the Places2 dataset, DFNet achieved the lowest $\ell_1$ error and BPE compared to models like EdgeConnect, PConv, and DeepFill. It also showed superior Fréchet Inception Distance (FID) scores, indicating higher perceptual realism.
  • Qualitative Superiority: Visual comparisons (see Figure 1) reveal that while competing models often produce blurry artifacts or "clouds" when holes overlap with image borders, DFNet maintains sharp edges and consistent lighting.
  • Efficiency: The model is highly efficient, completing an image in approximately 8.29ms on a standard GPU.

Discussion

The fusion block acts as an attention mechanism, forcing the network to focus on unknown pixels while maintaining the identity of known pixels. A critical insight during development was the selective application of losses: applying texture constraints only to higher-resolution layers prevents them from interfering with the global structure established at lower resolutions. This mimics the human artistic process of sketching a layout before adding fine detail.

Conclusion

DFNet provides a robust solution to the boundary problem in image completion. While it excels at texture and structure, future work could address extremely large holes or complex semantic reconstructions where multiple plausible completions exist. The fusion block concept holds promise for other image-to-image translation tasks where boundary harmony is essential.

Summary updated

BibTeX
@inproceedings{hong2019deep,
  author = {Xin Hong and Pengfei Xiong and Renhe Ji and Haoqiang Fan},
  title = {{Deep Fusion Network for Image Completion}},
  booktitle = {ACM Multimedia},
  year = {2019},
  doi = {10.1145/3343031.3351002},
}
Figure