Open himsR opened 2 years ago
Hi @himsR - thank you for the question. I wonder whether the attr
argument consists of all zero's (or all negative values, since you are using sign='positive'
). It is complaining because the top 1% of positive pixel attributions is equal to 0.
Facing the same issue, any ideas for handling this properly? Thank you!
Hello,
I followed the example in the tutorial to use integrated gradients for my model that takes in image as well as tabular features.
But I get this error -->
Traceback (most recent call last): File "/media/himanshu/69c57ccf-aa7f-4a0a-bf49-539a27acad35/realestate/data/onestage/singleImageModel.py", line 204, in explain = viz.visualize_image_attr(np.transpose(attributions_ig[0].squeeze().cpu().detach().numpy(), (1, 2, 0)), File "/home/himanshu/anaconda3/envs/newpytorch/lib/python3.9/site-packages/captum/attr/_utils/visualization.py", line 244, in visualize_image_attr norm_attr = _normalize_image_attr(attr, sign, outlier_perc) File "/home/himanshu/anaconda3/envs/newpytorch/lib/python3.9/site-packages/captum/attr/_utils/visualization.py", line 84, in _normalize_image_attr return _normalize_scale(attr_combined, threshold) File "/home/himanshu/anaconda3/envs/newpytorch/lib/python3.9/site-packages/captum/attr/_utils/visualization.py", line 42, in _normalize_scale assert scale_factor != 0, "Cannot normalize by scale factor = 0" AssertionError: Cannot normalize by scale factor = 0
Thanks