This system combines advances in instance segmentation (Detectron2) with recent advances in object removal (Flow-edge Guided Video Completion) by Gao et al. 2020.
It allows automatic removal of all objects included in the MS COCO dataset that the Detectron2 model was trained on. This can be further extended by using any other object detection framework or other pretrained models.
The benefit of this setup is to take the manual work out of the masking process. Where before each frame had to be meticulously masked, now Detectron2 does most of this work. If necessary, masks can always be manually edited before the object removal step.
Note that this is still WIP. Most likely in some frames player is still visible because the mask does not cover him entirely. I've added some
padding to the mask to get better coverage but results seemed only slightly better.
This process takes a few steps for installing each of the recommended libraries. It uses two conda environments
because pytorch 0.4.0
and pytorch 1.6.0
are both required.
conda
python 3.6
onlinux
is recommended.cuda 9.0
is required for DeepFill compilationgcc & g++ >= 5
are required for Detectron compilation
Clone this repo and the required submodules:
git clone --recursive git@github.com:bjoernpl/AutoObjectRemoval.git
Install everything here in a conda env named FGVC
.
conda create -n FGVC python=3.6
conda activate FGVC
pip install -r ./DFVI/requirements.txt
bash ./DFVI/install_scripts.sh
conda deactivate
For more info on the installation and issues see the DFVI repo.
Install everything here in a conda env named raft
.
conda create --name raft python=3.6
conda activate raft
conda install pytorch=1.6.0 torchvision=0.7.0 cudatoolkit=10.1 -c pytorch
conda install matplotlib
conda install tensorboard
conda install scipy
conda install opencv
./RAFT/download_models.sh
For more info on this see the RAFT repo.
First you will need to create another env for the project requirements. I chose to use the already created
and activated env raft
but this can also be a separate env.
First install requirements with:
pip install -r ./requirements.txt
Next install Detectron2 by following their install guide or running:
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
You can now run the demo notebook by running jupyter lab
or jupyter notebook
or using the IDE of your choice.
Right now this can only be run by using the demo notebook but once I get the performance where I want it to be, I'll make a script to run it directly from the command line or even as a library.
Thanks to the creators of these projects and all contributors.
@inproceedings{Gao-ECCV-FGVC,
author = {Gao, Chen and Saraf, Ayush and Huang, Jia-Bin and Kopf, Johannes},
title = {Flow-edge Guided Video Completion},
booktitle = {European Conference on Computer Vision},
year = {2020}
}
@InProceedings{Xu_2019_CVPR,
author = {Xu, Rui and Li, Xiaoxiao and Zhou, Bolei and Loy, Chen Change},
title = {Deep Flow-Guided Video Inpainting},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}
@misc{teed2020raft,
title={RAFT: Recurrent All-Pairs Field Transforms for Optical Flow},
author={Zachary Teed and Jia Deng},
year={2020},
eprint={2003.12039},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@misc{wu2019detectron2,
author = {Yuxin Wu and Alexander Kirillov and Francisco Massa and
Wan-Yen Lo and Ross Girshick},
title = {Detectron2},
howpublished = {\url{https://github.com/facebookresearch/detectron2}},
year = {2019}
}