RISEScoring
- class xaitk_saliency.impls.gen_classifier_conf_sal.rise_scoring.RISEScoring(p1: float = 0.0)
Saliency map generation based on the original RISE implementation. This version utilizes only the input perturbed image confidence predictions and does not utilize reference image confidences. This implementation also takes influence from debiased RISE and may take an optional debias probability, p1 (0 by default). In the original paper this is paired with the same probability used in RISE perturbation mask generation (see the p1 parameter in
xaitk_saliency.impls.perturb_image.rise.RISEGrid
).Based on Hatakeyama et. al: https://openaccess.thecvf.com/content/ACCV2020/papers/Hatakeyama_Visualizing_Color-wise_Saliency_of_Black-Box_Image_Classification_Models_ACCV_2020_paper.pdf
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 RISEScoring 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.
- __init__(p1: float = 0.0) None
Generate RISE-based saliency maps with optional p1 de-biasing.
- Parameters:
p1 – De-biasing parameter based on the masking probability. This should be a float value in the [0, 1] range.
- Raises:
ValueError – Input p1 was not in the [0,1] range.
- 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[str, Any]
Get the configuration dictionary of the RISEScoring instance.
- Returns:
dict[str, Any]: Configuration dictionary.