poppinace / indexnet_matting

(ICCV'19) Indices Matter: Learning to Index for Deep Image Matting
Other
389 stars 90 forks source link

How to solve this error? When I run this net to predict an image,I have GPU,But I want not to use it. #20

Closed CachCheng closed 4 years ago

CachCheng commented 4 years ago

RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu Traceback: File "/data/User/ch/CNN/view/image_app.py", line 80, in matting_view alpha = matting.predict(image, trimap) File "/root/anaconda3/lib/python3.7/site-packages/graphics/function/Matting.py", line 81, in predict outputs = self.net(inputs).squeeze().cpu().data.numpy() File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 146, in forward "them on device: {}".format(self.src_device_obj, t.device))

poppinace commented 4 years ago

Inferrence on the CPU is slow. You need to transfer the weight to CPU. I should have commented a line of code where model is loaded. Please double check.

CachCheng commented 4 years ago

OK,I have solved this error, Thank you!,I will close it!