Open colorfully-ybf opened 2 years ago
To have any chance at helping, I would need context: what kind of model are you using, does the model forward pass work on an inout tensor? or does it expect img_metas ? You might need to create a wrapper for the model so it works on an image.
Thank you for your answer.My model requires 4 parameters.So I need to input 4 parameters in (input_tensor = torch.autograd.Variable(input_tensor, requires_grad=True))?
Traceback (most recent call last): File "/media/deep/Data/4_WSOD/pytorch-grad-cam/cam.py", line 133, in
grayscale_cam = cam(input_tensor=input_tensor,
File "/media/deep/Data/4_WSOD/pytorch-grad-cam/pytorch_grad_cam/base_cam.py", line 188, in call
return self.forward(input_tensor,
File "/media/deep/Data/4_WSOD/pytorch-grad-cam/pytorch_grad_cam/base_cam.py", line 74, in forward
outputs = self.activations_and_grads(input_tensor)
File "/media/deep/Data/4_WSOD/pytorch-grad-cam/pytorch_grad_cam/activations_and_gradients.py", line 42, in call
return self.model(x)
File "/home/deep/Libraries/anaconda3/envs/wsod2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, *kwargs)
File "/home/deep/Libraries/anaconda3/envs/wsod2/lib/python3.8/site-packages/mmcv/runner/fp16_utils.py", line 116, in new_func
return old_func(args, **kwargs)
TypeError: forward() missing 1 required positional argument: 'img_metas'