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

draw_segmentation_masks: Add support for GPU #7683

Closed
mshr-h opened this issue Jun 20, 2023 · 0 comments · Fixed by #7684
Closed

draw_segmentation_masks: Add support for GPU #7683

mshr-h opened this issue Jun 20, 2023 · 0 comments · Fixed by #7684

Comments

@mshr-h
Copy link
Contributor

mshr-h commented Jun 20, 2023

🚀 The feature

Adding support for draw_segmentation_masks computation on GPU by creating the colors tensor in the same device as the input image tensor.

Motivation, pitch

The current draw_segmentation_masks function requires all the input tensors to be located in the CPU because the colors tensor is created in the CPU.
By placing the colors tensor in the same device as the input image tensor, we could run all the computation in GPU if the input tensors are in the GPU.

-    colors = [torch.tensor(color, dtype=out_dtype) for color in _parse_colors(colors, num_objects=num_masks)]
+    colors = [torch.tensor(color, dtype=out_dtype, device=image.device) for color in _parse_colors(colors, num_objects=num_masks)]

Alternatives

No response

Additional context

No response

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.

1 participant