OcclusionScoring
- class xaitk_saliency.impls.gen_classifier_conf_sal.occlusion_scoring.OcclusionScoring
This saliency implementation transforms black-box image classification scores into saliency heatmaps. This should require a sequence of per-class confidences predicted on the reference image, a number of per-class confidences as predicted on perturbed images, as well as the masks of the reference image perturbations (as would be output from a PerturbImage implementation).
The perturbation masks used by the following implementation are expected to be of type integer. Masks containing values of type float are rounded to the nearest value and binarized with value 1 replacing values greater than or equal to half of the maximum value in mask after rounding while 0 replaces the rest.
Methods
from_config
Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.
Generate saliency maps
Get the configuration dictionary of the OcclusionScoring instance.
get_default_config
Generate and return a default configuration dictionary for this class.
get_impls
Discover and return a set of classes that implement the calling class.
is_usable
Check whether this class is available for use.
- generate(reference: ndarray, perturbed: ndarray, perturbed_masks: ndarray) ndarray
Generate saliency maps
- Parameters:
reference – np.ndarray Reference confidence lengths from the reference image
perturbed – np.ndarray Perturbed confidence lengths from the reference image
perturbed_masks – np.ndarray Perturbation masks numpy.ndarray over the reference image.
- Returns:
np.ndarray Generated visual saliency heatmap.
- get_config() dict
Get the configuration dictionary of the OcclusionScoring instance.
- Returns:
dict[str, Any]: Configuration dictionary.