[Paper Review] Diverse Image Inpainting with Bidirectional and Autoregressive Transformers
This paper proposes BAT-Fill, a novel image inpainting framework that uses a bidirectional autoregressive transformer (BAT) to model both long-range dependencies and bidirectional context for diverse, high-fidelity image generation. By combining autoregressive modeling with masked language modeling (MLM) in a permuted sequence, BAT enables consistent and diverse completion of missing image regions, outperforming state-of-the-art methods in both fidelity and diversity on CelebA-HQ, Places2, and Paris StreetView datasets.
Image inpainting is an underdetermined inverse problem, which naturally allows diverse contents to fill up the missing or corrupted regions realistically. Prevalent approaches using convolutional neural networks (CNNs) can synthesize visually pleasant contents, but CNNs suffer from limited perception fields for capturing global features. With image-level attention, transformers enable to model long-range dependencies and generate diverse contents with autoregressive modeling of pixel-sequence distributions. However, the unidirectional attention in autoregressive transformers is suboptimal as corrupted image regions may have arbitrary shapes with contexts from any direction. We propose BAT-Fill, an innovative image inpainting framework that introduces a novel bidirectional autoregressive transformer (BAT) for image inpainting. BAT utilizes the transformers to learn autoregressive distributions, which naturally allows the diverse generation of missing contents. In addition, it incorporates the masked language model like BERT, which enables bidirectionally modeling of contextual information of missing regions for better image completion. Extensive experiments over multiple datasets show that BAT-Fill achieves superior diversity and fidelity in image inpainting qualitatively and quantitatively.
Motivation & Objective
- To address the challenge of generating diverse yet realistic image completions in the presence of large, irregularly shaped missing regions.
- To overcome the limitations of unidirectional attention in autoregressive transformers and independent prediction in MLM-based models for image inpainting.
- To improve global context modeling and structural consistency in image inpainting by integrating bidirectional context with output dependency.
- To develop a two-stage framework that first generates coherent structures via BAT and then refines textures with a CNN-based generator.
Proposed method
- Proposes a bidirectional autoregressive transformer (BAT) that permutes input sequences to allow modeling of both past and future context for missing pixels.
- Uses a two-stage training procedure: first, BAT generates diverse and coherent image structures via autoregressive modeling; second, a CNN-based texture generator refines the results with high-frequency details.
- Applies masked language modeling (MLM) like BERT to reconstruct missing tokens using bidirectional context, improving contextual awareness.
- Employs a sequence permutation strategy that sorts valid and missing pixels, enabling autoregressive generation to start from the first missing token while conditioning on all available context.
- Integrates autoregressive modeling to enforce output dependency, ensuring consistency across predicted tokens.
- Trains the model using reconstruction and adversarial losses to enhance realism and structural fidelity.
Experimental results
Research questions
- RQ1Can a transformer-based architecture that combines bidirectional context modeling with autoregressive generation produce more diverse and consistent image inpainting results than unidirectional autoregressive models?
- RQ2How does the integration of masked language modeling (MLM) with autoregressive modeling improve the quality and diversity of image inpainting?
- RQ3To what extent does the proposed BAT-Fill framework outperform existing SOTA methods in terms of both image fidelity and structural diversity?
- RQ4Does the two-stage design—structure generation followed by texture refinement—improve overall inpainting quality compared to end-to-end approaches?
Key findings
- BAT-Fill achieves state-of-the-art performance on CelebA-HQ, Places2, and Paris StreetView, with FID scores of 36.19 (20-40% mask), 64.20 (40-60% mask), and 48.19 (random mask) on Paris StreetView, outperforming both deterministic and diverse methods.
- The ablation study confirms that BAT significantly improves reconstruction quality (FID: 40.91) and maintains high diversity (LPIPS: 0.0301), outperforming models without bidirectional context (FID: 59.60) or autoregressive modeling (FID: 49.62).
- The model achieves a PSNR of 26.52 and SSIM of 0.864 on Paris StreetView with 20-40% mask, demonstrating strong fidelity while maintaining diversity.
- LPIPS scores of 0.076 (20-40%), 0.147 (40-60%), and 0.106 (random) indicate that BAT-Fill generates more perceptually diverse results than PIC, a strong diverse inpainting baseline.
- The two-stage design enables better texture synthesis, as evidenced by lower ℓ₁ loss (2.70%) and higher PSNR (26.52) compared to PIC (ℓ₁: 3.43%, PSNR: 24.80).
- The ablation study shows that removing autoregressive modeling leads to lower FID (49.62) but also reduced diversity (LPIPS: 0.0304), while removing bidirectional context drastically increases FID (59.60), confirming the importance of both components.
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.