facebookresearch / facebookresearch/segment-anything

RuntimeError: Could not infer dtype of numpy.uint8

Open
#477 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
54.9k
Forks
6.4k
PR merge metrics
No merged PRs in 30d

Description

I would appreciate it if you could assist me with how to fix the error below.

`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[26], line 2
1 #image = torch.as_tensor(image, device=device, dtype=torch.uint8)
----> 2 predictor.set_image(image)

File ~\AppData\Local\anaconda3\envs\dev\lib\site-packages\segment_anything\predictor.py:57, in SamPredictor.set_image(self, image, image_format)
55 # Transform the image to the form expected by the model
56 input_image = self.transform.apply_image(image)
---> 57 input_image_torch = torch.as_tensor(input_image, device=self.device)
58 input_image_torch = input_image_torch.permute(2, 0, 1).contiguous()[None, :, :, :]
60 self.set_torch_image(input_image_torch, image.shape[:2])

RuntimeError: Could not infer dtype of numpy.uint8`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.