[Paper Review] Coherent Semantic Attention for Image Inpainting
This paper proposes a novel Coherent Semantic Attention (CSA) layer within a two-stage U-Net framework for image inpainting, modeling semantic relevance and feature continuity to generate high-quality, structurally coherent results. By integrating a consistency loss and a feature patch discriminator, the method achieves state-of-the-art performance on CelebA, Places2, and Paris StreetView, significantly reducing distortion and improving texture realism and structural fidelity.
The latest deep learning-based approaches have shown promising results for the challenging task of inpainting missing regions of an image. However, the existing methods often generate contents with blurry textures and distorted structures due to the discontinuity of the local pixels. From a semantic-level perspective, the local pixel discontinuity is mainly because these methods ignore the semantic relevance and feature continuity of hole regions. To handle this problem, we investigate the human behavior in repairing pictures and propose a fined deep generative model-based approach with a novel coherent semantic attention (CSA) layer, which can not only preserve contextual structure but also make more effective predictions of missing parts by modeling the semantic relevance between the holes features. The task is divided into rough, refinement as two steps and model each step with a neural network under the U-Net architecture, where the CSA layer is embedded into the encoder of refinement step. To stabilize the network training process and promote the CSA layer to learn more effective parameters, we propose a consistency loss to enforce the both the CSA layer and the corresponding layer of the CSA in decoder to be close to the VGG feature layer of a ground truth image simultaneously. The experiments on CelebA, Places2, and Paris StreetView datasets have validated the effectiveness of our proposed methods in image inpainting tasks and can obtain images with a higher quality as compared with the existing state-of-the-art approaches.
Motivation & Objective
- To address the limitations of existing deep learning methods in image inpainting, which often produce blurry textures and distorted structures due to ignored semantic relevance and feature continuity.
- To model the human-like two-step process of image repair—first conceiving global structure, then refining local details—by designing a two-stage generative framework.
- To enhance training stability and feature learning by introducing a consistency loss that aligns the CSA layer and its decoder counterpart with VGG features of ground truth images.
- To improve detail generation and training efficiency by replacing conventional discriminators with a faster, more stable feature patch discriminator.
Proposed method
- The method employs a two-stage U-Net architecture: a rough network for initial content generation, followed by a refinement network with the CSA layer in the encoder to improve local coherence.
- The CSA layer initializes missing feature patches with the most similar patches from known regions and iteratively optimizes them based on spatial consistency with neighboring patches.
- A consistency loss is introduced to enforce both the CSA layer and its corresponding decoder layer to produce features close to the VGG feature representation of the ground truth image.
- A feature patch discriminator is used instead of a standard patch discriminator to improve detail quality and training stability, with faster inference time.
- The model is trained with a combination of reconstruction loss, relativistic average least-squares adversarial loss, and the proposed consistency loss.
- The refinement network with CSA is specifically designed to preserve global semantic structure while ensuring local pixel continuity through iterative feature optimization.
Experimental results
Research questions
- RQ1Can modeling semantic relevance and feature continuity between hole regions improve image inpainting quality and reduce structural artifacts?
- RQ2How does the two-stage refinement process—rough prediction followed by CSA-based refinement—compare to end-to-end methods in preserving global structure and local details?
- RQ3To what extent does the consistency loss stabilize training and improve feature alignment with ground truth VGG features?
- RQ4Does the proposed feature patch discriminator outperform conventional patch discriminators in generating sharp textures and reducing blur?
- RQ5Where is the optimal placement of the CSA layer in the refinement network for balancing performance and inference efficiency?
Key findings
- On the CelebA dataset with centering masks, the proposed method achieved a PSNR of 24.14 and SSIM of 0.883 at 40-50% hole ratio, outperforming Contextual Attention (PSNR: 23.36, SSIM: 0.860) and Partial Conv (PSNR: 22.11, SSIM: 0.839).
- With irregular masks on CelebA, the method achieved a PSNR of 32.58 and SSIM of 0.982 at 20-30% hole ratio, surpassing Gated Conv (PSNR: 29.83, SSIM: 0.964) and Partial Conv (PSNR: 29.10, SSIM: 0.956).
- Abllation studies showed that replacing CSA with a conventional 3×3 convolution led to severe structural distortion, while using contextual attention alone still produced inconsistent textures.
- Placing the CSA layer at the third down-sampling stage (32×32 feature map) achieved the best trade-off between inference speed (0.82 seconds per image) and performance.
- The consistency loss significantly reduced structural distortion in the hole region, especially when training was unstable without it, as shown in qualitative comparisons.
- The feature patch discriminator improved detail quality and reduced blur compared to standard patch discriminators, and processed images 0.2 seconds faster per image.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.