shap.maskers.Image

class shap.maskers.Image(mask_value, shape=None)

This masks out image regions with blurring or inpainting.

__init__(mask_value, shape=None)

Build a new Image masker with the given masking value.

Parameters
mask_valuenp.array, “blur(kernel_xsize, kernel_xsize)”, “inpaint_telea”, or “inpaint_ns”

The value used to mask hidden regions of the image.

shapeNone or tuple

If the mask_value is an auto-generated masker instead of a dataset then the input image shape needs to be provided.

Methods

__init__(mask_value[, shape])

Build a new Image masker with the given masking value.

build_partition_tree()

This partitions an image into a herarchical clustering based on axis-aligned splits.

inpaint(x, mask, method)

Fill in the masked parts of the image through inpainting.

load(in_file[, instantiate])

Load a Image masker from a file stream.

save(out_file)

Write a Image masker to a file stream.

build_partition_tree()

This partitions an image into a herarchical clustering based on axis-aligned splits.

inpaint(x, mask, method)

Fill in the masked parts of the image through inpainting.

classmethod load(in_file, instantiate=True)

Load a Image masker from a file stream.

save(out_file)

Write a Image masker to a file stream.