TL;DR
RealFill is a novel generative framework that achieves "authentic" image completion by personalizing a diffusion model on a small set of reference images. Unlike standard inpainting that "hallucinates" plausible but fake content, RealFill recovers the actual scene details—like a specific dress pattern or a missing architectural element—even when reference photos are taken from different angles or in different lighting.
What Problem Does This Paper Address?
Current image completion tools, such as Photoshop’s Generative Fill, are incredibly good at creating plausible content. If you remove a person from a park bench, the AI can fill in the bench and the grass behind them. However, that grass and bench are "hallucinations"—they aren't necessarily what was actually there in the real world.
For many applications, like fixing a nearly perfect vacation photo where a key detail was cut off, we need authentic completion. Existing reference-based methods usually rely on rigid geometric transformations (warping pixels from one photo to another). These methods fail catastrophically when the camera moves significantly, the lighting changes, or the subject (like a person or a pet) moves between shots. RealFill bridges this gap by combining the creative power of generative models with the scene-specific accuracy of reference photos.
Methods
RealFill utilizes a "personalization" approach, similar in spirit to DreamBooth, but adapted for the task of inpainting.
- Fine-tuning with LoRA: The researchers start with a pre-trained Stable Diffusion inpainting model. For every new scene, they perform a lightweight fine-tuning process using Low-Rank Adaptation (LoRA). The model is trained on the target image (with random patches masked out) and a few reference images (up to five).
- Scene-Specific Prompting: During training, the scene is associated with a unique identifier (e.g., "a photo of [V]"). This teaches the model to associate the specific textures, lighting, and geometry of that scene with that prompt.
- Correspondence-Based Seed Selection: Because diffusion models are stochastic, they can produce multiple different versions of a filled-in region. To find the most "authentic" one, RealFill uses an automated filtering process. It uses a feature-matching algorithm (LoFTR) to count how many points in the generated region match the reference images. The version with the most matches is selected as the most faithful to the original scene.
Datasets
The authors introduced RealBench, a new benchmark specifically designed for authentic image completion.
- Composition: 33 scenes (23 outpainting and 10 inpainting).
- Content: Each scene includes 1-5 reference images, a target image with a missing region, and—crucially—a ground-truth image of what that missing region actually looks like.
- Diversity: The dataset covers challenging real-world variables, including drastic changes in viewpoint, lighting, motion blur, and subject pose.
Key Insights and Ideas
- Authenticity over Plausibility: The core "aha" moment is that a generative model's prior (its knowledge of what the world looks like) can be successfully constrained by a scene-specific fine-tuning to recover ground-truth details that no general model could ever guess.
- Generative > Geometric: By using a diffusion model instead of traditional image warping, RealFill can handle "non-rigid" changes. For example, if a person is in a different pose in the reference photo, RealFill can still learn the pattern of their clothes and apply it to their pose in the target image.
- Automating Faithfulness: The use of correspondence matching (LoFTR) to rank generative outputs is a clever way to solve the "stochasticity problem" in diffusion, ensuring the final result isn't just a lucky guess but a verified match to the reference data.
Key Results
RealFill significantly outperformed both prompt-based (Stable Diffusion, Generative Fill) and reference-based (TransFill, Paint-by-Example) baselines.
- Quantitative: On the RealBench dataset, RealFill achieved a PSNR of 14.78 and an LPIPS of 0.431, beating the next best reference-based method (TransFill) by a wide margin.
- User Study: In a study with 44 participants, RealFill was chosen as the "most realistic" 63.7% of the time and the "most faithful" 87.2% of the time.
- Robustness: As shown in Figure 3, the model maintains high fidelity even across dramatic changes in aperture, lighting, and object motion.
Limitations and Future Work
- Speed: The primary drawback is that RealFill requires a gradient-based fine-tuning process for each new scene, which typically takes about 20 minutes on an NVIDIA A100 GPU. This makes it less suitable for instant, real-time applications.
- Base Model Constraints: RealFill inherits the limitations of its base model (Stable Diffusion v2). It can struggle with rendering fine details like human faces, hands, or specific text if the base model isn't already proficient at them.
- 3D Understanding: While better than warping, the model can still struggle to perfectly reconstruct complex 3D structures if the viewpoint change is extremely large and only one reference image is provided.
Future work may focus on speeding up the personalization process or integrating better 3D priors to handle even more extreme perspective shifts.
Summary updated