I am using pytorch lightning and I am want to visualize my validation data using GradCAM.I am using a pretrained Resnet 3d model and this is the code I wrote:
my_model.eval()
guided_gc = GuidedGradCam(my_model, my_model.model.fc)
input_image = next(iter(mri_dataset.val_dataloader()))
attribution = guided_gc.attribute(input_image, 1)
Error:
assert isinstance(
AssertionError: inputs must have type torch.Tensor but <class ‘dict’> found:
my val_dataloader is a list of dictionary and I am unable to pass it properly. Kindly suggest how should I go about it and how can I also view the output.