0
$\begingroup$

I'm doing a Convolutional Neural Network of MNIST data set, and how can I visualize the weights of the output(classification) layer? I only found several websites visualizing the filters in CNN model but none for the output layer.

this is my code so far:

model = Sequential()
model.add(Conv2D(
          input_shape=(28,28,1),
          filters=16,kernel_size= (5,5),
          padding='same',
          activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Conv2D(
          filters=16,kernel_size= (3,3),
          padding='same',
          activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.25))

model.add(Flatten())
model.add(Dense(units=128,activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(units=10,activation='softmax'))
model.compile(loss='categorical_crossentropy',optimizer='adam',metrics=['accuracy'])
train = model.fit(x=x_train,y=y_train,validation_split=0.2,epochs=10,batch_size=200,verbose=2)

weights for the ten features

$\endgroup$
  • 1
    $\begingroup$ The only thing to visualise in the output layer is the relative confidence for each class, so why not just do a bar chart? $\endgroup$ – timleathart Jul 26 '19 at 2:48
  • $\begingroup$ I agree with @timleathart , see the representation that Stanford used in CS231n: cs231n.github.io/assets/cnn/convnet.jpeg $\endgroup$ – Recessive Jul 26 '19 at 4:14
  • $\begingroup$ @Recessive thanks a lot! $\endgroup$ – Shania Bu Jul 26 '19 at 5:40
  • $\begingroup$ The output layer consists of only class probabilities which could be visualized using a bar graph as mentioned by @timeleathart. $\endgroup$ – Shubham Panchal Jul 26 '19 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.