MTADiffusion: Mask Text Alignment Diffusion Model for Object Inpainting

Jun Huang, Ting Liu, Yihang Wu, Xiaochao Qu, Luoqi Liu, Xiaolin Hu

Abstract

Image inpainting—the process of filling a masked region with new content—often suffers from semantic misalignment, structural distortion, and style inconsistency. MTADiffusion addresses these challenges by introducing a novel diffusion-based framework trained on a massive, granular dataset of 25 million mask-text pairs. By incorporating multi-task structural guidance and a style-consistency loss, MTADiffusion ensures that generated objects are not only semantically accurate to the prompt but also geometrically sound and visually integrated into their surroundings. Experimental results on BrushBench and EditBench demonstrate that MTADiffusion achieves state-of-the-art performance in both quantitative metrics and human preference studies.

Introduction

Despite the rapid advancement of diffusion models in image generation, high-fidelity inpainting remains a difficult task. Current models frequently exhibit three primary failure modes:

  1. Semantic Misalignment: The model generates background textures or unrelated objects instead of following the text prompt.
  2. Structural Distortion: Generated objects appear "melted," anatomically incorrect, or lack clear boundaries.
  3. Style Inconsistency: The new content lacks the lighting, texture, or color palette of the original image, resulting in a "pasted-on" appearance.

MTADiffusion identifies the root cause of these issues as a lack of granular training data. Most models are trained on global image captions rather than specific descriptions of the masked regions. To bridge this gap, MTADiffusion introduces a comprehensive pipeline for data generation and a multi-task architecture designed for structural and stylistic harmony.

Methodology

MTAPipeline and MTADataset

To provide the model with the necessary supervision, the authors developed the MTAPipeline, an automated data generation system. It utilizes Grounded-SAM to detect and mask specific objects and LLaVA to generate highly detailed descriptions of those objects and their local styles. This process resulted in the MTADataset, which contains 5 million images and 25 million mask-text pairs. This dataset shifts the focus from global scene descriptions to local, mask-specific details, significantly reducing semantic misalignment.

Multi-Task Structural Guidance

To combat structural distortion, MTADiffusion is trained to perform two tasks simultaneously: denoising the latent image and predicting the edge map of the object (calculated via Sobel operators). This multi-task approach provides a "structural skeleton" during the diffusion process, forcing the network to learn and respect the underlying geometry and boundaries of the generated objects.

Style-Consistency Loss

To ensure the generated object blends seamlessly with the background, the authors integrated a Style-Consistency Loss. Borrowing from classic style transfer techniques, this loss uses a pre-trained VGG network and Gram matrices to measure the stylistic discrepancy between the generated region and the original background. This encourages the model to match the local lighting and texture of the source image.

Architecture

The model utilizes a dual-branch architecture. A main UNet handles the generation process, while a dedicated "brush branch" (inspired by BrushNet) utilizes self-attention to better perceive the global context of the image, ensuring the local edit remains consistent with the overall scene.

Experimental Results

MTADiffusion was evaluated against leading models, including SDI, PowerPaint, and BrushNet, using the BrushBench and EditBench benchmarks.

  • Quantitative Performance: On BrushBench, MTADiffusion achieved a VQA Score of 68.97, the highest among tested models, indicating superior alignment between the generated image and the text prompt. It also led in Image Reward (IR), a metric for aesthetic quality.
  • Qualitative User Study: In human evaluations, MTADiffusion was the clear favorite. Approximately 66% of participants preferred its semantic alignment, and 60% favored its structural stability over other state-of-the-art methods.
  • Versatility: The framework proved robust across different mask types, handling both object-specific masks and random "hole-filling" tasks within a single unified model.

Conclusion

MTADiffusion represents a significant step forward in image inpainting by prioritizing local mask-text alignment and structural guidance. By training on a massive, detailed dataset and employing multi-task learning, the model effectively mitigates the common pitfalls of hallucination and distortion. While the model's performance is currently tied to the quality of the automated captioning (LLaVA), future iterations using more advanced vision-language models promise even greater precision in context-aware image editing.

Summary updated

BibTeX
@inproceedings{huang2025mtadiffusion,
  author = {Jun Huang and Ting Liu and Yihang Wu and Xiaochao Qu and Luoqi Liu and Xiaolin Hu},
  title = {{MTADiffusion: Mask Text Alignment Diffusion Model for Object Inpainting}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01708},
}
Figure