0

I wanted to see output of various intermediate layers while i was using a VGG model(Just for fun).

So after a Convolution operation u get something like this (?,28,28,512):

  1. ? for number of images passed
  2. 28*28 is the dimension after convolution operation and
  3. 512 is the number of filter that were provided.

I wanted to see what various output look like For Example of[0,:,:,25] and so used this method in the link to convert an array into image. Now my question is what kind of image is this exactly if not an RGB cause when i see the image there definitely are some blue,green color.Attaching the output if anyone is interested

EDIT:- Code that i have been using:-

req_model = Model(inputs=base_model.input, outputs=base_model.get_layer('block4_conv2 ').output) vpred = req_model.predict(img) ## np.shape(vpred) == (1,28,28,512) plt.imshow(vpred[0,:,:,12])

TL;DR What does an image of shape 28*28 mean exactly[i thought i was going to see something black and white] in my case and if this is not the right way i would love some guidance.

Sanchit
  • 29
  • 9
  • 1
    This is a colormap being used. It's name is viridis and there is an own page on matplotlib's docs for colormaps! And a [gallery](https://matplotlib.org/examples/color/colormaps_reference.html). – sascha Feb 05 '18 at 17:49
  • Quick question can i change different colormap for this array and is there a global acceptance on which colormad should be used or just that people choose on the basis of different applications. – Sanchit Feb 05 '18 at 18:26
  • Yes. Read matplotlib's docs (on how to select colormaps). You also did not provide any code. Who knows how you are plotting. And most matplotlib people will use viridis. There is much to say, there is an own video-talk about viridis. Every colormap targets different things. As the gallery-link above says: this is map trying to achieve perceptually uniform mapping. If you don't know what that means, look for the talk. (or course you can always use cmap.Greys too) – sascha Feb 05 '18 at 18:29
  • Thanks for your kind help i added the code its not much there just a basic plt.imshow function from matplotlib's pyplot. If it's ok can you add the link of the video-talk you have been talking about(I can google it too but don't know which one u mean). – Sanchit Feb 05 '18 at 19:04
  • I meant [this one](https://www.youtube.com/watch?v=xAoljeRJ3lU). Keep in mind, that viridis is shipped and the default-one in matplotlib 2 (is/was external package at the time of the video). – sascha Feb 05 '18 at 19:12
  • Thanks will definitely have a look :) – Sanchit Feb 06 '18 at 09:24

1 Answers1

1

If you are using matplotlib to plot an image then it looks like Viridis colormap. More here.

akarilimano
  • 1,034
  • 1
  • 10
  • 17
  • Quick question can i change different colormap for this array and is there a global acceptance on which colormap should be used or just that people choose on the basis of different application – Sanchit Feb 05 '18 at 18:29