`TypeError: Cannot handle this data type: (1, 1, 1), |u1` when using `torchvision.utils.draw_bounding_boxes`

I’m trying to draw a bounding box over an image using the draw_bounding_boxes function but am faced with this error.
Here is the code:

img = cv2.imread(img_path, 0)
img = torch.unsqueeze(torch.Tensor(img), 0)
img = img.type(torch.uint8)
res = draw_bounding_boxes(img, bbox)

Can anyone help with this?

Could you check the type of bbox? Based on the docs a tensor is expected and the error message points towards a wrong type in a numpy array, if I’m not mistaken.

Yes I verified that bbox was of type Tensor

Could you post an executable code snippet (using random tensors) so that we could reproduce this issue, please?