Skip to content

cannot run run_ssd_example.py on cuda #147

@ynjiun

Description

@ynjiun

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions