Deep learning visualizer

CNN Operations Visualizer

See how filters extract features and pooling reduces spatial dimensions.

Input7 x 7Kernel3 x 3Stride1Output5 x 5
Kernel (3 x 3)
ReadyReady: 0 of 25

Input Matrix

7 x 7
0000000001221000122100012210001221000122100000000

Kernel

3 x 3
-101-101-101

Feature Map

5 x 5
Press Run or Step to calculate the first output cell.
Ready: 0 of 25
Kernel pass0 / 25Output cells calculated
WindowPendingCurrent input region size
Settingss1 p0 d1Stride, padding, dilation
Input7 x 7 x 1
Convolution3 x 3 / p=0
ActivationRELU
PoolingMax 2 x 2
Output2 x 2

How it works

  1. A small kernel slides over the input matrix using the selected stride, padding, and dilation.
  2. At each position, matching input and kernel cells are multiplied and summed.
  3. The feature map is passed through an activation function.
  4. Pooling compresses local regions while keeping strong features.
Y[i,j] = sum X[i+m, j+n]K[m,n] + b

Implementation

  1. import numpy as np
  2. def conv2d(x, kernel, stride=1, padding=0):
  3. x = np.pad(x, padding)
  4. h = (x.shape[0] - kernel.shape[0]) // stride + 1
  5. out = np.zeros((h, h))
  6. for i in range(h):
  7. for j in range(h):
  8. region = x[i*stride:i*stride+3, j*stride:j*stride+3]
  9. out[i, j] = np.sum(region * kernel)
  10. return out