Giter Site home page Giter Site logo

aliushn / motion-magnification Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cgst/motion-magnification

0.0 2.0 0.0 31.53 MB

This repository implements T. Oh, R. Jaroensri, C. Kim, M. Elgharib, F. Durand, W. Freeman, W. Matusik "Learning-based Video Motion Magnification" arXiv preprint arXiv:1804.02684 (2018) in PyTorch.

Home Page: https://twitter.com/cgst/status/1210691577078636544

Python 3.00% Jupyter Notebook 97.00%

motion-magnification's Introduction

Video Motion Magnification

This repository implements T. Oh, R. Jaroensri, C. Kim, M. Elgharib, F. Durand, W. Freeman, W. Matusik "Learning-based Video Motion Magnification" arXiv preprint arXiv:1804.02684 (2018) in PyTorch.

Please visit the homepage of the research publication above to see the authors' excellent paper, high-quality TensorFlow code, and a ready-to-use training dataset. The authors did an amazing job, which made it easy for me to create this PyTorch implementation. ๐Ÿ™๐Ÿฝ

"Motion magnification" means you pick up and amplify small motions so they're easier to see. It's like a microscope for motion.

Samples

๐Ÿ‘‰ Click here to see sample videos from this implementation ๐Ÿ‘ˆ

You can download the videos here.

Set up

This implementation requires Python 3 and PyTorch. Install dependencies with pip:

pip install -r requirements.txt

Run (examples)

# Get CLI help.
python main.py -h

# Amplify video 5x.
python main.py amplify data/models/20191204-b4-r0.1-lr0.0001-05.pt data/examples/baby.mp4 --amplification=5

# Amplify 7x and render side-by-side comparison video.
python main.py demo data/models/20191204-b4-r0.1-lr0.0001-05.pt data/examples/baby.mp4 baby-demo.mp4 7

# Make video collage with input, 2x and 4x amplified side by side.
python main.py demo data/models/20191204-b4-r0.1-lr0.0001-05.pt data/examples/baby.mp4 baby-demo.mp4 2 4

Training

I've included a pre-trained model so you can try it out of the box, but you can also train from scratch if you wish.

First, download and extract the training dataset published by the authors. It's ~84GB in total compressed, and slighlty larger deflated. Make sure you have enough disk space.

Example train commands:

# Get CLI help and adjust training parameters with flags.
python main.py train -h

# Train from scratch - this will save a model on disk after each epoch.
python main.py train data/train data/models --num-epochs=10

# Resume training from previously saved snapshot and skip 3 epochs.
python main.py train data/train data/models --num-epochs=10 --skip-epochs=3 --load-model-path=data/models/20191203-b10-r0.1-lr0.0001-02.pt

This implementation takes ~2 days to arrive at a decent loss on a Tesla P100 GPU. Let me know if you speed it up.

motion-magnification's People

Contributors

cgst avatar

Watchers

James Cloos avatar  avatar

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.