Abstract
SmartBrush is a diffusion-based inpainting model designed for precise object insertion, leveraging both text prompts and shape masks. By treating masks as guidance rather than simple holes and predicting object-specific masks, it achieves superior background preservation and shape alignment compared to existing state-of-the-art models. Evaluation on standard benchmarks demonstrates that SmartBrush significantly outperforms baselines in both quantitative metrics and human preference studies.
Introduction
While text-to-image models have become incredibly powerful, using them for object inpainting—adding a specific object into an existing scene—remains a significant challenge. Current state-of-the-art models often suffer from three primary issues: mask misalignment (ignoring the user's provided shape), text misalignment (filling areas with background textures instead of the requested object), and background destruction (replacing original pixels within a coarse mask area).
Generic inpainting models typically treat a mask as a "hole" to be filled. SmartBrush re-imagines the mask as a shape guidance tool, allowing for varying levels of precision from rough bounding boxes to exact silhouettes. This approach ensures that the generated content respects the user's intent while preserving the integrity of the surrounding scene.
Methodology
SmartBrush is built by fine-tuning a Stable Diffusion (v1.2) architecture with several architectural and procedural innovations designed to enhance control and preservation.
Shape Precision Control
The model introduces a "precision indicator" ($s$) during training. By generating a spectrum of masks ranging from perfect instance segmentations ($s=0$) to blurry shapes and full bounding boxes ($s=S$), the model learns to strictly follow precise masks while allowing for more creative freedom within the bounds of rougher inputs.
Object Mask Prediction
To address background preservation, the U-Net architecture was modified with an extra output channel to predict the actual mask of the generated object. During the denoising process, the model uses this predicted mask to distinguish between the generated object and the original background, effectively preventing the "box-shaped" artifacts common in traditional inpainting models.
Multi-task Training and Local Captions
To maintain general generative capabilities, the model is jointly trained on inpainting and standard text-to-image generation using the LAION dataset. Furthermore, instead of using global image captions, the researchers utilized the BLIP model to generate local captions specifically for the masked objects, ensuring high text-to-object alignment.
Key Results
SmartBrush significantly outperforms industry leaders such as GLIDE, Blended Diffusion, and Stable Inpainting across multiple dimensions.
- Quantitative Performance: On the OpenImages dataset using bounding box masks, SmartBrush achieved a Local FID of 9.71, a marked improvement over Stable Inpainting (12.57) and GLIDE (22.45).
- Qualitative Superiority: Visual comparisons demonstrate that SmartBrush maintains background textures (e.g., floral patterns or wall details) that other models often overwrite. It also shows superior adherence to complex text prompts and varied artistic styles.
- User Preference: In a study conducted via Amazon Mechanical Turk, over 50% of users preferred SmartBrush's results over DALL-E 2 and Stable Diffusion regarding shape alignment, text alignment, and overall realism.
Discussion and Future Work
A core insight of this work is that masks should be treated as priors rather than just missing data. By introducing precision as a hyperparameter, SmartBrush offers a path toward user interfaces with "fidelity" sliders, giving creators granular control over AI interpretation.
However, the model currently faces the "Large Shadow" problem. Because generation is constrained within the user-defined mask, the model struggles to produce shadows or reflections that should naturally fall outside that area. Future research will explore methods to allow these effects to "bleed" into the surrounding background while maintaining the high level of preservation that defines SmartBrush.
Summary updated