Closed anandhiray closed 1 year ago
Hi @anandhiray, thanks for your interest in our work. I have fixed the typo in our visualization code. There should be two returned variables for the self.bap
module here.
Thanks a lot for your immediate reply. But now it gives this error.
main()
File "infer.py", line 75, in main
visualize(data_loader=validate_loader, net=net)
File "infer.py", line 101, in visualize
attention_maps = torch.max(attention_maps, dim=1, keepdim=True)[0]
TypeError: max() received an invalid combination of arguments - got (tuple, keepdim=bool, dim=int), but expected one of:
Is it because of any version issue?
Thank you very much for your immediate response.
There are also two returned variables from net.visualize(X)
. I have fixed the bug and updated the code.
It is working great now! Thank you for your help, without which I would not have been able to do this!
When I run infer.py in fgvc, I get this error.
File "infer.py", line 100, in visualize attention_maps = net.visualize(X) File "/kaggle/working/CAL/fgvc/models/cal.py", line 180, in visualize p = self.fc(feature_matrix 100) File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(input, **kwargs) File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 96, in forward return F.linear(input, self.weight, self.bias) File "/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py", line 1847, in linear return torch._C._nn.linear(input, weight, bias) TypeError: linear(): argument 'input' (position 1) must be Tensor, not tuple
Can you help me fix this? Thank you!