pytorch-PCN icon indicating copy to clipboard operation
pytorch-PCN copied to clipboard

How to run the demo with GPU?

Open Edwardmark opened this issue 5 years ago • 6 comments

I try the demo, found that it uses CPU only, how can I use GPU with the model?

Edwardmark avatar Apr 25 '19 03:04 Edwardmark

For a pytorch model, you can set model and input to CUDA model. e.g.

model.cuda()
input.cuda()

Then it will run on GPU~

siriusdemon avatar Apr 25 '19 04:04 siriusdemon

Very good job @siriusdemon and thanks for sharing! Tried to push it to GPU but speed is almost same compared to CPU in my case, anybody more successful?

FloCF avatar Jul 18 '19 14:07 FloCF

Some operations like NMS is time-consuming. There are lots of for loop in the code. Analyse the bottleneck by profile and rewriting some code by Cython may help.

siriusdemon avatar Jul 19 '19 05:07 siriusdemon

It's not clear where

model.cuda()
input.cuda()

should be put to enable gpu processing. Would it maybe be possible for you to add that option directly in the api? That would be really great. Thanks in advance.

fmatulic avatar Sep 17 '19 12:09 fmatulic

Very good job @siriusdemon and thanks for sharing! Tried to push it to GPU but speed is almost same compared to CPU in my case, anybody more successful?

I also found that although the GPU works, but the consumption is very small, and the detection speed is not much different from that of the CPU.Do you have a solution later?Thanks!

hhxdestiny avatar Dec 11 '20 03:12 hhxdestiny

I tried to run on the GPU, but the speed dropped. What's going on? A total of several places have been changed. 1、models.py→load_model()→pcn1=PCN1.to(devices) pcn2.....ocn3.... 2、pcn.py→set_input()→return torch.FloatTensor(img).cuda()。 but speed goes down.How to run on GPU correctly?please

wuyue112 avatar Dec 17 '20 09:12 wuyue112