Deep learning visualizer

Convolutional Neural Network (CNN) Visualizer

Visualize the complete CNN workflow from convolution and pooling to dropout, softmax, and prediction.

Choose an input

True label: 0
Stage 2 of 8

Conv

Input windowrows 1-2, cols 1-2

KernelFilter 1

-0.230.17-0.110.050.36-0.240.14-0.310.21

Convolution output0 / 784 cells

Next output[0, 0]

Sum of 3 x 3 products plus bias/offset: -0.004 + 0.08 = 0.076

0 x -0.2300 x 0.1700 x -0.1100 x 0.0500.05 x 0.360.0180.06 x -0.24-0.0140 x 0.1400.06 x -0.31-0.0190.05 x 0.210.011
Operation 0 of 784% of this layer

What happens at each layer

Input28 x 28 x 1
Conv28 x 28 x 8
ReLU28 x 28 x 8
Max Pool14 x 14 x 8
Flatten1568
Dense32
Dropoutp mask
Output2 classes

Forward-pass calculations

  1. Select an input image and true class
  2. Convolve with learned filters to create feature maps
  3. Apply activation and pooling
  4. Flatten features and pass them through dense layers
  5. Apply dropout during training
  6. Convert logits to probabilities with softmax

Implementation

  1. import torch.nn as nn
  2. self.features = nn.Sequential(
  3. nn.Conv2d(1, filters, kernel_size=k, padding=k//2),
  4. nn.ReLU(),
  5. nn.MaxPool2d(kernel_size=2),
  6. )
  7. self.classifier = nn.Sequential(
  8. nn.Flatten(), nn.Linear(filters * 14 * 14, dense),
  9. nn.Dropout(p=dropout), nn.Linear(dense, 2)
  10. )