DuoEdit: A Unified Local Video Editing Model Learning Only Two Primitive Operators

DuoEdit learns only two basic operations: removing a subject from a video using a mask, and inserting a new subject using per-frame bounding box trajectories and appearance reference images. The two conditions are independent and can be enabled simultaneously, so replacement and multi-subject mixed editing do not require combined training data and are completed in a single inference pass; reference images do not need to match the pose or viewpoint of the target video, relying instead on shared subject IDs to map to their respective bounding box trajectories, while prompts primarily supplement physical effects such as secondary motion and lighting.

Original Title: DuoEdit: A Unified Local Video Editing Model Learning Only Two Primitive Operators

DuoEdit learns only two basic operations: removing a subject from a video using a mask, and inserting a new subject using per-frame bounding box trajectories and appearance reference images. The two conditions are independent and can be enabled simultaneously, so replacement and multi-subject mixed editing do not require combined training data and are completed in a single inference pass; reference images do not need to match the pose or viewpoint of the target video, relying instead on shared subject IDs to map to their respective bounding box trajectories, while prompts primarily supplement physical effects such as secondary motion and lighting.

Why It Matters Multi-subject combined editing makes it difficult to find paired training data; this model trains only on simple deletion and insertion samples, achieving zero-shot replacement and mixed editing by enabling both conditions simultaneously

Likes 19 · Code Stars 3

Reasons

  • The paper claims that deletion and insertion performance meets or exceeds current state-of-the-art levels, and zero-shot combined editing is more reliable than mainstream unified video editing models and step-by-step editing (the abstract does not provide specific numbers)
  • Inference code is Apache-2.0, with adapted weights available on Hugging Face at JiayiWuLeo/DuoEdit; the repository includes four examples: removing a surfer from the sea, inserting a lantern illuminating a grassy field, inserting two interacting people and objects, and simultaneously inserting, deleting, and replacing in a kitchen
  • Hugging Face likes 19 and code stars 3 only represent attention levels

Usage

  • Create a Python 3.10 environment with conda, run pip install -r requirements.txt (the authors tested on PyTorch 2.11); use hf download to fetch the base model alibaba-pai/Wan2.2-Fun-A14B-Control and JiayiWuLeo/DuoEdit into the models/ directory
  • To replace a subject: python inference.py --base_model <base_model> --weights <DuoEdit> --source clip.mp4 --mask <mask_directory> --boxes <box_trajectory.json> --references <reference_image.png> --prompt "..."; providing only --mask performs deletion, while providing only --boxes and --references performs insertion
  • Convert the source video to 16 fps with a maximum of 81 frames; adding --conditioning_only allows previewing input conditions using only the CPU, and for batch editing, use --input to point to a directory where each task has its own edit.json file

Risks

  • The base model is a 14B dual-expert model; it can only fit into a 80 GB GPU when --expert_swap is enabled, making it difficult to run on consumer-grade graphics cards
  • Masks and per-frame bounding boxes must be prepared manually using segmentation models and annotation tools; the repository does not include automatic annotation
  • The weights are derived adapters for Wan2.2-Fun-A14B-Control and must comply with the base model's license; the model is trained on 81 frames (approximately 5 seconds)

Open · Code · Hugging Face Paper Page

Hugging Face Daily Papers

Explore the latest AI Radar updates