Instructions to use ziyiwang/StableMotion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ziyiwang/StableMotion with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ziyiwang/StableMotion", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
StableMotion: Repurposing Diffusion-Based Image Priors for Motion Estimation
This is the official repo for paper StableMotion: Repurposing Diffusion-Based Image Priors for Motion Estimation
Official Code Repository: GitHub - ivowang/StableMotion
Setup
- Clone the code repo.
- Create your environment from
requirements.txt. - Download DIR-D and RS-Real. Put them into
StableMotion_SIRandStableMotion_RSCrespectively.
StableMotion for Stitched Image Rectangling (SIR)
Inference
- Download the checkpoints of StableMotion_SIR
- Run
cd StableMotion_SIR && sh sample.sh. You may want to change this file to modify the inference configurations. - Run
sh metrics.shto evaluate the results.
Training
- Replicate RecDiffusion to get pseudo labels, i.e., the flow labels generated by RecDiffusion on the training set of DIR-D. Put and rename it into
StableMotion_SIR/MDM_Flow. - Run
cd StableMotion_SIR && sh train.sh. You may want to change this file to modify the training configurations. The default configuration requires approximately 80 GB of VRAM per card.
StableMotion for Rolling Shutter Correction (RSC)
Inference
- Download the checkpoints of StableMotion_RSC
- Run
cd StableMotion_RSC && sh sample.sh. You may want to change this file to modify the inference configurations. - Run
sh metrics.shto evaluate the results.
Training
Run cd StableMotion_RSC && sh train.sh. You may want to change this file to modify the training configurations. The default configuration requires approximately 40 GB of VRAM per card.
GPT Rule-Based Evaluation
Each task folder has a gpt_eval subfolder with the script used in the paper to score results with a vision LLM (GPT) on a fixed rubric. StableMotion_SIR/gpt_eval/score_rectangle.py scores Stitched Image Rectangling (SIR) (input, output) pairs, and StableMotion_RSC/gpt_eval/score_rolling_shutter.py scores Rolling Shutter Correction (RSC) [input | Yang | Ours] triptychs. Both call an OpenAI-Responses-compatible API and emit per-pair scores plus an aggregate summary.json (mean/std/95% CI). To run, copy provider.example.json to provider.json in the relevant folder, add your endpoint/key, then e.g. cd StableMotion_SIR/gpt_eval && python score_rectangle.py <input_dir> <result_dir>. See each folder's README.md for the full rubric, flags, and outputs.
Citation
@article{wang2025stablemotion,
title={StableMotion: One-Step Motion Estimation with Diffusion Prior},
author={Wang, Ziyi and Li, Haipeng and Sui, Lin and Zhou, Tianhao and Jiang, Hai and Nie, Lang and Liu, Shuaicheng},
journal={arXiv preprint arXiv:2505.06668},
year={2025}
}
- Downloads last month
- -
Model tree for ziyiwang/StableMotion
Base model
stabilityai/stable-diffusion-2