Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot run run_ssd_example.py on cuda #147

Closed
ynjiun opened this issue Jan 3, 2021 · 2 comments · May be fixed by #148
Closed

cannot run run_ssd_example.py on cuda #147

ynjiun opened this issue Jan 3, 2021 · 2 comments · May be fixed by #148

Comments

@ynjiun
Copy link

ynjiun commented Jan 3, 2021

Hi
when I run run_ssd_example.py using GPU and got following error:

Traceback (most recent call last):
  File "run_ssd_example.py", line 56, in <module>
    boxes, labels, probs = predictor.predict(image, 10, 0.4)
  File "/home/paul/pytorch/PytorchProject/ssd/vision/ssd/predictor.py", line 37, in predict
    scores, boxes = self.net.forward(images)
  File "/home/paul/pytorch/PytorchProject/ssd/vision/ssd/ssd.py", line 93, in forward
    locations, self.priors, self.config.center_variance, self.config.size_variance
  File "/home/paul/pytorch/PytorchProject/ssd/vision/utils/box_utils.py", line 104, in convert_locations_to_boxes
    locations[..., :2] * center_variance * priors[..., 2:] + priors[..., :2],
RuntimeError: expected device cpu but got device cuda:0

It seems that box_utils.py cannot run on cuda device. Is there a quick fix for this such that I can run it on cuda device? Thank you very much for your help.

@tensorturtle
Copy link

@ynjiun
I made a pull request that fixes this issue.
It was a bug that is common to run_ssd_example.py and live examples as well.

@ynjiun
Copy link
Author

ynjiun commented Jan 29, 2021

@neuroquantifier cool. I incorporated your changes and it works! Thank you so much for your help.

@ynjiun ynjiun closed this as completed Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants