vt-vl-lab / FGVC

[ECCV 2020] Flow-edge Guided Video Completion
Other
1.55k stars 263 forks source link

"Please switch to Pytorch 0.4.0" even though torch 0.4.0 is installed & activated #5

Closed vmdumptrash closed 3 years ago

vmdumptrash commented 3 years ago

Issue: Program still asks me to switch to Pytorch 0.4.0 after I've switched to FGVC environment for the 2nd execution which has torch 0.4.0 installed

I've setup the environments as asked by the referenced githubs. Then I've tried the object removal example from the quickstart:

python video_completion.py \
       --mode object_removal \
       --path ../data/tennis \
       --path_mask ../data/tennis_mask \
       --outroot ../result/tennis_removal \
       --seamless

which also worked almost flawlessly in the raft environment. It created the result folder while also filling the subfolders with segmented images that look right (for example: image ).

After changing the environment to FGVC & executing it again it still asks me to switch to pytorch 0.4.0 (-> change environment to FGVC) after executing it.

conda list torch indicates I've indeed installed the correct torch version being 0.4.0:

"conda list torch" produces:

(FGVC) D:\Weltherrschaft\AI\FGVC\FGVC-master\tool>conda list torch
# packages in environment at D:\Programme\Anaconda\Anaconda\envs\FGVC:
#
# Name                    Version                   Build  Channel
torch                     0.4.0                    pypi_0    pypi
torchvision               0.2.1                    pypi_0    pypi

I've also tried pytorch 0.4.1, same issue. Even though the github suggests Linux I've ran this on Windows 10. I'm assuming this cannot be the root of the issue because everything else seemingly worked well.

Image of relevant CMD output: image

PS: For every German: Don't mind the "Weltherrschaft" ;-)

(Edit) Solution: zxyjfj's answer provides a step by step guide which, considering the reactions, seems to fix the issue for everyone. I fixed it myself by locating the print in the source code & removing the try/catch around it so it would direct me to where the code fails. Turns out it didn't have anything to do with the pytorch version. They tried to import something that didn't exist in the directory & was no package and it wasn't even needed. At another point they used an absolute path which obviously won't work unless your directories are called exactly like theirs.

vienduong88 commented 3 years ago

I have the exact same issue.

1369sbo commented 3 years ago

Using Linux is not a suggestion it's a pre-requisite, very different.

ManuelHouben commented 3 years ago

Ran into the same problem on Ubuntu 20.04 - Next try is going to be a full CentOS install.

zxyjfj commented 3 years ago

The way to run this code.

  1. First, you need to make a copy of video_completion.py under the '/tool' folder and rename it to xxx.py.

  2. Then, run video_completion.py with raft environment.

  3. open the xxx.py, cut the line 502 and 503, then paste them at line 27. image

  4. change the pretrained_model='/home/chengao/Weight/imagenet_deepfill.pth' on line 503 to pretrained_model='../weight/imagenet_deepfill.pth'

  5. run xxx.py with 'FGVC' environment. You will get those image. image

00000

You need to use cudatoolkit=9.0 cudnn=7.1.2 in the FGVC environment.

ManuelHouben commented 3 years ago

I set up a new machine with CentOS 7.4.1708 and got the raft environment working again as expected, however the fgvc environment is still giving me problems, even if I try @zxyjfj 's solution. I get the following error message:

Traceback (most recent call last):
  File "xxx.py", line 25, in <module>
    from frame_inpaint import DeepFillv1
  File "/home/username/Documents/chengao/tool/frame_inpaint.py", line 7, in <module>
    from models import DeepFill
  File "/home/username/Documents/chengao/models/__init__.py", line 1, in <module>
    from .FlowNet2_Models.FlowNet2 import *
ModuleNotFoundError: No module named 'models.FlowNet2_Models'

When trying to set up the fgvc environment I also run into this error for which I simply can't figure out a solution:

