Giter VIP home page Giter VIP logo

animation-from-blur's Introduction

Animation-from-Blur

by Zhihang Zhong, Xiao Sun, Zhirong Wu, Yinqiang Zheng, Stephen Lin, and Imari Sato

๐Ÿ‘‰ Project website, Video demo

Please leave a โญ if you like this project!

News

Please check our new work in CVPR 2023, BiT (Blur Interpolation Transformer), a fast and powerful transformer-based technique for arbitrary factor blur interpolation with state-of-the-art performance.

TL;DR:

Existing solutions for recovering sharp motion from a single motion-blurred image do not consider the directional ambiguity for each region. We explicitly account for such directional ambiguity by introducing a motion guidance representation, which allows us to generate multiple plausible solutions.

The motion guidance representation is a compact quantization of 2D optical flow with only four discrete motion directions. We propose a unified framework for blur decomposition, which supports various interfaces for generating motion guidance, including sampling from a prediction network, estimation from neighboring frames, and annotation from users.

Preparation

Please download B-AIST++ dataset from this link and unzip it under ./dataset/ directory.

Please download checkpoints from this link and put them under ./checkpoints/ directory.

Installation:

conda create -n animation-from-blur python=3.8
conda activate animation-from-blur
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
pip install pyyaml tensorboardX scipy easydict scikit-image opencv-python matplotlib albumentations lpips tqdm torchmetrics==0.5.1

Train

Train blur decomposer:

python -m torch.distributed.launch --nproc_per_node=4 train_mbd.py --config ./configs/mbd_2s_residual.yaml --log_dir ./experiments/baistpp_mbd --verbose

[Optional] Train guidance predictor:

python -m torch.distributed.launch --nproc_per_node=2 train_vaegan.py --config ./configs/cvaegan_gumble_celoss_z4.yaml --log_dir ./experiments/baistpp_cvaegan_gumble_celoss_z4 --verbose

Evaluation

Multi-modal blur decomposition evaluation with guidance predictor:

CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.launch --nproc_per_node=1 valid_vaegan.py --predictor_resume_dir ./checkpoints/baistpp_cvaegan_gumble_celoss_z4/  --decomposer_resume_dir ./checkpoints/baistpp_mbd_2s_residual --data_dir ./dataset/b-aist++ -ns 1 --verbose

(P.S., we test ns=1, ns=3, or ns=5 in the paper.)

Blur decomposition evaluation using neighboring frames:

CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.launch --nproc_per_node=1 valid_video.py --resume_dir=./checkpoints/baistpp_mbd_2s_residual/ --data_dir ./dataset/b-aist++ --verbose

Limitations

The training process of guidance predictor is unstable due to complicated GAN structure as well as limited data. Besides, the use of synthetic data can lead to limited generalization capabilities. However, the core of our work is to provide an unprecedented solution to explicitly address the directional ambiguity in the blur decomposition task. We hope that the decoupling of directional uncertainty from blur into a motion guidance will inspire subsequent research.

Citation

If you find this repository useful, please consider citing:

@inproceedings{zhong2022animation,
  title={Animation from blur: Multi-modal blur decomposition with motion guidance},
  author={Zhong, Zhihang and Sun, Xiao and Wu, Zhirong and Zheng, Yinqiang and Lin, Stephen and Sato, Imari},
  booktitle={Computer Vision--ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23--27, 2022, Proceedings, Part XIX},
  pages={599--615},
  year={2022},
  organization={Springer}
}
@inproceedings{zhong2023blur,
  title={Blur Interpolation Transformer for Real-World Motion from Blur},
  author={Zhong, Zhihang and Cao, Mingdeng and Ji, Xiang and Zheng, Yinqiang and Sato, Imari},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={5713--5723},
  year={2023}
}

Acknowledgement

We thank the nice works mentioned below:

animation-from-blur's People

Contributors

zzh-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

animation-from-blur's Issues

Test result images on GOPRO dataset?

Hellow !!
Thanks for your great work and implementation!

Can you please provide the result images on GOPRO testset or test codes?

When experimenting with the pretrained model you provide (Multi-modal blur decomposition evaluation with guidance predictor), the result images on GOPRO dataset are differ from those in the paper.
However, I don't know why the result images are different from those reported in the paper.

  • I prepared each blurry image by averaging 7 consecutive sharp frames from the GOPRO test set.

  • Example of input image
    000001_000007

  • Result image I get (this is the first frame result image)
    000003 png

About the GenBlur dataset

Hello @zzh-tech ,
Thanks for sharing the codes. I want to retrain the model on the GoPro/GenBlur dataset. It seems that there should be three elements including blur, sharp, and trend+ in the dataset. But I don't know how the dataset is generated from the original GoPro dataset (especially the trend+ element). Could you please share the code for dataset preparation or provide the generated dataset GenBlur mentioned in the paper? Thanks a lot!

    Dataset class of videos, each video must be represented as a dir
    Structure under each video dir:
        blur: {:08d}.png (start from 00000000.png)
        sharp: {:08d}_{:03d}.png (start from 00000000_000.png)
        trend+: {:08d}_trend.npy (start from 00000000_trend.npy)

Testing with a custom video

I am trying to use your approach to remove the motion blur of a dance video, like in your examples, with a single person looking to the camera all the time, no background blur or movement, but im not sure how to do it.

I have placed the checkpoints, I have changed the dataset config to point to a single folder from my video, that i called it test, and i have placed the frames of my video with the correct names on "blur" folder. The rest of folders from the dataset I dont know how to generate them.

Can you give me some directions of how to do it please?

Basicly what i have done

  • Editted the config to point just my test folder
  • Place in dataset my video dataset, like
    dataset/test/blur -> my video frames
    dataset/test/sharp -> empty
    dataset/test/blur_anno -> empty
    dataset/test/trend+_avg -> empty
  • Place your checkpoints

What i want its giving my video, use the checkpoints to correct the blur of my video

Thank you in advance.

Problems encountered downloading B-AIST++ Dataset

Hello!!
Thanks for your great work and implementation!

When I was downloading B-AIST++ Dataset , there are always problems.
When I was halfway through the download, the browser showed a network error and the download failed.
I tried many times, but the download failed.
Do you have any other download connections?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.