class_docstr: GradCAM class helps create localization maps using the Grad-CAM method for input videos
  and overlap the maps over the input videos as heatmaps.
  https://arxiv.org/pdf/1610.02391.pdf
class_docstr_tok: ["GradCAM","class","helps","create","localization","maps","using","the","Grad-CAM","method","for","input","videos","and","overlap","the","maps","over","the","input","videos","as","heatmaps",".","https",":","\/\/arxiv.org\/pdf\/1610.02391.pdf"]
docstr: Args:
      model (model): the model to be used.
      target_layers (list of str(s)): name of convolutional layer to be used to get
          gradients and feature maps from for creating localization maps.
      data_mean (tensor or list): mean value to add to input videos.
      data_std (tensor or list): std to multiply for input videos.
      colormap (Optional[str]): matplotlib colormap used to create heatmap.
          See https://matplotlib.org/3.3.0/tutorials/colors/colormaps.html
docstr_tok: ["Args",":","model","(","model",")",":","the","model","to","be","used",".","target_layers","(","list","of","str","(","s",")",")",":","name","of","convolutional","layer","to","be","used","to","get","gradients","and","feature","maps","from","for","creating","localization","maps",".","data_mean","(","tensor","or","list",")",":","mean","value","to","add","to","input","videos",".","data_std","(","tensor","or","list",")",":","std","to","multiply","for","input","videos",".","colormap","(","Optional","[","str","]",")",":","matplotlib","colormap","used","to","create","heatmap",".","See","https",":","\/\/matplotlib.org\/3.3.0\/tutorials\/colors\/colormaps.html"]
code: def __init__(
      self,
      model,
      target_layers,
      data_mean,
      data_std,
      colormap="viridis",
  ):
      """
      Args:
          model (model): the model to be used.
          target_layers (list of str(s)): name of convolutional layer to be used to get
              gradients and feature maps from for creating localization maps.
          data_mean (tensor or list): mean value to add to input videos.
          data_std (tensor or list): std to multiply for input videos.
          colormap (Optional[str]): matplotlib colormap used to create heatmap.
              See https://matplotlib.org/3.3.0/tutorials/colors/colormaps.html
      """
  
      self.model = model
      # Run in eval mode.
      self.model.eval()
      self.target_layers = target_layers
  
      self.gradients = {}
      self.activations = {}
      self.colormap = plt.get_cmap(colormap)
      self.data_mean = data_mean
      self.data_std = data_std
      self._register_hooks()
  
file_path: SlowFast/slowfast/visualization/gradcam_utils.py
imports: import matplotlib.pyplot
  import torch
  import torch.nn.functional
  import slowfast.datasets.utils
  from slowfast.visualization.utils import get_layer
label_desc: Use image node_id 1 to create a new GradCAM object  with example: obj = GradCAM(model, target_layers, data_mean, data_std, colormap)