owenzlz / DeepImageBlending

This is a Pytorch implementation of deep image blending

Home Page:https://arxiv.org/pdf/1910.11495.pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I execute it with only run.py file

samTheHacke opened this issue · comments

Can anyone explain why we are using twopass.py and utils.py? Can't we run this only with code of run.py
And I am getting error while executing run.py at line of Canvas_mask =numpy2tensor(canvas_mask,gpu_id)
Please help me bros
16213573728603563816958091638982

Basically you have installed torch without CUDA maybe because you do not have a GPU.
Either you reinstall torch with CUDA or you change the code to run in CPU.

Basically you have installed torch without CUDA maybe because you do not have a GPU.
Either you reinstall torch with CUDA or you change the code to run in CPU.

Thank you sooo much brother,can I known how to change code to run on cpu

You have to change the variable gpu_id in the code to 'cpu'.
Here an easy example so you can understand:

#To GPU with the device number 0
tensor = torch.randn(2, 2).to('cuda:0') 
# To CPU
tensor = torch.randn(2,2).to('cpu') 

You can read more:
https://pytorch.org/docs/master/generated/torch.Tensor.to.html

You have to change the variable gpu_id in the code to 'cpu'.
Here an easy example so you can understand:

#To GPU with the device number 0
tensor = torch.randn(2, 2).to('cuda:0') 
# To CPU
tensor = torch.randn(2,2).to('cpu') 

You can read more:
https://pytorch.org/docs/master/generated/torch.Tensor.to.html

IMG20210520225546_00.jpg

You have to change the variable gpu_id in the code to 'cpu'.
Here an easy example so you can understand:

#To GPU with the device number 0
tensor = torch.randn(2, 2).to('cuda:0') 
# To CPU
tensor = torch.randn(2,2).to('cpu') 

You can read more:
https://pytorch.org/docs/master/generated/torch.Tensor.to.html

Sir even after replacing from GPU to cpu I am getting errors sir

@samTheHacke The error says that could not found NVIDIA Driver which means that still the code is checking for GPU instead of CPU. Did you install the CPU version of Torch?
From https://pytorch.org/get-started/locally/

pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

@samTheHacke The error says that could not found NVIDIA Driver which means that still the code is checking for GPU instead of CPU. Did you install the CPU version of Torch?
From https://pytorch.org/get-started/locally/

pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

No I don't have cuda supported GPU,so I want code to execute to cpu ,but as you said I changed every gpu_id to cpu but I am getting soo many errors .
if I want to execute this project in cpu what things I have to change in this code.