Mask-Guided Video Inpainting for Localized Spatial and Counting Defects
Apply mask-guided video inpainting to fix localized object counts and spatial orientations in flawed clips rather than accepting faulty compromises or regenerating whole scenes.
Time
Compute level
Resources
What the paper used
Prerequisites
Scope
The Gap
In Section 3.2 (Equation 2) and Table C.2, StateWeaver limits each clip to one standard repair and at most two chief-authorized extra repairs using either full clip regeneration or whole-clip Ref2VA edit mode conditioned on newly synthesized reference images. When the base video generator repeatedly fails fine-grained spatial geometry—such as generating five coffee cups instead of four or aligning a voice recorder parallel to a notepad instead of crosswise (Appendix E.5)—the Chief Director selects a compromise candidate whose residual defect persists into downstream shots.
“These residual errors suggest that StateWeaver remains constrained by the capabilities of the base video model and that selecting a compromise candidate to balance quality and efficiency may amplify the impact of those limitations.”
Limitation
Whole-clip Ref2VA regeneration and reference-image conditioning struggle to enforce exact object cardinality and relative spatial orientation, forcing the pipeline to accept compromise clips that permanently lock geometric errors into subsequent memory.
Proposed Solution
Introduce a surgical pixel-space video-editing repair mode into the repair loop whenever Task Analyst repair diagnosis classifies a defect as localized (e.g., extra instance removal, object rotation, or framing out-of-bounds extension). Use open-vocabulary segmentation (Grounding DINO + SAM2) on the candidate clip to isolate the offending object mask (e.g., the fifth cup or misoriented prop), apply temporally consistent video inpainting/object-insertion or outpainting (e.g., VACE/Wan-Inpaint or Propainter + diffusion re-harmonization) conditioned on the target asset reference, and pass the surgically edited clip directly into candidate re-review without altering valid surrounding motion.
Why This Matters
Replacing full-clip regeneration with mask-guided video editing for localized geometric failures is expected to resolve counting and orientation errors within fewer repair rounds and stop compromise defects from propagating across sets.
How to Get Started
How to test it: Test the hypothesis that routing localized counting/orientation defects to mask-guided video inpainting reduces compromise-selection rate and improves ViMax-Bench Requirement Fulfillment and EntityBench Object Fidelity compared to StateWeaver's standard Ref2VA regeneration/edit mode, stopping if temporal smoothness (AMT Temp) drops by more than 0.02 or spatial defect resolution rate fails to improve by 20%.
- Extend the Task Analyst repair_diagnosis schema (Figure C.3) to classify defects as global-narrative, temporal-action, or localized-spatial (cardinality, orientation, framing crop).
- Integrate a temporal segmentation pipeline (Grounding DINO + SAM2) with a diffusion video inpainting/outpainting backend (such as VACE or a Wan-based inpainting adapter) as a new Material/Video repair tool.
- Benchmark the surgical repair tool on ViMax-Bench Type B/C tasks and constructed counting/orientation stress tests (mirroring Figure E.5 coffee-cup and interview-recorder scenes).
- Measure compromise-selection frequency, total repair GPU seconds per clip, AMT temporal smoothness, and downstream prop-consistency scores.
Code linked to this paper on Hugging Face: github.com/ghost233lism/StateWeaver
Suggested by AI. Adapt it to your setup.
Has This Been Done?
Agentic Retoucher for Text-To-Image Generation and See and Fix the Flaws discuss agentic visual artifact correction and image retouching, while various transformer-based inpainting surveys review video repair techniques. However, combining mask-guided video inpainting with automated defect diagnosis in an agentic video repair loop is not fully covered.
- Video Generation Meets Agent Harness: Agentic Video Generation, Agentic World Modeling and Recursive Self-Improvement · 2026 · 3 citations
- Agentic Retoucher for Text-To-Image Generation · 2026 · 10 citations
- See and Fix the Flaws: Enabling VLMs and Diffusion Models to Comprehend Visual Artifacts via Agentic Data Synthesis · 2026 · 0 citations
We searched OpenAlex and arXiv for “mask-guided video diffusion inpainting agentic spatial defect repair” and “Mask-Guided Video Inpainting for Localized Spatial and Counting Defects” and an AI compared the idea with the top 10 results. A small search can miss relevant work.
Source Paper
StateWeaver: Multi-Agent Coordination of Story-State Transitions for Long-Horizon Video GenerationModi Jin, Xuying Zhang, Yijing Guo +6 more · 2026
StateWeaver is a multi-agent long-horizon video generation framework designed to maintain cross-shot entity consistency and accurately depict event-driven story-state transitions. It unifies review-driven visual reference construction with isolated hierarchical planning and evidence-grounded cross-set handoffs, achieving state-of-the-art overall performance across predefined and autonomously planned storyboarding benchmarks.
Related Ideas
- Motion-Adaptive Multi-Fidelity Scheduling for Video Perception WorkersVibeVideoAgent: Closing the Perceptual Loop for Code-Driven Video Generation🟡Fairly easy
- Visual Feature Regularized Corrective Fine-Tuning for Quality Preservation in Video RLViDecide: Teaching Video Diffusion Models to Reason and Plan Step by Step🟡Fairly easy
- Syntax-Tree-Constrained Surgical Patching for Video Agent Edit LocalityVibeVideoAgent: Closing the Perceptual Loop for Code-Driven Video Generation🟡Fairly easy
- Native Video-Based Instructive Editing PipelineOmniVCus: Feedforward Subject-driven Video Customization with Multimodal Control Conditions🔴Hard
- End-to-End Layered Generation to Replace Heuristic CompositingDreamID-V:Bridging the Image-to-Video Gap for High-Fidelity Face Swapping via Diffusion Transformer🔴Hard