Abstract
Object removal aims to erase designated objects from an image while maintaining visual coherence. Traditional approaches rely on general image inpainting networks, which often yield unsatisfactory results due to a "task identity crisis"—the conflict between restoring partially occluded objects and completely removing them. We propose a task-decoupled image inpainting framework that generates two specialized models: an object restorer and an object remover. By training the restorer to complete objects and using its output as a negative guidance for the remover, we achieve superior class-specific object erasure. Our framework also includes a novel data curation method to simulate ground-truth removal scenarios. Experimental results across multiple datasets demonstrate that our class-specific remover significantly outperforms general-purpose inpainting models.
The Inpainting Identity Crisis
Standard image inpainting models are typically trained to handle two distinct scenarios using a single architecture:
- Restoration: Completing an object that is partially obscured (e.g., a car behind a fence).
- Removal: Entirely erasing an object and replacing it with background texture.
These tasks are fundamentally contradictory. In restoration, the model must leverage its knowledge of object features to "fill in" the missing parts. In removal, the model must ignore those same features to avoid leaving "afterimages"—ghostly traces of the original object. Because standard training encourages the model to match the original image (which contains the object), the network often struggles to decide whether to fix or delete the target, leading to artifacts.
Decoupling Restoration and Removal
To resolve this conflict, we introduce a task-decoupled framework. Instead of a single model, we train two specialized components:
- The Object Restorer: Trained specifically to complete objects of a target class (e.g., cars or people). It becomes an expert in the geometry and appearance of that class.
- The Object Remover: The primary tool for erasure. It is trained using the Restorer as a "negative guide."
We implement a Guidance Loss ($L_{afterimage}$) during the training of the Remover. This loss function penalizes the Remover if its output resembles the Restorer’s "completed" version of the object. By learning what the object should look like and then intentionally avoiding those features, the Remover produces much cleaner background textures.
Specialized Data Curation
A major hurdle in training object removers is the lack of "ground truth" pairs—images of the exact same scene with and without the object. We address this through a clever data curation strategy. We identify images that naturally do not contain the target class and apply masks shaped like that class. This allows the model to learn exactly what a background should look like when an object-shaped hole is present, providing a reliable training signal for the Remover.
Performance and Results
We evaluated the framework on the COCO dataset (for people) and a custom Assorted Vehicle Dataset (including KITTI and Cityscapes for cars). Our method was compared against state-of-the-art models like LaMa, MAT, and RePaint.
- Quantitative Metrics: Our model achieved the best scores in modified metrics like FID (Fréchet Inception Distance) and U-IDS*, which measure removal quality without requiring ground-truth backgrounds. On the vehicle dataset, our framework achieved an FID of 42.64, compared to LaMa's 48.15.
- Qualitative Quality: Visually, our class-specific remover eliminates the "ghosting" effects common in general models. By specializing in a single class, the model leverages specific shape and texture priors to blend the background seamlessly.
Conclusion
By decoupling the tasks of restoration and removal, our framework effectively eliminates the training conflicts that plague general inpainting models. While currently class-dependent—requiring separate training for different object types—the results demonstrate that specialization leads to significantly higher quality object removal. Future work will explore more universal applications of this decoupled approach.
Summary updated