SaiKiran Tedla, Kelly Zhu, Trevor Canham, Felix Taubner, Michael Brown, Kiriakos Kutulakos, David Lindell
University of Toronto & York University
🤗 Demo
If you use our dataset, code, or model, please cite:
@article{Tedla2025Blur2Vid,
title = {Generating the Past, Present, and Future from a Motion-Blurred Image},
author = {Tedla, SaiKiran and Zhu, Kelly and Canham, Trevor and Taubner, Felix and Brown, Michael and Kutulakos, Kiriakos and Lindell, David},
journal = {ACM Transactions on Graphics},
year = {2025},
note = {SIGGRAPH Asia.}
}This guide explains how to train and evaluate our video diffusion model for video from a single motion-blurred image.
conda env create -f setup/environment.yml
conda activate blur2vid- Install PyTorch and all dependencies listed in the YAML file.
Running the model on images is as simple as:
conda activate blur2vid
python inference.py --image_path assets/dummy_image.png --output_path output/We also provide an interactive Gradio demo:
python gradio/app.pyWe provide our processed GOPRO dataset and comparison outputs here (for example GOPRO_7/ for the processed inputs and GOPROResultsImages/ for evaluation outputs). You can then compute metrics using:
python extra/moMets-parallel-gopro.pypython extra/moMets-parallel-baist.py
To test on these datasets, please use configs/gopro_test.yaml, configs/gopro_2x_test.yaml, or configs/baist_test.yaml, depending on the experiment you are interested in.
Set the following paths in your YAML config (feel free to change others paths to match your configuration):
- Set the basedir in the corresponding yaml file in
training/configs/to the path of the repository. This will be the directory that contains the README.md. - Download checkpoints with
python setup/download_checkpoints.py baistorpython setup/download_checkpoints.py gopro, respectively. The checkpoint directory should appear in thetrainingdirectory. - Prepare GOPRO7
blur/andsharp/folders with:
conda activate blur2vid
# GOPRO example (source has train/test splits)
python extra/build_gopro_dataset.py \
--src-root /path/to/GOPRO \
--save-root /path/to/GOPRO_7 \
--splits train test
After generation, point your GOPRO config to the processed dataset root (for example datasets/GOPRO_7).
Expected output structure:
<save-root>/
├── train/
│ ├── blur/
│ │ └── <sequence_name>/
│ │ └── *.png
│ └── sharp/
│ └── <sequence_name>/
│ └── *.png
└── test/
├── blur/
│ └── <sequence_name>/
│ └── *.png
└── sharp/
└── <sequence_name>/
└── *.png
Example frame path after generation:
/home/tedlasai/genCamera/GOPRO_7/train/blur/GOPR0372_07_00/000326.png
cd training
conda activate blur2vid
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export CUDA_VISIBLE_DEVICES=0,1,2,3 #4 GPUS
accelerate launch --config_file accelerator_configs/accelerator_val_config.yaml --multi_gpu \
train_controlnet.py \
--config "SPECIFIED CONFIG FILE"- To build the gopro test format for metrics computation. We have to downsample the GT to allow comparison with a few of the baselines.
python3 build_gopro_test.py \
--gopro7_path /path/to/GOPRO_7
--split test
--output_root /path/to/GT/out
python extra/downsample_results.py \
--src /path/to/GT/out
--dst /path/to/GT_down/out
To train our model.
- You can run
python setup/download_cogvideo_weights.py, you should have a folder namedCogVideoX-2bat the project root containing the Cogvideox model weights. This gives you the initial weights. - Setup dataset structure as mentioned below. We sourced our data from 5 highspeed video datasets.
cd training
conda activate blur2vid
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export CUDA_VISIBLE_DEVICES=0,1,2,3 #4 GPUS
accelerate launch --config_file accelerator_configs/accelerator_val_config.yaml --multi_gpu \
train_controlnet.py \
--config "configs/full_train.yaml"Each dataset is organized in a consistent folder structure under datasets/FullDataset/.
datasets/FullDataset/
└── {DatasetName}/
├── lower_fps_frames/
│ └── {SceneName}/
│ └── *.png
├── train.txt
└── test.txt
For the Adobe240 dataset:
datasets/FullDataset/Adobe240/
├── lower_fps_frames/
│ ├── GOPR9633/
│ │ └── frame_0001.png, frame_0002.png, ...
│ ├── GOPR9634/
│ └── ...
├── train.txt
└── test.txt
- lower_fps_frames/: Contains video sequences organized by scene, with each scene stored as a sequence of PNG frames
- train.txt: List of training sequences
- test.txt: List of test sequences
- Checkpoints are available on the project page.
- We utilize
extra/moMets-parallel-gopro.pyandextra/moMets-parallel-baist.pyto compute all metrics for this project. -- We evaluate at 640x320 resolution for GOPRO (our model outputs at 1280x720, but we downsample to allow comaprison with baselines (seeextra/downsample_results.py)). For BAIST, we resize to 160x192 after applying crop boxes provided by BAIST. -- The evaluation scripts utilize a slightly different format
For questions or issues, please reach out through the project page or contact Sai Tedla.
Hugginface version I used to borrow pipeline - https://github.com/huggingface/diffusers/tree/92933ec36a13989981a6fc4189857e8b4dc2c38d
CogvideoX Controlnet Extention - https://github.com/user-attachments/assets/d3cd3cc4-de95-453f-bbf7-ccbe1711fc3c
Original code and models CogVideoX.