Instructions to use BigD233333/D2DF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use BigD233333/D2DF with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("BigD233333/D2DF", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
File size: 5,019 Bytes
a5d8a9b dfd353b 9c7911d a5d8a9b 4870f60 a5d8a9b 7a4a5af a5d8a9b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | <div align="center">
# From Draft to Draft-Free: One-Step Video Object Removal via Privileged Distillation and Fast Planting
**Zizhao Chen, Ping Wei<sup>β </sup>, Guang Dai, Jingdong Wang, Mengmeng Wang<sup>β </sup>**
Xi'an Jiaotong University Β· SGIT AI Lab Β·
Zhejiang University of Technology Β· Baidu
<sup>β </sup> Corresponding authors
<a href="https://bigd233.github.io/D2DF/"><img src="docs/assets/project-page-badge.svg" alt="Project Page"></a>
<a href="https://arxiv.org/abs/2607.14976"><img src="https://img.shields.io/badge/arXiv-Paper-b31b1b?logo=arxiv&logoColor=white" alt="arXiv Paper"></a>
<a href="https://huggingface.co/BigD233333/D2DF"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Hugging_Face-FFD21E" alt="Hugging Face"></a>
<a href="https://github.com/bigD233/D2DF"><img src="https://img.shields.io/badge/GitHub-Code-181717?logo=github&logoColor=white" alt="GitHub Code"></a>
</div>
<p align="center">
<img src="docs/assets/teaser.png" alt="Overview of the D2DF framework" width="100%">
</p>
**D2DF** is a three-stage framework for one-step video object removal. It first
distills a multi-step draft-guided diffusion teacher into **D2DF-DG**, a one-step
draft refiner, through **Prior-Privileged Consistency Distillation (PPCD)**. It then
uses the lightweight **Self-Guided Fast Planting (SGFP)** module to construct
pseudo-drafts in latent space, producing **D2DF-DF**, a fully draft-free one-step
generator.
This repository provides standalone inference code for both D2DF-DF and D2DF-DG
using the official Hugging Face `diffusers` and `transformers` packages.
## Installation
```bash
git clone https://github.com/bigD233/D2DF.git
cd D2DF
pip install -r requirements.txt
```
We recommend Python 3.11 and an NVIDIA GPU with CUDA support. The released
inference code was tested with PyTorch 2.8, CUDA 12.8, `diffusers >= 0.32`, and
`transformers >= 4.44`.
## Model Weights
Download the base **CogVideoX-5B-I2V** model from its
[official Hugging Face repository](https://huggingface.co/zai-org/CogVideoX-5b-I2V).
Download the **D2DF-DF** and **D2DF-DG** checkpoints from our
[D2DF Hugging Face repository](https://huggingface.co/BigD233333/D2DF). After
extracting the downloaded archives, pass the corresponding directories to
`--transformer_path`.
The included `prompt_embeds.pt` stores the pre-computed embedding for the prompt
`"background"`, so the T5 encoder does not need to be loaded during normal
inference.
## Input Format
Prepare the input as directories of numbered image files:
```text
inputs/
βββ imgs/
β βββ 00000.jpg
β βββ 00001.jpg
β βββ ...
βββ mask/
β βββ 00000.png
β βββ 00001.png
β βββ ...
βββ drafts/ # required only by D2DF-DG
βββ 00000.jpg
βββ 00001.jpg
βββ ...
```
- The repository includes this ready-to-run 25-frame example under `inputs/`.
- Frames, masks, and drafts are read in filename order.
- Mask pixels belonging to the removal target should have value `255` by default.
- Inputs are resized to the requested output resolution.
- The default setting uses 25 frames at 480 x 720 resolution.
## Inference
### D2DF-DF: Draft-Free One-Step Removal
No external draft is required:
```bash
python infer.py \
--mode df \
--base_model_path <PATH_TO_COGVIDEOX_5B_I2V> \
--transformer_path <PATH_TO_D2DF_DF> \
--frames_dir inputs/imgs \
--mask_dir inputs/mask \
--output_dir outputs/I-210910_I09032_T04_df \
--num_frames 25 \
--height 480 \
--width 720
```
### D2DF-DG: Draft-Guided One-Step Refinement
Supply a draft produced by a video object removal method such as ProPainter:
```bash
python infer.py \
--mode dg \
--base_model_path <PATH_TO_COGVIDEOX_5B_I2V> \
--transformer_path <PATH_TO_D2DF_DG> \
--frames_dir inputs/imgs \
--mask_dir inputs/mask \
--draft_dir inputs/drafts \
--output_dir outputs/I-210910_I09032_T04_dg \
--num_frames 25 \
--height 480 \
--width 720
```
The default configuration performs one denoising step with
`guidance_scale=1.0`. The output directory contains an MP4 video and a GIF
preview. Add `--save_frames` to also save individual PNG frames.
## Citation
```bibtex
@misc{chen2026d2df,
title={From Draft to Draft-Free: One-Step Video Object Removal via Privileged Distillation and Fast Planting},
author={Zizhao Chen and Ping Wei and Guang Dai and Jingdong Wang and Mengmeng Wang},
year={2026}
}
```
## Acknowledgements
Our implementation is built upon
[CogVideoX](https://github.com/THUDM/CogVideo),
[Hugging Face Diffusers](https://github.com/huggingface/diffusers), and
[ProPainter](https://github.com/sczhou/ProPainter). We sincerely thank the
contributors of these projects for their excellent work.
## License
This repository is released under the [Apache License 2.0](LICENSE).
## Contact
For questions about this work, please contact
[Zizhao Chen](mailto:bigd_chen@stu.xjtu.edu.cn).
|