MartaYang007 commited on
Commit
ca7abe3
·
verified ·
1 Parent(s): 0be9b89

Add model card README

Browse files
Files changed (1) hide show
  1. README.md +312 -0
README.md CHANGED
@@ -1,3 +1,315 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ pipeline_tag: image-to-video
4
+ tags:
5
+ - video-generation
6
+ - human-animation
7
+ - one-shot
8
  ---
9
+
10
+ # ONE-SHOT: Compositional Human-Environment Video Synthesis via Spatial-Decoupled Motion Injection and Hybrid Context Integration
11
+
12
+ <div align="center">
13
+ <a href="https://github.com/MartaYang/ONE-SHOT-code/blob/main/README.md">English</a> | <a href="https://github.com/MartaYang/ONE-SHOT-code/blob/main/README_zh.md">简体中文</a>
14
+ </div>
15
+
16
+ <div align="center">
17
+ <a href="https://arxiv.org/abs/2604.01043" target="_blank"><img src="https://img.shields.io/badge/Paper-b31b1b.svg?logo=arxiv&logoColor=white" height="22px"></a>
18
+ <a href="https://martayang.github.io/ONE-SHOT/" target="_blank"><img src="https://img.shields.io/badge/Webpage-4f46e5.svg?logo=googlechrome&logoColor=white" height="22px"></a>
19
+ <a href="https://huggingface.co/MartaYang007/ONE-SHOT-14B" target="_blank"><img src="https://img.shields.io/badge/Model-f59e0b.svg?logo=huggingface&logoColor=white" height="22px"></a>
20
+ <a href="https://github.com/MartaYang/ONE-SHOT-code" target="_blank"><img src="https://img.shields.io/badge/Code-111111.svg?logo=github&logoColor=white" height="22px"></a>
21
+ </div>
22
+
23
+ <div align="center">
24
+ Fengyuan Yang<sup>1,2</sup>&nbsp;&nbsp;
25
+ Luying Huang<sup>2,&dagger;</sup>&nbsp;&nbsp;
26
+ Jiazhi Guan<sup>2,&#9993;</sup>&nbsp;&nbsp;
27
+ Quanwei Yang<sup>2</sup>&nbsp;&nbsp;
28
+ Dongwei Pan<sup>2</sup>&nbsp;&nbsp;
29
+ Jianglin Fu<sup>2</sup>&nbsp;&nbsp;
30
+ Haocheng Feng<sup>2</sup>&nbsp;&nbsp;
31
+ Wei He<sup>2</sup>&nbsp;&nbsp;
32
+ Kaisiyuan Wang<sup>2</sup>&nbsp;&nbsp;
33
+ Hang Zhou<sup>2,&#9993;</sup>&nbsp;&nbsp;
34
+ Angela Yao<sup>1</sup>
35
+ </div>
36
+
37
+ <div align="center">
38
+ <sup>1</sup> National University of Singapore &nbsp;&nbsp;
39
+ <sup>2</sup> Baidu, AMU
40
+ </div>
41
+
42
+ <div align="center">
43
+ &dagger; Project leader &nbsp;&nbsp; &#9993; Corresponding authors &nbsp;&nbsp;
44
+ Work done during Fengyuan's internship at Baidu
45
+ </div>
46
+
47
+ Official inference code for **ONE-SHOT: Compositional Human-Environment Video Synthesis via Spatial-Decoupled Motion Injection and Hybrid Context Integration**.
48
+
49
+ ONE-SHOT is a parameter-efficient framework for controllable human-environment video synthesis. It supports independent control over subject identity, human motion, scene context, and camera trajectory while preserving persistent identity and stable interactions in long generations.
50
+
51
+ ## 🧾 Abstract
52
+
53
+ Recent advances in Video Foundation Models (VFMs) have revolutionized human-centric video synthesis, yet fine-grained and independent editing of subjects and scenes remains a critical challenge. We introduce **ONE-SHOT**, a parameter-efficient framework built upon pre-trained VFMs that achieves high-fidelity synthesis of human-environment videos with independent control over subject appearance, human dynamics, spatial environments, and camera trajectories. By optimizing only a sparse set of parameters, it achieves precise control while preserving responsiveness to textual instructions. A canonical-space motion injection mechanism mitigates conditioning competition between rigid human priors and text prompts. By anchoring static and dynamic context, ONE-SHOT ensures persistent subject identity and stable human-environment interactions across minute-scale generations. Extensive experiments demonstrate that ONE-SHOT significantly outperforms existing methods in structural control and creative diversity.
54
+
55
+ ## 🖼️ Overview
56
+
57
+ ![ONE-SHOT teaser overview](https://raw.githubusercontent.com/MartaYang/ONE-SHOT-code/main/assets/fig_teaser.webp)
58
+
59
+ ## 📰 News
60
+
61
+ - 🔥 **`2026/05/31`**: The `ONE-SHOT-14B` diffusers checkpoint can be downloaded from [Hugging Face](https://huggingface.co/MartaYang007/ONE-SHOT-14B).
62
+ - 🔥 **`2026/04/01`**: The ONE-SHOT paper is available on [arXiv](https://arxiv.org/abs/2604.01043).
63
+ - 🔥 **`2026/04/01`**: ONE-SHOT project materials are available on the [project page](https://martayang.github.io/ONE-SHOT/).
64
+
65
+ ## 📊 Metrics
66
+
67
+ ![ONE-SHOT main paper metrics](https://raw.githubusercontent.com/MartaYang/ONE-SHOT-code/main/assets/metrics_main.png)
68
+
69
+ ![ONE-SHOT supplementary metrics](https://raw.githubusercontent.com/MartaYang/ONE-SHOT-code/main/assets/metric_supp.png)
70
+
71
+ ## 🚀 Quick Start
72
+
73
+ ### 🛠️ Installation
74
+
75
+ Recommended environment:
76
+
77
+ - Linux
78
+ - NVIDIA GPU
79
+ - CUDA 12.1 compatible driver
80
+ - Python 3.12
81
+ - `ffmpeg` with `libx264` support
82
+
83
+ ```bash
84
+ git clone https://github.com/MartaYang/ONE-SHOT-code.git
85
+ cd ONE-SHOT-code
86
+
87
+ bash install.sh
88
+ conda activate oneshot
89
+ ```
90
+
91
+ The installer creates the `oneshot` conda environment, installs a GPL-enabled `ffmpeg`, installs PyTorch `2.5.1+cu121`, installs the vendored PyTorch3D wheel, and then installs `requirements.txt`.
92
+
93
+ <details>
94
+ <summary>Manual installation commands</summary>
95
+
96
+ ```bash
97
+ conda create -n oneshot python=3.12 -y
98
+ conda activate oneshot
99
+
100
+ conda install 'ffmpeg=*=*gpl*' -y
101
+
102
+ pip install --index-url https://download.pytorch.org/whl/cu121 \
103
+ torch==2.5.1+cu121 torchvision==0.20.1+cu121 torchaudio==2.5.1+cu121
104
+
105
+ pip install Preprocessing/third_party/wheels/pytorch3d-0.7.9-cp312-cp312-manylinux_2_31_x86_64.whl
106
+ pip install -r requirements.txt
107
+ ```
108
+
109
+ </details>
110
+
111
+ ### 📦 Checkpoints
112
+
113
+ Download the released checkpoint and set `ONESHOT_MODEL_DIR`:
114
+
115
+ ```bash
116
+ hf download MartaYang007/ONE-SHOT-14B \
117
+ --local-dir pretrained_models/ONESHOT-14B-diffusers
118
+
119
+ export ONESHOT_MODEL_DIR=pretrained_models/ONESHOT-14B-diffusers
120
+ ```
121
+
122
+ A recommended local checkpoint layout is:
123
+
124
+ ```text
125
+ pretrained_models/
126
+ └── ONESHOT-14B-diffusers/
127
+ ├── transformer/
128
+ ├── vae/
129
+ ├── text_encoder/
130
+ ├── tokenizer/
131
+ ├── scheduler/
132
+ ├── model_index.json
133
+ ├── preprocess/
134
+ │ ├── human3r.pth
135
+ │ ├── DA3NESTED-GIANT-LARGE-1.1/
136
+ │ ├── smpl_models/
137
+ │ │ └── smplx/
138
+ │ │ └── SMPLX_NEUTRAL.npz # YOU MUST DOWNLOAD THIS — see below
139
+ │ └── torch_hub/
140
+ └── demo/
141
+ ```
142
+
143
+ #### SMPL-X body model (manual download)
144
+
145
+ The SMPL-X license prohibits third-party redistribution, so `SMPLX_NEUTRAL.npz`
146
+ is not included in the Hugging Face checkpoint.
147
+
148
+ 1. Register at <https://smpl-x.is.tue.mpg.de/> and accept the model license.
149
+ 2. From the **Downloads** page, fetch the latest `SMPL-X (NPZ format)` release.
150
+ 3. Place the file at:
151
+
152
+ ```text
153
+ $ONESHOT_MODEL_DIR/preprocess/smpl_models/smplx/SMPLX_NEUTRAL.npz
154
+ ```
155
+
156
+ If the file is missing at runtime, the pipeline fails fast with an error
157
+ pointing back to this section.
158
+
159
+ ### ▶️ Inference
160
+
161
+ The end-to-end entrypoint is:
162
+
163
+ ```bash
164
+ bash scripts/run_pipeline.sh <id_swap|motion_swap|scene_swap> [task arguments]
165
+ ```
166
+
167
+ Supported tasks:
168
+
169
+ | Task | Required inputs | Description |
170
+ | --- | --- | --- |
171
+ | `id_swap` | source video, identity profile video or identity profile images, prompt | Replace the actor identity while preserving the source motion and scene. |
172
+ | `motion_swap` | source video, motion video, prompt | Apply a new motion to the original subject and scene. |
173
+ | `scene_swap` | source video, scene video, prompt | Place the person into a different environment. |
174
+
175
+ Example commands:
176
+
177
+ <details open>
178
+ <summary>ID swap</summary>
179
+
180
+ ```bash
181
+ bash scripts/run_pipeline.sh id_swap \
182
+ --video_path "$ONESHOT_MODEL_DIR/demo/walkinforest.mp4" \
183
+ --id_profile_video "$ONESHOT_MODEL_DIR/demo/WillSmith.mp4" \
184
+ --prompt "A sunlit forest trail with dense green trees and soft natural light filtering through the leaves. Will Smith, wearing a black suit, walks steadily along the forest path while holding a wooden walking stick, looking slightly upward as he moves forward."
185
+
186
+ # --id_profile_video: recommended — video with multi-angle coverage of the target person
187
+ # (front + side + other angles) for best identity fidelity.
188
+ # Alternative: --id_profile_dir <dir> with 4 images named exactly:
189
+ # ref1.png (front view) ref2.png (back / 3/4 view) ref3.png (side view) face.png (face crop)
190
+ ```
191
+
192
+ `--id_profile_video` is recommended when the identity reference contains multi-angle coverage. Alternatively, provide `--id_profile_dir <dir>` with `ref1.png`, `ref2.png`, `ref3.png`, and `face.png`.
193
+
194
+ </details>
195
+
196
+ <details>
197
+ <summary>Motion swap</summary>
198
+
199
+ ```bash
200
+ bash scripts/run_pipeline.sh motion_swap \
201
+ --video_path "$ONESHOT_MODEL_DIR/demo/museum4_human.mp4" \
202
+ --motion_video_path "$ONESHOT_MODEL_DIR/demo/taiji.mp4" \
203
+ --prompt "An indoor space resembling the interior of a museum. A man in a suit is performing tai chi movements."
204
+
205
+ # to also swap identity: add --id_profile_video $ONESHOT_MODEL_DIR/demo/WillSmith.mp4
206
+ # Note: update the prompt accordingly (e.g., gender, name) to match the new identity and avoid conflicts with the video content.
207
+ ```
208
+
209
+ To also swap identity, add `--id_profile_video "$ONESHOT_MODEL_DIR/demo/WillSmith.mp4"` and update the prompt so the identity description does not conflict with the video content.
210
+
211
+ </details>
212
+
213
+ <details>
214
+ <summary>Scene swap</summary>
215
+
216
+ ```bash
217
+ bash scripts/run_pipeline.sh scene_swap \
218
+ --video_path "$ONESHOT_MODEL_DIR/demo/palace_human.mp4" \
219
+ --scene_video_path "$ONESHOT_MODEL_DIR/demo/museum4_scene.mp4" \
220
+ --id_profile_video "$ONESHOT_MODEL_DIR/demo/WillSmith.mp4" \
221
+ --prompt "An indoor space resembling the interior of a museum. Will Smith is walking, wearing a black suit."
222
+
223
+ # --scene_video_path: must be a pure background video (no human subjects).
224
+ # Strongly recommended to choose a background video whose depth-of-field
225
+ # matches the person in --video_path for best generation quality.
226
+ # to also swap identity: add --id_profile_video $ONESHOT_MODEL_DIR/demo/WillSmith.mp4
227
+ # Note: update the prompt accordingly (e.g., gender, name) to match the new identity and avoid conflicts with the video content.
228
+ ```
229
+
230
+ To preserve the original identity, omit `--id_profile_video` and update the prompt accordingly.
231
+
232
+ </details>
233
+
234
+ Generated videos are saved to:
235
+
236
+ ```text
237
+ exp/<scheduler>_<task>_<timestamp>/<save_name>.mp4
238
+ ```
239
+
240
+ For example:
241
+
242
+ ```text
243
+ exp/lcm_id_swap_20260527_221947/ID_WillSmith-SMPLX_clip_000-006-Scene_C01_gen_xxx_ourGen81.mp4
244
+ ```
245
+
246
+ ## 🤗 Available Models
247
+
248
+ | Model | Status | Link |
249
+ | --- | --- | --- |
250
+ | ONE-SHOT-14B | Available | [MartaYang007/ONE-SHOT-14B](https://huggingface.co/MartaYang007/ONE-SHOT-14B) |
251
+
252
+ ## 📝 Notes
253
+
254
+ - `scripts/run_pipeline.sh` builds a task CSV, selects available GPUs with the most free memory, and launches `scripts/inference_short.sh`.
255
+ - Set `ONESHOT_ENV` if your conda environment name is not `oneshot`.
256
+ - The demo videos are included in the checkpoint download, but using your own videos is recommended for real experiments.
257
+ - The prompt should match any swapped identity, motion, or scene to avoid conflicts between text and visual conditions.
258
+
259
+ ## 🗺️ TODO
260
+
261
+ - [ ] Multi-GPU inference with FSDP-based model sharding and sequence parallelism.
262
+ - [ ] ComfyUI support for node-based experimentation and demos.
263
+ - [ ] Fully compositional generation with explicit identity, motion, scene, and position controls.
264
+
265
+ ## 📁 Repository Layout
266
+
267
+ ```text
268
+ ONE-SHOT-code/
269
+ ├── install.sh # one-shot conda environment installer
270
+ ├── requirements.txt
271
+ ├── tools/
272
+ │ ├── inference_short.py # short-video inference entrypoint
273
+ │ └── inference_long.py # long-video inference with scene memory
274
+ ├── scripts/
275
+ │ ├── run_pipeline.sh # preprocessing + inference pipeline
276
+ │ ├── inference_short.sh
277
+ │ └── inference_long.sh
278
+ ├── Preprocessing/
279
+ │ ├── preprocess_video.py # per-video preprocessing
280
+ │ ├── build_csv.py # task CSV builder
281
+ │ ├── make_scene_masked_dilate.py
282
+ │ └── third_party/ # vendored DUSt3R, Human3R, CroCo, and utilities
283
+ ├── oneshot_diffusers/ # ONE-SHOT diffusers overrides
284
+ │ ├── transformer_wan_oneshot.py
285
+ │ ├── pipeline_wan_oneshot.py
286
+ │ └── oneshot_util.py
287
+ ├── utils/ # ODE solvers and video I/O helpers
288
+ └── datasets/ # DWPose drawing and data utilities
289
+ ```
290
+
291
+ ## 🙏 Acknowledgement
292
+
293
+ This project builds on:
294
+
295
+ - [Wan2.1](https://github.com/Wan-Video/Wan2.1)
296
+ - [Human3R](https://github.com/fanegg/Human3R)
297
+ - [DUSt3R](https://github.com/naver/dust3r)
298
+ - [Depth-Anything-3](https://github.com/DepthAnything/Depth-Anything-V2)
299
+ - [SMPL-X](https://smpl-x.is.tue.mpg.de/)
300
+ - [PyTorch3D](https://github.com/facebookresearch/pytorch3d)
301
+ - [Diffusers](https://github.com/huggingface/diffusers)
302
+
303
+ ## 📚 Citation
304
+
305
+ ```bibtex
306
+ @misc{yang2026oneshot,
307
+ title={ONE-SHOT: Compositional Human-Environment Video Synthesis via Spatial-Decoupled Motion Injection and Hybrid Context Integration},
308
+ author={Fengyuan Yang and Luying Huang and Jiazhi Guan and Quanwei Yang and Dongwei Pan and Jianglin Fu and Haocheng Feng and Wei He and Kaisiyuan Wang and Hang Zhou and Angela Yao},
309
+ year={2026},
310
+ eprint={2604.01043},
311
+ archivePrefix={arXiv},
312
+ primaryClass={cs.CV},
313
+ url={https://arxiv.org/abs/2604.01043}
314
+ }
315
+ ```