Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiteFlowNet with cupy instead of FlowNet2 with compiled modules #63

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

lukas-blecher
Copy link

I've replaced all the FlowNet2 files with corresponding LiteFlowNet implementations from the pytorch reimplementation. This implementation doesn't need the flownet2 modules but is based on CuPy. In return the compiling of the flownet2 modules is no longer a problem. Also LiteFlowNet is 30 times smaller in the model size and 1.36 times faster in the running speed and outperforms the FlowNet2 on the challenging Sintel final pass and KITTI benchmarks [1].

Quick note: I didn't mean to request merging into the master branch. I just wanted to let you know that when compiling the flownet2 modules fails there is another option. Maybe you can make a new LiteFlowNet branch or reference my fork in the FAQ's answer.

Here is the flamingo demo generated using the LiteFlowNet:
flamingo

lukas-blecher and others added 9 commits January 17, 2020 18:27
Also replace mmcv progress bar with tqdm
no need to compile anything anymore
take changes from v1.1
replace flownet2 with liteflownet
reference original liteflow repository
@nbei
Copy link
Owner

nbei commented Apr 9, 2020

Very thanks for you contribution and sorry for my late reply. I will consider to make a new branch for your request.

Thanks again for your interest in our project.

@JamesPerlman
Copy link

Thank you so much for this contribution!

@Tobi823
Copy link

Tobi823 commented Jul 8, 2022

For anyone who comes across this thread in the future - here's how I was able to get the software to work (Manjaro Arch Linux 5.18 + CUDA 1.17 + Nvidia + without Anaconda). It's likely that you have to tweak some dependencies:

git clone https://github.com/lukas-blecher/Deep-Flow-Guided-Video-Inpainting && cd Deep-Flow-Guided-Video-Inpainting
python -m venv venv      # it is Python 3.9
source venv/bin/activate
pip install -r new_requirements.txt

new_requirements.txt
result_pip_freeze.txt

Download models and demos from + place them in the correct folder (e.g. models/pretrained_models - see original instruction)

Replace @cupy.util.memoize(for_each_device=True) with @cupy.memoize(for_each_device=True) in models/LiteFlowNet_Models/correlation/correlation.py

Slighty different call (because of network-default.pytorch and --LiteFlowNet)

CUDA_VISIBLE_DEVICES=0 python tools/video_inpaint.py \
--frame_dir ./demo/lady-running/frames \
--MASK_ROOT ./demo/lady-running/mask_bbox.png \
--img_size 448 896 \
--DFC \
--LiteFlowNet \
--pretrained_model_liteflownet ./pretrained_models/network-default.pytorch \
--Propagation \
--PRETRAINED_MODEL_1 ./pretrained_models/resnet50_stage1.pth \
--PRETRAINED_MODEL_2 ./pretrained_models/DAVIS_model/davis_stage2.pth \
--PRETRAINED_MODEL_3 ./pretrained_models/DAVIS_model/davis_stage3.pth \
--MS --th_warp 3 --FIX_MASK 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants