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

CPU #15

Closed
luantunez opened this issue Mar 19, 2021 · 4 comments · Fixed by #17
Closed

CPU #15

luantunez opened this issue Mar 19, 2021 · 4 comments · Fixed by #17

Comments

@luantunez
Copy link

Hello, I was trying to use your model on skin segmentation in a CPU, but I am not being able to predict over an image. Is that possible? Would you help me with the code modifications, please?
Thank you, Lucia

@WillBrennan
Copy link
Owner

There's three places where .cuda() or device='cuda' is used. These need to be a global variable somewhere; that defines what device to use.

device = 'cuda' if torch.cuda.is_available() else 'cpu'

I need to make this change to the two other pytorch projects as well. I'll look at doing it in the next week.

@luantunez
Copy link
Author

Thank you for your response. I was able to make the predictions with your modifications. I am not getting the same results though, but a much smaller threshold is needed and not even then I get a good segmentation.
Do you know why should that be?

@luantunez
Copy link
Author

BTW, which are these three places? I am only seeing two and getting the runtime error though:

device = torch.device("cpu")

being used in:
model = load_model(models[model_type], torch.load(model_ckpt, map_location=device))
image = image.to(device).unsqueeze(0)

@WillBrennan
Copy link
Owner

There was also a call to model.cuda().eval() which needed to be changed. You can see it in the PR #17

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