adityac94 / Grad_CAM_plus_plus

A generalized gradient-based CNN visualization technique
284 stars 56 forks source link

Question about computational efficiency and numerical stability in equation (19) #14

Open mlerma54 opened 2 years ago

mlerma54 commented 2 years ago

I noticed that equation (19) in the paper:

Screenshot_from_2022-04-16_11-51-45

can be simplified by dividing numerator and denominator by the squared gradient:

Screenshot_from_2022-04-16_12-28-23

The simplified version (19") is more efficient (no powers of gradients need to be computed), and clearly more numerically stable than (19), because the powers are vulnerable to numerical over and underflow. It is also more robust for the case in which the gradients are zero (the original version becomes 0/0).

Is there any reason for using (19) instead of (19") in the computation of the alphas?