TL;DR
This paper introduces a novel foreground-aware image inpainting system that explicitly disentangles structure inference from content completion. By first predicting and completing foreground object contours, and then using these contours to guide the inpainting process, the method achieves significantly improved results, especially in challenging scenarios where holes overlap with or touch foreground objects.
What Problem Does This Paper Address?
Image inpainting, the task of filling in missing regions of an image, is crucial for applications like photo editing and restoration. Traditional methods and even recent deep learning approaches often struggle when the "holes" to be filled are near or overlap with foreground objects. This is because these methods primarily rely on local pixel information or patch matching, lacking a deeper understanding of object boundaries and structures. Consequently, they tend to produce artifacts or unnatural textures in these complex scenarios, particularly when the goal is to remove distracting foreground elements.
Methods
The proposed system tackles this challenge by breaking down the inpainting process into three distinct, cascaded modules:
- Incomplete Contour Detection Module: This module uses a pre-trained DeepCut model to automatically detect the incomplete contour of foreground objects in the corrupted image. It leverages saliency detection and then applies a Sobel edge detector to find the existing contour lines.
- Contour Completion Module: This is the core innovation. It takes the incomplete contour and the input image as guidance to predict and complete the missing parts of the foreground object's contour. This module employs a generator-discriminator architecture, trained with a combination of content loss (binary cross-entropy with focal loss) and adversarial loss, using a curriculum learning strategy to stabilize training.
- Image Completion Module: This module takes the original incomplete image, the completed contour, and a hole mask as input. It also uses a generator-discriminator architecture to fill in the missing pixels. The completed contour acts as a strong structural prior, guiding the generator to produce more accurate and natural results, especially around object boundaries. This module is also trained with content and adversarial losses, and benefits from pre-training on large datasets like Places2.
A key aspect of their approach is the explicit disentanglement of structure (contour) inference and content (pixel) completion, allowing each module to focus on its specific task.
Datasets
The authors utilize a custom dataset for training and evaluation. They collect over 15,762 natural images from various public datasets, focusing on those with salient objects. Each image is annotated with a segmentation mask. They then derive ground-truth contours by applying the Sobel edge operator to these masks. For training the contour completion module, they split this dataset into 12,609 training and 3,153 testing images. For the image completion module, they also leverage the large-scale Places2 dataset for pre-training.
Key Insights and Ideas
- Structure as a Prior: The most significant insight is that explicitly modeling and completing object structures (contours) before filling in pixel content provides a powerful prior that dramatically improves inpainting quality, especially in challenging cases.
- Disentanglement is Key: Separating the problem into contour detection, contour completion, and image completion allows each sub-problem to be addressed more effectively, leading to a more robust overall system.
- Contour Completion is Non-Trivial: The paper highlights that simply training a network to fill holes doesn't inherently teach it to infer accurate object boundaries. A dedicated contour completion module is necessary.
- Curriculum Learning for Stability: Training complex GAN-based models, especially for tasks like contour completion, can be unstable. The authors demonstrate the effectiveness of a curriculum learning approach, starting with content loss and gradually introducing adversarial loss.
- Image as Discriminator Condition: For contour discrimination, providing the ground-truth image alongside the contour mask helps the discriminator better distinguish real from fake contours, stabilizing training.
Key Results
- Quantitative Performance: The proposed "Ours Guided" method consistently outperforms state-of-the-art methods (PatchMatch, Global&Local, ContextAttention, PartialConv, GatedConv) across standard metrics like L1 loss, L2 loss, PSNR, and SSIM on their saliency dataset. For example, their guided method achieves the lowest L1 loss (0.009327) and highest PSNR (29.86) and SSIM (0.9383).
- Qualitative Improvements: Visual comparisons show that their method produces significantly more natural and artifact-free results, particularly in images with holes overlapping foreground objects. They effectively complete object boundaries and textures, avoiding the notches and artifacts seen in other methods.
- User Preference: A user study confirms the visual superiority of their method, with "Ours Guided" being overwhelmingly preferred by users over other approaches.
- Ablation Study: An ablation study demonstrates that the contour completion module is crucial, as the model without contour guidance ("Ours No Guide") produces noticeable artifacts around object borders, while the guided model achieves much cleaner results.
Limitations and Future Work
- Dataset Specificity: While the saliency dataset is diverse, it's still focused on salient objects. Future work could explore applying this approach to more general image datasets.
- Computational Cost: The cascaded nature of the modules and the use of GANs likely contribute to a higher computational cost compared to simpler methods, though they do not explicitly quantify this.
- Potential for Further Refinement: The paper suggests that the contour completion module could be further improved, and the image completion module could potentially benefit from more advanced architectures or training strategies.
The authors conclude that explicitly using structural information like contours to guide image inpainting is a promising direction for tackling challenging inpainting tasks.
Summary updated