Computer Vision · Intermediate

Convolutional Neural Network

Watch learned filters scan pixels, pool local evidence, and produce a real image-classification prediction.

A deliberately tiny two-filter CNN keeps convolution, max pooling, dense classification, and backpropagation numerically visible on ordinary browsers.

Step by step

  1. Read a tiny 6×6 image.
  2. Slide two learned 3×3 filters over all valid local patches.
  3. Apply ReLU to both convolution feature maps.
  4. Apply 2×2 max pooling with stride 2.
  5. Flatten both pooled maps into eight features.
  6. Convert those features to a sigmoid class probability.
  7. Backpropagate through the dense layer, max-pool switches, ReLU, and both shared filters.

Core formulas

Convolution

z_f[i,j] = ΣₘΣₙ X[i+m,j+n]K_f[m,n] + b_f

Each learned filter is reused across image positions.

ReLU

A_f[i,j] = max(0,z_f[i,j])

Positive local responses continue.

Max pool

P_f[r,c] = max A_f[2r:2r+2,2c:2c+2]

Each local 2×2 region keeps its strongest activation.

Dense output

p = σ(wᵀ flatten(P) + b)

Eight pooled features feed the learned output classifier.

When to use Convolutional Neural Network

  • Learning convolution, shared kernels, feature maps, pooling, and end-to-end gradients.

Official documentation

TensorFlow CNN tutorial