mednet.engine.classify.saliency.viewer

Engine and functions for visualization of saliency maps.

Functions

run(datamodule, input_folder, target_label, ...)

Overlay saliency maps on CXR to output final images with heatmaps.

mednet.engine.classify.saliency.viewer.run(datamodule, input_folder, target_label, output_folder, show_groundtruth, threshold)[source]

Overlay saliency maps on CXR to output final images with heatmaps.

Parameters:
  • datamodule (LightningDataModule) – The Lightning DataModule to iterate on.

  • input_folder (Path) – Directory in which the saliency maps are stored for a specific visualization type.

  • target_label (int) – The label to target for evaluating interpretability metrics. Samples contining any other label are ignored.

  • output_folder (Path) – Directory in which the resulting visualizations will be saved.

  • show_groundtruth (bool) – If set, imprint ground truth labels over the original image and saliency maps.

  • threshold (float) – The pixel values above threshold % of max value are kept in the original saliency map. Everything else is set to zero. The value proposed on [SCORECAM-2020] is 0.2. Use this value if unsure.