code: def to_grayscale(cv2im):
      
      # How strongly does each position activate the output
      grayscale_im = np.sum(np.abs(cv2im), axis=0)
  
      # Normalize between min and 99th percentile
      im_max = np.percentile(grayscale_im, 99)
      im_min = np.min(grayscale_im)
      grayscale_im = np.clip((grayscale_im - im_min) / (im_max - im_min), 0, 1)
  
      grayscale_im = np.expand_dims(grayscale_im, axis=0)
      return grayscale_im
docs: Convert gradients to grayscale. This gives a saliency map.