class_docstr: ImageFeature is used to visualize image features in Insights. It expects an image in
  NCHW format. If C has a dimension of 1, its assumed to be a greyscale image.
  If it has a dimension of 3, its expected to be in RGB format.
class_docstr_tok: ["ImageFeature","is","used","to","visualize","image","features","in","Insights",".","It","expects","an","image","in","NCHW","format",".","If","C","has","a","dimension","of","1",",","its","assumed","to","be","a","greyscale","image",".","If","it","has","a","dimension","of","3",",","its","expected","to","be","in","RGB","format","."]
code: def visualize(
      self, attribution, data, contribution_frac
  ) -> FeatureOutput:
      if self.visualization_transform:
          data = self.visualization_transform(data)
  
      data_t, attribution_t = [
          t.detach().squeeze().permute((1, 2, 0)).cpu().numpy()
          for t in (data, attribution)
      ]
  
      orig_fig, _ = viz.visualize_image_attr(
          attribution_t,
          data_t,
          method="original_image",
          use_pyplot=False,
      )
      attr_fig, _ = viz.visualize_image_attr(
          attribution_t,
          data_t,
          method="heat_map",
          sign="absolute_value",
          use_pyplot=False,
      )
  
      img_64 = _convert_figure_base64(orig_fig)
      attr_img_64 = _convert_figure_base64(attr_fig)
  
      return FeatureOutput(
          name=self.name,
          base=img_64,
          modified=attr_img_64,
          type=self.visualization_type(),
          contribution=contribution_frac,
      )
  
imports: import base64
  import warnings
  from collections import namedtuple
  from io import BytesIO
  from typing import Callable, List, Optional, Union
  from captum._utils.common import safe_div
  from captum.attr._utils import visualization
  from captum.insights.attr_vis._utils.transforms import format_transforms
label_desc: Use image node_id 3 for calling the ImageFeature obj's underlying member method code with example usage: obj.visualize(attribution, data, contribution_frac) and returns: FeatureOutput