(fgvc1) [username@localhost Deep-Flow-Guided-Video-Inpainting-1.1]$ bash install_scripts.sh
running develop
running egg_info
creating resample2d_cuda.egg-info
writing resample2d_cuda.egg-info/PKG-INFO
writing dependency_links to resample2d_cuda.egg-info/dependency_links.txt
writing top-level names to resample2d_cuda.egg-info/top_level.txt
writing manifest file 'resample2d_cuda.egg-info/SOURCES.txt'
reading manifest file 'resample2d_cuda.egg-info/SOURCES.txt'
writing manifest file 'resample2d_cuda.egg-info/SOURCES.txt'
running build_ext
building 'resample2d_cuda' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/username/anaconda3/envs/fgvc1/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/TH -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/username/anaconda3/envs/fgvc1/include/python3.6m -c resample2d_cuda.cc -o build/temp.linux-x86_64-3.6/resample2d_cuda.o -std=c++11 -DTORCH_EXTENSION_NAME=resample2d_cuda
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/TH -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/username/anaconda3/envs/fgvc1/include/python3.6m -c resample2d_kernel.cu -o build/temp.linux-x86_64-3.6/resample2d_kernel.o -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -DTORCH_EXTENSION_NAME=resample2d_cuda --compiler-options '-fPIC' -std=c++11
resample2d_kernel.cu:3:35: fatal error: ATen/cuda/CUDAContext.h: No such file or directory
compilation terminated.
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1
running develop
running egg_info
creating correlation_cuda.egg-info
writing correlation_cuda.egg-info/PKG-INFO
writing dependency_links to correlation_cuda.egg-info/dependency_links.txt
writing top-level names to correlation_cuda.egg-info/top_level.txt
writing manifest file 'correlation_cuda.egg-info/SOURCES.txt'
reading manifest file 'correlation_cuda.egg-info/SOURCES.txt'
writing manifest file 'correlation_cuda.egg-info/SOURCES.txt'
running build_ext
building 'correlation_cuda' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/username/anaconda3/envs/fgvc1/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/TH -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/username/anaconda3/envs/fgvc1/include/python3.6m -c correlation_cuda.cc -o build/temp.linux-x86_64-3.6/correlation_cuda.o -std=c++11 -DTORCH_EXTENSION_NAME=correlation_cuda
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
correlation_cuda.cc:4:35: fatal error: ATen/cuda/CUDAContext.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
running develop
running egg_info
creating channelnorm_cuda.egg-info
writing channelnorm_cuda.egg-info/PKG-INFO
writing dependency_links to channelnorm_cuda.egg-info/dependency_links.txt
writing top-level names to channelnorm_cuda.egg-info/top_level.txt
writing manifest file 'channelnorm_cuda.egg-info/SOURCES.txt'
reading manifest file 'channelnorm_cuda.egg-info/SOURCES.txt'
writing manifest file 'channelnorm_cuda.egg-info/SOURCES.txt'
running build_ext
building 'channelnorm_cuda' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/username/anaconda3/envs/fgvc1/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/TH -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/username/anaconda3/envs/fgvc1/include/python3.6m -c channelnorm_cuda.cc -o build/temp.linux-x86_64-3.6/channelnorm_cuda.o -std=c++11 -DTORCH_EXTENSION_NAME=channelnorm_cuda
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/TH -I/home/username/anaconda3/envs/fgvc1/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/username/anaconda3/envs/fgvc1/include/python3.6m -c channelnorm_kernel.cu -o build/temp.linux-x86_64-3.6/channelnorm_kernel.o -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -DTORCH_EXTENSION_NAME=channelnorm_cuda --compiler-options '-fPIC' -std=c++11
channelnorm_kernel.cu:3:35: fatal error: ATen/cuda/CUDAContext.h: No such file or directory
compilation terminated.
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

Thank you all in advance for taking the time to help strangers on the internet!

jf-garamendi commented 3 years ago

In addition, to fix the error

ModuleNotFoundError: No module named 'models.FlowNet2_Models'

that ManuelHouben mentoined, I went to Deep-Flow-Guided-Video-Inpainting github

https://github.com/nbei/Deep-Flow-Guided-Video-Inpainting

Installed the needed requirements and run

bash install_scripts.sh

This generates some files in folder _./Deep-Flow-Guided-Video-Inpainting/models/FlowNet2Models/ that should be copied into folder ./FGVC/models/

cp -r ./Deep-Flow-Guided-Video-Inpainting/models/FlowNet2_Models/ ./FGVC/models/

gaochen315 commented 3 years ago

Hi all, sorry for the inconvenience.

Please check the latest code. There is only one environment, i.e., Pytorch 1.6.0, CUDA 10.1. Let me know if you have any questions.