Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lime/lime_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from . import lime_base
from .wrappers.scikit_image import SegmentationAlgorithm

from skimage.filters import gaussian

class ImageExplanation(object):
def __init__(self, image, segments):
Expand Down Expand Up @@ -186,12 +187,17 @@ def explain_instance(self, image, classifier_fn, labels=(1,),
raise e

fudged_image = image.copy()
if hide_color is None:

if hide_color is 'blur':
fudged_image = gaussian(fudged_image, sigma=4, multichannel=True, preserve_range = True)

elif hide_color is None:
for x in np.unique(segments):
fudged_image[segments == x] = (
np.mean(image[segments == x][:, 0]),
np.mean(image[segments == x][:, 1]),
np.mean(image[segments == x][:, 2]))

else:
fudged_image[:] = hide_color

Expand Down