plot_image_explanation | R Documentation |
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" )
explanation |
The explanation created with an |
which |
The case in |
threshold |
The lowest absolute weighted superpixels to include |
show_negative |
Should areas that contradicts the prediction also be shown |
display |
How should the areas be shown? Either |
fill_alpha |
In case of |
outline_col |
A vector of length 2 giving the colour for supporting and
contradicting areas respectively if |
block_col |
The colour to use for the unimportant areas if
|
A ggplot object
## Not run: # load precalculated explanation as it takes a long time to create explanation <- .load_image_example() # Default plot_image_explanation(explanation) # Block out background instead plot_image_explanation(explanation, display = 'block') # Show negatively correlated areas as well plot_image_explanation(explanation, show_negative = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.