Zhixianvsdgdsg/context-aware-attentive-eraser
Context-Aware Attentive Eraser
An experimental, visualization-first extension of Attentive Eraser (AAAI 2025 Oral) for mask-guided object removal.
Proposed innovation: CAMS
The paper uses fixed removal guidance (s=9) and similarity suppression (lambda=0.3) and reports two limitations: two U-Net evaluations per denoising step, and degraded reconstruction for very large masks. This project proposes Context-Adaptive Multi-stage Scheduling (CAMS):
- measure mask ratio, boundary complexity, and texture in a ring around the mask;
- adapt removal guidance, similarity suppression, inpainting strength, and schedule boundaries;
- expose a late-step cutoff for future single-branch execution to reduce redundant U-Net work;
- warn when the mask leaves too little background context.
CAMS is a research hypothesis. The repository does not claim benchmark gains until the evaluation plan below has been run.
Run
pip install -r requirements.txt
python app.pyWithout CUDA the UI runs in analysis mode and visualizes the adaptive schedule. With CUDA it lazily loads the Hugging Face Diffusers community pipeline and enables image generation.
Evaluation plan
- Dataset: the same 10,000 OpenImages V5 test pairs used by the paper.
- Baselines: fixed
s=9, lambda=0.3; CAMS; CAMS without texture adaptation; CAMS without late cutoff. - Metrics: Local-FID, CLIP background score, CLIP consensus across seeds 123/321/777, LPIPS outside the mask, and runtime/peak VRAM.
- Stratify results by mask ratio: 0-10%, 10-25%, 25-45%, and >45%.
- Report confidence intervals and all failure cases; do not select only favorable examples.
Attribution
Based on the method described in:
Wenhao Sun, Benlei Cui, Xue-Mei Dong, Jingqun Tang. “Attentive Eraser: Unleashing Diffusion Model's Object Removal Potential via Self-Attention Redirection Guidance.” AAAI 2025.
Official implementation: https://github.com/Anonym0u3/AttentiveEraser Paper: https://arxiv.org/abs/2412.12974
This extension is released under Apache-2.0. Model access and use remain subject to the upstream model licenses.
