erikalu / omnimatte
- суббота, 4 сентября 2021 г. в 00:36:25
This repository contains a re-implementation of the code for the CVPR 2021 paper "Omnimatte: Associating Objects and Their Effects in Video."
This code has been tested with PyTorch 1.8 and Python 3.8.
pip install -r requirements.txt
.conda env create -f environment.yml
.To train a model on a video (e.g. "tennis"), run:
python train.py --name tennis --dataroot ./datasets/tennis --gpu_ids 0,1
To view training results and loss plots, visit the URL http://localhost:8097.
Intermediate results are also at ./checkpoints/tennis/web/index.html
.
To save the omnimatte layer outputs of the trained model, run:
python test.py --name tennis --dataroot ./datasets/tennis --gpu_ids 0
The results (RGBA layers, videos) will be saved to ./results/tennis/test_latest/
.
To train on your own video, you will have to preprocess the data:
mkdir ./datasets/my_video && cd ./datasets/my_video
mkdir rgb && ffmpeg -i video.mp4 rgb/%04d.png
my_video/rgb
.my_video/mask/01/
, my_video/mask/02/
, etc.my_video/flow
and backward flow to my_video/flow_backward
python datasets/confidence.py --dataroot ./datasets/tennis
my_video/homographies.txt
.
See here for details.Note: Videos that are suitable for our method have the following attributes:
If you use this code for your research, please cite the following paper:
@inproceedings{lu2021,
title={Omnimatte: Associating Objects and Their Effects in Video},
author={Lu, Erika and Cole, Forrester and Dekel, Tali and Zisserman, Andrew and Freeman, William T and Rubinstein, Michael},
booktitle={CVPR},
year={2021}
}
This code is based on retiming and pytorch-CycleGAN-and-pix2pix.