Skip to content

Commit 1659a1c

Browse files
Merge pull request #394 from Stability-AI/yiming/sv4d
merge sv4d changes: 1. reduce memory consumption (40G -> 20G) and speed up (500s -> 200s) 2. add gradio demo
2 parents e0596f1 + 37ab71e commit 1659a1c

20 files changed

+745
-115
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@
99
- We are releasing **[Stable Video 4D (SV4D)](https://huggingface.co/stabilityai/sv4d)**, a video-to-4D diffusion model for novel-view video synthesis. For research purposes:
1010
- **SV4D** was trained to generate 40 frames (5 video frames x 8 camera views) at 576x576 resolution, given 5 context frames (the input video), and 8 reference views (synthesised from the first frame of the input video, using a multi-view diffusion model like SV3D) of the same size, ideally white-background images with one object.
1111
- To generate longer novel-view videos (21 frames), we propose a novel sampling method using SV4D, by first sampling 5 anchor frames and then densely sampling the remaining frames while maintaining temporal consistency.
12+
- To run the community-build gradio demo locally, run `python -m scripts.demo.gradio_app_sv4d`.
1213
- Please check our [project page](https://sv4d.github.io), [tech report](https://sv4d.github.io/static/sv4d_technical_report.pdf) and [video summary](https://www.youtube.com/watch?v=RBP8vdAWTgk) for more details.
1314

14-
**QUICKSTART** : `python scripts/sampling/simple_video_sample_4d.py --input_path assets/test_video1.mp4 --output_folder outputs/sv4d` (after downloading [sv4d.safetensors](https://huggingface.co/stabilityai/sv4d) and [sv3d_u.safetensors](https://huggingface.co/stabilityai/sv3d) from HuggingFace into `checkpoints/`)
15+
**QUICKSTART** : `python scripts/sampling/simple_video_sample_4d.py --input_path assets/sv4d_videos/test_video1.mp4 --output_folder outputs/sv4d` (after downloading [sv4d.safetensors](https://huggingface.co/stabilityai/sv4d) and [sv3d_u.safetensors](https://huggingface.co/stabilityai/sv3d) from HuggingFace into `checkpoints/`)
1516

1617
To run **SV4D** on a single input video of 21 frames:
1718
- Download SV3D models (`sv3d_u.safetensors` and `sv3d_p.safetensors`) from [here](https://huggingface.co/stabilityai/sv3d) and SV4D model (`sv4d.safetensors`) from [here](https://huggingface.co/stabilityai/sv4d) to `checkpoints/`
1819
- Run `python scripts/sampling/simple_video_sample_4d.py --input_path <path/to/video>`
1920
- `input_path` : The input video `<path/to/video>` can be
20-
- a single video file in `gif` or `mp4` format, such as `assets/test_video1.mp4`, or
21+
- a single video file in `gif` or `mp4` format, such as `assets/sv4d_videos/test_video1.mp4`, or
2122
- a folder containing images of video frames in `.jpg`, `.jpeg`, or `.png` format, or
2223
- a file name pattern matching images of video frames.
2324
- `num_steps` : default is 20, can increase to 50 for better quality but longer sampling time.
2425
- `sv3d_version` : To specify the SV3D model to generate reference multi-views, set `--sv3d_version=sv3d_u` for SV3D_u or `--sv3d_version=sv3d_p` for SV3D_p.
25-
- `elevations_deg` : To generate novel-view videos at a specified elevation (default elevation is 10) using SV3D_p (default is SV3D_u), run `python scripts/sampling/simple_video_sample_4d.py --input_path test_video1.mp4 --sv3d_version sv3d_p --elevations_deg 30.0`
26-
- **Background removal** : For input videos with plain background, (optionally) use [rembg](https://github.com/danielgatis/rembg) to remove background and crop video frames by setting `--remove_bg=True`. To obtain higher quality outputs on real-world input videos with noisy background, try segmenting the foreground object using [Cliipdrop](https://clipdrop.co/) before running SV4D.
27-
- **Low VRAM environment** : To run on GPUs with low VRAM, try setting `--decoding_t=1` (of frames decoded at a time) or lower video resolution like `--img_size=512`.
26+
- `elevations_deg` : To generate novel-view videos at a specified elevation (default elevation is 10) using SV3D_p (default is SV3D_u), run `python scripts/sampling/simple_video_sample_4d.py --input_path assets/sv4d_videos/test_video1.mp4 --sv3d_version sv3d_p --elevations_deg 30.0`
27+
- **Background removal** : For input videos with plain background, (optionally) use [rembg](https://github.com/danielgatis/rembg) to remove background and crop video frames by setting `--remove_bg=True`. To obtain higher quality outputs on real-world input videos with noisy background, try segmenting the foreground object using [Clipdrop](https://clipdrop.co/) or [SAM2](https://github.com/facebookresearch/segment-anything-2) before running SV4D.
28+
- **Low VRAM environment** : To run on GPUs with low VRAM, try setting `--encoding_t=1` (of frames encoded at a time) and `--decoding_t=1` (of frames decoded at a time) or lower video resolution like `--img_size=512`.
2829

2930
![tile](assets/sv4d.gif)
3031

assets/sv4d_videos/bunnyman.mp4

47.1 KB
Binary file not shown.

assets/sv4d_videos/dolphin.mp4

33.9 KB
Binary file not shown.

assets/sv4d_videos/green_robot.mp4

50.3 KB
Binary file not shown.

assets/sv4d_videos/guppie_v0.mp4

72.3 KB
Binary file not shown.
File renamed without changes.

assets/sv4d_videos/human5.mp4

133 KB
Binary file not shown.

assets/sv4d_videos/human7.mp4

123 KB
Binary file not shown.

assets/sv4d_videos/lucia_v000.mp4

74.1 KB
Binary file not shown.

assets/sv4d_videos/monkey.mp4

33.4 KB
Binary file not shown.

assets/sv4d_videos/pistol_v0.mp4

36.2 KB
Binary file not shown.

assets/sv4d_videos/snowboard_v000.mp4

123 KB
Binary file not shown.

assets/sv4d_videos/stroller_v000.mp4

130 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.

assets/sv4d_videos/train_v0.mp4

37.9 KB
Binary file not shown.

assets/sv4d_videos/wave_hello.mp4

143 KB
Binary file not shown.

0 commit comments

Comments
 (0)