SBSMStack
- class xaitk_saliency.impls.gen_image_similarity_blackbox_sal.sbsm.SBSMStack(window_size: tuple[int, int] = (50, 50), stride: tuple[int, int] = (20, 20), proximity_metric: str = 'euclidean', fill: int | Sequence[int] | ndarray | None = None, threads: int | None = None)
Encapsulation of the perturbation-occlusion method using specifically the sliding window image perturbation and similarity scoring algorithms to generate similarity-based visual saliency maps. See the documentation of
SlidingWindow
andSimilarityScoring
for details.Methods
from_config
Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.
generate
Generates visual saliency maps based on the similarity of the reference image to each query image determined by the output of the blackbox feature vector generator.
Get the configuration dictionary of the SBSMStack instance.
Returns the default configuration for the SBSMStack.
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), proximity_metric: str = 'euclidean', fill: int | Sequence[int] | ndarray | None = None, threads: int | None = None) None
Encapsulation of the perturbation-occlusion method using specifically the sliding window image perturbation
- 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).
proximity_metric –
The type of comparison metric used to determine proximity in feature space. The type of comparison metric supported is restricted by scipy’s cdist() function. The following metrics are supported in scipy.
‘braycurtis’, ‘canberra’, ‘chebyshev’, ‘cityblock’, ‘correlation’, ‘cosine’, ‘dice’, ‘euclidean’, ‘hamming’, ‘jaccard’, ‘jensenshannon’, ‘kulsinski’, ‘mahalanobis’, ‘matching’, ‘minkowski’, ‘rogerstanimoto’, ‘russellrao’, ‘seuclidean’, ‘sokalmichener’, ‘sokalsneath’, ‘sqeuclidean’, ‘wminkowski’, ‘yule’.
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] | ndarray | None
Gets the fill value
- get_config() dict[str, Any]
Get the configuration dictionary of the SBSMStack instance.
- Returns:
dict[str, Any]: Configuration dictionary.
- classmethod get_default_config() dict[str, Any]
Returns the default configuration for the SBSMStack.
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.