mednet.engine.classify.saliency.interpretability

Engine and functions for human interpretability analysis.

Functions

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

Compute the proportional energy and average saliency focus for a given target label in a DataModule.

mednet.engine.classify.saliency.interpretability.run(input_folder, target_label, datamodule, only_dataset)[source]

Compute the proportional energy and average saliency focus for a given target label in a DataModule.

Parameters:
  • 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.

  • datamodule (LightningDataModule) – The lightning DataModule to iterate on.

  • only_dataset (str | None) – If set, will only run this code for the named dataset on the provided datamodule, skipping any other datasets.

Return type:

dict[str, list[Any]]

Returns:

A dictionary where keys are dataset names in the provided DataModule, and values are lists containing sample information alongside metrics calculated:

  • Sample name (str)

  • Sample target class (int)

  • Proportional energy (float)

  • Average saliency focus (float)