Coding Exercise on Saliency Maps

Complete this coding exercise on saliency maps and implementation of VarGrad saliency.

Problem statement: VarGrad saliency

Like SmoothGrad saliency, Variance-based Gradient Regularization (VarGrad) saliency maps reduce visual noise and produce sharper saliency maps. While the main idea of SmoothGrad is to use smoothened gradients across multiple noisy versions of the input image, VarGrad uses the variance of these gradients for generating saliency maps.

The intuition behind the thought is that if an input pixel is important for prediction, its gradients with respect to prediction will fluctuate (i.e., have high variance) when injected with noise, while pixels that have no contribution in the prediction should have stable gradients.

Mathematically, given an image XX and its prediction f(X)f(X), the VarGrad GvarG_{\text{var}} is computed as follows:

Get hands-on with 1400+ tech skills courses.