deep-learning-with-python-notebooks
deep-learning-with-python-notebooks copied to clipboard
5.4 Visualizing what convnets learn,why convolution is green when visualizing images
Why convolution is green when visualizing images?
plt.imshow(display_grid, aspect='auto', cmap='viridis')
Hi, please take a look at the last sentence. display_grid
is a numpy 2D array which is not RGB data. So the programmer have to use cmap
to appoint the style. And virdis
represents blue-green-yellow. Here is part of the matplotlib documentation.
cmp:cmapstr or Colormap, optional
The Colormap instance or registered colormap name used to map scalar data to colors.
This parameter is ignored for RGB(A) data. Defaults to rcParams["image.cmap"] (default: 'viridis').
So actually the color has nothing to with the color of the input image, because it has been processed to a 4D tensor before inputting to the convnet.
谢谢~
Your answer is very helpful to me, thanks
A big compliment to you.@ @XZLeo