When classifying images one is often interested in seeing the areas that supports and/or contradicts a classification. plot_image_explanation() will take the result of an image explanation and highlight the areas found relevant to each label in the explanation. The highlighting can either be done by blocking the parts of the image not related to the classification, or by encircling and colouring the areas that influence the explanation.

plot_image_explanation(
explanation,
which = 1,
threshold = 0.02,
show_negative = FALSE,
display = "outline",
fill_alpha = 0.3,
outline_col = c("blue", "red"),
block_col = "grey"
)

## Arguments

explanation The explanation created with an image_explainer The case in explanation to illustrate. plot_image_explanation only supports showing one case at a time. The lowest absolute weighted superpixels to include Should areas that contradicts the prediction also be shown How should the areas be shown? Either outline or block In case of display = 'outline' how opaque should the area colour be? A vector of length 2 giving the colour for supporting and contradicting areas respectively if display = 'outline' The colour to use for the unimportant areas if display = 'block'

A ggplot object

## Examples


if (FALSE) {
# load precalculated explanation as it takes a long time to create