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

error : python inference.py #58

Open
STRUGGLE1999 opened this issue Mar 27, 2023 · 3 comments
Open

error : python inference.py #58

STRUGGLE1999 opened this issue Mar 27, 2023 · 3 comments

Comments

@STRUGGLE1999
Copy link

I want to visualize the results, but when I run python inference.py,it broke an error:

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument index in method wrapper__index_select)
image

@FengLi-ust
Copy link
Collaborator

It seems some tensors are put in CPU will some are in GPU. You can put all tensors on the GPU to fix this problem.

@akitten-cn
Copy link

Did you find the location of the problem, please?

@SumayyaInayat
Copy link

Hi,
This issue can be resolved by changing the following two lines:
output, _ = model(image[None],0)
output = postprocessors['bbox'](output, torch.Tensor([[1.0, 1.0]]))[0]
to --->
output, _ = model.cuda()(image[None].cuda(),0)
output = postprocessors['bbox'](output, torch.Tensor([[1.0, 1.0]]).cuda())[0]

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

No branches or pull requests

4 participants