class_docstr: Perform Occlusion Sensitivity for a given input
class_docstr_tok: ["Perform","Occlusion","Sensitivity","for","a","given","input"]
docstr: Compute sensitivity map on a given image for a specific class index.
  
  Args:
      model (tf.keras.Model): tf.keras model to inspect
      image:
      class_index (int): Index of targeted class
      patch_size (int): Size of patch to apply on the image
  
  Returns:
      np.ndarray: Sensitivity map with shape (H, W, 3)
docstr_tok: ["Compute","sensitivity","map","on","a","given","image","for","a","specific","class","index",".","Args",":","model","(","tf.keras.Model",")",":","tf.keras","model","to","inspect","image",":","class_index","(","int",")",":","Index","of","targeted","class","patch_size","(","int",")",":","Size","of","patch","to","apply","on","the","image","Returns",":","np.ndarray",":","Sensitivity","map","with","shape","(","H",",","W",",","3",")"]
code: def get_sensitivity_map(self, model, image, class_index, patch_size):
      """
      Compute sensitivity map on a given image for a specific class index.
  
      Args:
          model (tf.keras.Model): tf.keras model to inspect
          image:
          class_index (int): Index of targeted class
          patch_size (int): Size of patch to apply on the image
  
      Returns:
          np.ndarray: Sensitivity map with shape (H, W, 3)
      """
      sensitivity_map = np.zeros(
          (
              math.ceil(image.shape[0] / patch_size),
              math.ceil(image.shape[1] / patch_size),
          )
      )
  
      patches = [
          apply_grey_patch(image, top_left_x, top_left_y, patch_size)
          for index_x, top_left_x in enumerate(
              range(0, image.shape[0], patch_size)
          )
          for index_y, top_left_y in enumerate(
              range(0, image.shape[1], patch_size)
          )
      ]
  
      coordinates = [
          (index_y, index_x)
          for index_x in range(
              sensitivity_map.shape[
                  1
              ]  # pylint: disable=unsubscriptable-object
          )
          for index_y in range(
              sensitivity_map.shape[
                  0
              ]  # pylint: disable=unsubscriptable-object
          )
      ]
  
      predictions = model.predict(
          np.array(patches), batch_size=self.batch_size
      )
      target_class_predictions = [
          prediction[class_index] for prediction in predictions
      ]
  
      for (index_y, index_x), confidence in zip(
          coordinates, target_class_predictions
      ):
          sensitivity_map[index_y, index_x] = 1 - confidence
  
      return cv2.resize(sensitivity_map, image.shape[0:2])
  
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 3 for calling the OcclusionSensitivity obj's underlying member method code with example usage: obj.get_sensitivity_map(model, image, class_index, patch_size) and returns: cv2