Abstract
Image inpainting requires a delicate balance between global structural coherence and local textural detail. Traditional methods often struggle with this "chicken and egg" problem, resulting in either blurry outputs or misaligned artifacts. This paper introduces StructureFlow, a two-stage framework that decouples inpainting into structure reconstruction and texture generation. By utilizing edge-preserved smooth images as structural guidance and a novel appearance flow mechanism to sample textures from distant image regions, StructureFlow produces results that are both structurally sound and visually sharp. Evaluations on benchmarks like Places2 and CelebA demonstrate that this approach significantly outperforms state-of-the-art edge-based methods.
Introduction
Image inpainting—the process of filling missing or corrupted regions—is a fundamental task in computer vision. To achieve realistic results, a model must understand both the structure (global layout and shapes) and the texture (local patterns and details). Existing deep learning methods often fail to harmonize these two aspects. Single-stage models frequently produce over-smoothed results, while early two-stage methods using sparse edge maps often discard critical information like color and shading, leading to texture artifacts.
StructureFlow addresses these challenges by proposing a pipeline that first reconstructs a dense but smooth structural representation and then uses that structure to guide a texture generator. The core innovation lies in the use of "appearance flow," which allows the network to explicitly borrow high-quality textures from uncorrupted parts of the image.
Methodology
The StructureFlow framework consists of two primary components: the Structure Reconstructor and the Texture Generator.
1. Structure Reconstructor ($G_s$)
Instead of predicting raw pixels or sparse edges, the first stage predicts an edge-preserved smooth image. The authors utilize Relative Total Variation (RTV) to generate ground truth labels that maintain sharp boundaries and global color layouts while removing high-frequency texture noise. This allows $G_s$ to focus exclusively on the "bones" of the image without being distracted by complex patterns.
2. Texture Generator ($G_t$) and Appearance Flow
Once the structure is established, the Texture Generator synthesizes the fine details. To overcome the limited receptive field of standard convolutional layers, the authors introduce Appearance Flow. This mechanism calculates a 2D coordinate vector field that directs the network to "borrow" features from specific uncorrupted regions.
To improve the stability and accuracy of this flow, two technical enhancements are implemented:
- Gaussian Sampling: Unlike standard bilinear sampling, Gaussian sampling expands the search area during training, preventing the model from getting trapped in poor local minima.
- Sampling Correctness Loss: A VGG-feature-based loss ensures that the regions the model borrows from are semantically similar to the target area.
Experiments and Datasets
The model was rigorously evaluated on three diverse benchmarks:
- Places2: Over 10 million images testing natural scene diversity.
- CelebA: Face images requiring high precision for non-repetitive structures like eyes.
- Paris StreetView: Urban architecture testing geometric consistency.
Results and Discussion
Quantitative Performance
On the Places2 dataset with a 40-60% mask ratio, StructureFlow achieved a PSNR of 21.090 and an SSIM of 0.7561, marking a significant improvement over previous leaders like EdgeConnect and PConv.
Qualitative Advantages
User studies conducted via Amazon Mechanical Turk revealed a "fooling rate" (the frequency with which users perceived generated images as real) of 32.04% on CelebA, nearly 6% higher than EdgeConnect. Visually, StructureFlow excels in complex areas, such as facial features or architectural pillars, where edge-based methods often produce ghosting or misalignment.
The authors argue that smooth images are superior to edge maps because they provide a "dense" guide including color and shading. However, there is a "Goldilocks zone" for the smoothing parameter $\sigma$; the authors found $\sigma \approx 3$ to be optimal for balancing structural detail and texture removal.
Conclusion
StructureFlow represents a significant step forward in image inpainting by effectively separating structure from texture. By treating the model as a smart "copy-paste" artist through appearance flow, it avoids the pitfalls of hallucinating textures from scratch. While the model is sensitive to the initial smoothing parameter, its ability to produce sharp, structurally coherent images makes it a robust solution for complex inpainting tasks. Future work may explore adaptive smoothing to further enhance performance in extremely sparse scenarios.
Summary updated