Abstract
Image inpainting often struggles with structural integrity when holes overlap object boundaries, leading to blurred edges or anatomical inconsistencies. We present a foreground-aware inpainting system that disentangles structure inference from content completion. By first predicting missing object contours and using them as a guide for pixel generation, our model achieves superior structural fidelity and sharper results compared to existing state-of-the-art methods.
Introduction
Deep learning has significantly advanced image inpainting, yet models like PartialConv and GatedConv frequently fail to maintain the "common sense" of object shapes. When a missing region intersects a foreground object's edge, these networks often merge foreground textures into the background, creating jagged artifacts or "notches." This occurs because standard architectures attempt to learn texture and structure simultaneously without an explicit understanding of object boundaries. To address this, we propose a "foreground-aware" approach that prioritizes structural boundaries before filling in color and texture.
Methods
The proposed system utilizes a three-stage pipeline designed to separate structure inference from image synthesis.
- Contour Detection Module: Using the DeepCut saliency detection model, the system identifies foreground objects and extracts their incomplete contours.
- Contour Completion Module: A specialized Generative Adversarial Network (GAN) predicts the missing segments of the contour lines. To handle the sparsity of contour data, the module is trained using Focal Loss and Binary Cross-Entropy, ensuring the model prioritizes thin boundary lines over empty space.
- Image Completion Module: A second GAN performs the final inpainting, using the predicted contours as an additional guidance channel. This information is re-injected at multiple stages of the network to maintain structural alignment throughout the refinement process.
The model is trained using a curriculum approach, initially focusing on rough shape reconstruction before introducing adversarial losses to sharpen fine details.
Key Results
Our foreground-aware model consistently outperforms existing methods in both quantitative metrics and qualitative visual quality.
- Quantitative Performance: On saliency validation sets, the model achieved a PSNR of 29.86 and an SSIM of 0.9383, surpassing GatedConv and PartialConv in structural accuracy.
- Qualitative Comparison: Visual evaluations demonstrate that our method produces significantly cleaner edges. As shown in Figure 1, the model successfully reconstructs the circular shape of a medal and the anatomical structure of a dog's head, whereas competing methods leave noticeable artifacts.
- User Preference: In a blind study involving 22 participants, our model was preferred 731 times, a substantial margin over the 100 votes received by GatedConv.
Discussion and Conclusion
By explicitly modeling object boundaries, we prevent the "bleeding" effect common in traditional inpainting. The use of Focal Loss effectively addresses the sparsity of contour maps, and multi-stage guidance ensures that structural information persists through deep network layers.
However, the system's performance is tied to the accuracy of the initial saliency detection. If the foreground object is not correctly identified, the structural guidance becomes ineffective. Future research will focus on improving contour prediction for more complex geometries and exploring temporal consistency for video applications.
Summary updated