AI - Deep Motion Magnification

Software tutorials of interest.
Post Reply
Message
Author
jstenner
Site Admin
Posts: 73
Joined: Wed Jan 27, 2010 7:33 pm

AI - Deep Motion Magnification

#1 Post by jstenner »

Mark-C found a project called Video Motion Magnification here.

If you have "gh" installed you can just do:

Code: Select all

gh repo clone 12dmodel/deep_motion_mag
Otherwise, git clone:

Code: Select all

git clone https://github.com/12dmodel/deep_motion_mag.git
cd deep_motion_mag
If you're working on HiPerGator you can load the Anaconda module with:

Code: Select all

module load conda
I also had a local version, so I created a PyCharm project, but you can also just use nano to view/edit files if your only working on HiPerGator. Looking at the Requirements.txt I installed the following modules with Anaconda since I was working on HiPerGator:

Code: Select all

conda create --name deepmotion python=3.7.11
conda activate deepmotion
conda install opencv
conda install -c conda-forge configobj
conda install scipy
conda install setproctitle
conda install tqdm
conda install tensorflow==1.14.0
A couple of changes to get the whole workflow going. I created a simple python program to extract frames from video. I called it vid2frames.py:

Code: Select all

import cv2
import argparse
from tqdm import tqdm

parser = argparse.ArgumentParser()
parser.add_argument("filename", help="enter a movie filename here")
args = parser.parse_args()
print("Extracting frames from:", args.filename)

vidcap = cv2.VideoCapture(args.filename)
frames = int(vidcap.get(cv2.CAP_PROP_FRAME_COUNT))
success, image = vidcap.read()
count = 0
pbar = tqdm(total=frames)
while success:
    cv2.imwrite("%06d.png" % count, image)  # save frame as PNG file
    success, image = vidcap.read()
    count += 1
    pbar.update(1)

pbar.close()
I placed this file in the data/vids folder and use it to create the frames,
Once the frames are created, I "mv" them into a working subdirectory.

I could never get ffmpeg to work properly on my Mac, but it may work on HiPerGator. You'll need to change magnet.py to specify "ffmpeg" as your movie program on line 23.
The master of disaster!

Post Reply