class_docstr: Perform Occlusion Sensitivity for a given input
class_docstr_tok: ["Perform","Occlusion","Sensitivity","for","a","given","input"]
docstr: Compute Occlusion Sensitivity maps for a specific class index.
  
  Args:
      validation_data (Tuple[np.ndarray, Optional[np.ndarray]]): Validation data
          to perform the method on. Tuple containing (x, y).
      model (tf.keras.Model): tf.keras model to inspect
      class_index (int): Index of targeted class
      patch_size (int): Size of patch to apply on the image
      colormap (int): OpenCV Colormap to use for heatmap visualization
  
  Returns:
      np.ndarray: Grid of all the sensitivity maps with shape (batch_size, H, W, 3)
docstr_tok: ["Compute","Occlusion","Sensitivity","maps","for","a","specific","class","index",".","Args",":","validation_data","(","Tuple","[","np.ndarray",",","Optional","[","np.ndarray","]","]",")",":","Validation","data","to","perform","the","method","on",".","Tuple","containing","(","x",",","y",")",".","model","(","tf.keras.Model",")",":","tf.keras","model","to","inspect","class_index","(","int",")",":","Index","of","targeted","class","patch_size","(","int",")",":","Size","of","patch","to","apply","on","the","image","colormap","(","int",")",":","OpenCV","Colormap","to","use","for","heatmap","visualization","Returns",":","np.ndarray",":","Grid","of","all","the","sensitivity","maps","with","shape","(","batch_size",",","H",",","W",",","3",")"]
code: def explain(
      self,
      validation_data,
      model,
      class_index,
      patch_size,
      colormap=cv2.COLORMAP_VIRIDIS,
  ):
      """
      Compute Occlusion Sensitivity maps for a specific class index.
  
      Args:
          validation_data (Tuple[np.ndarray, Optional[np.ndarray]]): Validation data
              to perform the method on. Tuple containing (x, y).
          model (tf.keras.Model): tf.keras model to inspect
          class_index (int): Index of targeted class
          patch_size (int): Size of patch to apply on the image
          colormap (int): OpenCV Colormap to use for heatmap visualization
  
      Returns:
          np.ndarray: Grid of all the sensitivity maps with shape (batch_size, H, W, 3)
      """
      images, _ = validation_data
      sensitivity_maps = np.array(
          [
              self.get_sensitivity_map(
                  model, image, class_index, patch_size
              )
              for image in images
          ]
      )
  
      heatmaps = np.array(
          [
              heatmap_display(heatmap, image, colormap)
              for heatmap, image in zip(sensitivity_maps, images)
          ]
      )
  
      grid = grid_display(heatmaps)
  
      return grid
  
file_path: tf-explain/tf_explain/core/occlusion_sensitivity.py
imports: import math
  import numpy
  import cv2
  from tf_explain.utils.display import grid_display, heatmap_display
  from tf_explain.utils.image import apply_grey_patch
  from tf_explain.utils.saver import save_rgb
label_desc: Use image node_id 2 for calling the OcclusionSensitivity obj's underlying member method code with example usage: obj.explain(validation_data, model, class_index, patch_size, colormap) and returns: grid