SlidingWindowStack

class xaitk_saliency.impls.gen_image_classifier_blackbox_sal.slidingwindow.SlidingWindowStack(window_size: tuple[int, int] = (50, 50), stride: tuple[int, int] = (20, 20), threads: int = 0)

Encapsulation of the perturbation-occlusion method using specifically sliding windows and the occlusion-scoring method. See the SlidingWindow and OcclusionScoring documentation for more details.

Methods

from_config

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

generate

Generates per-class visual saliency heatmaps for some classifier black box over some image of interest.

get_config

Get the configuration dictionary of the SlidingWindowStack instance.

get_default_config

Returns the default configuration for the SlidingWindowStack.

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__(window_size: tuple[int, int] = (50, 50), stride: tuple[int, int] = (20, 20), threads: int = 0) None

Initialization of the perturbation-occlusion method using specifically sliding windows and the occlusion-scoring method.

Parameters:
  • window_size – The block window size as a tuple with format (height, width).

  • stride – The sliding window striding step as a tuple with format (height_step, width_step).

  • threads – Optional number threads to use to enable parallelism in applying perturbation masks to an input image. If 0, a negative value, or None, work will be performed on the main-thread in-line.

property fill: int | Sequence[int] | None

Gets the fill value

get_config() dict[str, Any]

Get the configuration dictionary of the SlidingWindowStack instance.

Returns:

dict[str, Any]: Configuration dictionary.

classmethod get_default_config() dict[str, Any]

Returns the default configuration for the SlidingWindowStack.

This method provides a default configuration dictionary, specifying default values for key parameters in the factory. It can be used to create an instance of the factory with preset configurations.

Returns:

dict[str, Any]: A dictionary containing default configuration parameters.