Mask Consistency Regularization in Object Removal

Hua Yuan, Jin Yuan, Yicheng Jiang, Yao Zhang, Xin Geng, Yong RuiarXiv 2025 · DOI

Introduction

Modern image generation, powered by diffusion models like Stable Diffusion XL (SDXL), has reached unprecedented levels of realism. However, applying these models to the specific task of object removal—a subset of image inpainting—remains a significant challenge. Current state-of-the-art methods frequently suffer from two primary failure modes: Mask Hallucination, where the model generates irrelevant or spurious content within the masked region, and Mask-Shape Bias, where the model uses the silhouette of the mask as a structural hint, often regenerating the original object or a similarly shaped replacement instead of a seamless background.

To address these issues, researchers have introduced Mask Consistency Regularization (MCR), a novel training strategy designed to enforce geometry agnosticism and contextual alignment. By requiring the model to produce consistent results regardless of minor perturbations to the input mask, MCR achieves cleaner and more contextually accurate object removal.

Methodology: The MCR Framework

The MCR framework utilizes a frozen SDXL base model to leverage its generative power while maintaining computational efficiency. The learning process is concentrated in a "plug-and-play" ControlNet module, which is the only component updated during training.

Consistency-Driven Learning

The core of MCR lies in its parallel processing of three distinct mask branches during training:

  1. Original Mask: The standard segmentation mask of the target object.
  2. Mask Dilation: The mask is mathematically expanded to cover a larger area, forcing the model to rely more heavily on the distant surrounding context to infer the background.
  3. Mask Reshape: The mask is replaced with a bounding box or a random shape, breaking the model's dependence on the object's specific silhouette.
The MCR pipeline processes images through three parallel branches (Original, Dilated, and Reshaped) to enforce consistency and eliminate hallucination and shape bias.

A Consistency Loss is applied to penalize discrepancies between the latent representations ($z_O, z_D, z_R$) of these branches. This teaches the model that the background reconstruction should remain invariant to the specific geometry of the hole being filled.

Experimental Evaluation

The effectiveness of MCR was evaluated using two primary benchmarks:

  • BrushBench: A standard dataset of 600 images featuring human-annotated masks and descriptive captions.
  • 300-Sample Removal Test: A custom dataset including real-world photography and physics-engine-generated scenes. Crucially, this dataset provides "ground truth" background images, allowing for rigorous quantitative assessment of removal quality.

Results and Insights

MCR demonstrates superior performance across both quantitative and qualitative metrics. Quantitatively, it achieved the highest scores in LPIPS (Learned Perceptual Image Patch Similarity) and CMMD, indicating results that are both perceptually natural and statistically aligned with real-world image distributions.

Qualitative Comparison

Visual analysis reveals that MCR consistently outperforms established baselines such as LaMa, BrushNet, and SDXL-Inpainting. While competing models often leave "ghost" artifacts or hallucinate new, irrelevant objects (e.g., a bird where a cat was removed), MCR produces clean, context-aware backgrounds.

Qualitative comparison of object removal across different methods. MCR (Ours) consistently provides cleaner results without the hallucinations or shape-biases seen in baselines.

Key Insights

  • Geometry Agnosticism: By treating mask perturbations as a form of regularization, the model learns to ignore the "hint" provided by the mask's shape.
  • Contextual Alignment: Dilation forces the model to look further into the environment, ensuring the filled region matches the global scene structure.

Conclusion and Future Work

Mask Consistency Regularization represents a significant step forward in making diffusion-based image editing robust for real-world applications. By decoupling the reconstruction process from the mask's geometry, MCR effectively mitigates common failure modes in object removal. Future research will explore more complex perturbation strategies and analyze the impact of MCR on diverse background textures, such as highly structured versus stochastic patterns.

Summary updated

BibTeX
@misc{yuan2025mask,
  author = {Hua Yuan and Jin Yuan and Yicheng Jiang and Yao Zhang and Xin Geng and Yong Rui},
  title = {{Mask Consistency Regularization in Object Removal}},
  year = {2025},
  eprint = {2509.10259},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.10259},
}
Figure