I run the live.py for detection on webcamera, I have assign True for "--cuda", and the model was inferenced on GPU because I have notice the GPU mempry usage when run live.py.
Why did I get such a low FPS on GPU?
[INFO] starting threaded video stream...
[INFO] elasped time: 48.21
[INFO] approx. FPS: 1.14
because the python code live.py does not implement the cuda version by default , have you change the code?
because the python code live.py does not implement the cuda version by default , have you change the code?
Thanks for your reply, I also found live.py doesn't implement on GPU by default,I will try to change the code to run on GPU.
I have implement the live.py on GPU, however the FPS only reached 18FPS on a single 1080GPU, it is much slower than the 45FPS which mentioned by the author.
Why did this happen? Does anyone have some ideas? @liyupeng-ing
[INFO] elasped time: 31.67
[INFO] approx. FPS: 18.76
@kebijuelun
Setting the default value of cuda arg to True will not change anything as the live.py code doesn't seem to be using it.
What I did was:
if args.cuda:
x = x.cuda()
if torch.cuda.is_available():
if args.cuda:
torch.set_default_tensor_type('torch.cuda.FloatTensor')
if not args.cuda:
print("WARNING: It looks like you have a CUDA device, but aren't using \
CUDA. Run with --cuda for optimal eval speed.")
torch.set_default_tensor_type('torch.FloatTensor')
else:
torch.set_default_tensor_type('torch.FloatTensor')
@raviv it works
@raviv good person, you will happiness forever,ThankYou all
Most helpful comment
@kebijuelun
Setting the default value of cuda arg to True will not change anything as the live.py code doesn't seem to be using it.
What I did was:
if args.cuda: x = x.cuda()https://github.com/amdegroot/ssd.pytorch/blob/master/demo/live.py#L76
if torch.cuda.is_available(): if args.cuda: torch.set_default_tensor_type('torch.cuda.FloatTensor') if not args.cuda: print("WARNING: It looks like you have a CUDA device, but aren't using \ CUDA. Run with --cuda for optimal eval speed.") torch.set_default_tensor_type('torch.FloatTensor') else: torch.set_default_tensor_type('torch.FloatTensor')