gradcam_plus_plus-pytorch
gradcam_plus_plus-pytorch copied to clipboard
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Current versions of modules (January 2024).
In utils add:
heatmap = cv2.applyColorMap(np.uint8(255 * mask.cpu().squeeze()), cv2.COLORMAP_JET)
Line 15
Then it will work
I re-created the repository, indent to modify it further: https://github.com/mikbuch/gradcam-pytorch-pet. Thank you Konny for creating this very useful example.