DRISEStack

class xaitk_saliency.impls.gen_object_detector_blackbox_sal.drise.DRISEStack(n: int, s: int, p1: float, seed: int | None = None, fill: int | Sequence[int] | ndarray | None = None, threads: int | None = 0)

Encapsulation of the perturbation-occlusion method using the RISE image perturbation and DRISE scoring algorithms to generate visual saliency maps for object detections. See references in the RISEGrid and DRISEScoring documentation.

Methods

from_config

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

generate

Generate per-detection visual saliency heatmaps for some object detector black-box over some input reference detections from some input reference image.

get_config

Return a JSON-compliant dictionary that could be passed to this class's from_config method to produce an instance with identical configuration.

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__(n: int, s: int, p1: float, seed: int | None = None, fill: int | Sequence[int] | ndarray | None = None, threads: int | None = 0) None

Encapsulation of the perturbation-occlusion method using the RISE image perturbation and DRISE scoring algorithms to generate visual saliency maps for object detections.

Parameters:
  • n – Number of random masks used in the algorithm.

  • s – Spatial resolution of the small masking grid. Assumes square grid.

  • p1 – Probability of the grid cell being set to 1 (not occluded). This should be a float value in the [0, 1] range.

  • seed – A seed to pass to the constructed random number generator to allow for reproducibility.

  • fill – Optional fill for alpha-blending the occluded regions based on the masks generated by the RISEGrid perturber. Can be a scalar value, a per-channel sequence or a shape-matched image.

  • threads – The number of threads to utilize when generating masks. If this is <=0 or None, no threading is used and processing is performed in-line serially.