Hi I tried your code to visualize a trained densenet169 model.
But the code throws error
heatmap, result = visualize_cam(mask, torch_img)
File "/home/user/vizualize_Nets/utils.py", line 15, in visualize_cam
heatmap = cv2.applyColorMap(np.uint8(255 * mask.squeeze()), cv2.COLORMAP_JET)
File "/home/user/.local/lib/python3.6/site-packages/torch/tensor.py", line 460, in __array__
return self.numpy().astype(dtype, copy=False)
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Simple converting to CUDA tensor or cpu().numpy() tensor does not solve the problem. Any idea how to solve it ?
Hi I tried your code to visualize a trained densenet169 model.
But the code throws error
Simple converting to CUDA tensor or cpu().numpy() tensor does not solve the problem. Any idea how to solve it ?
Thanks in advance.