How to calculate output shape & parameters in a CNN?
Output Feature Size Formula
: number of input features : number of output features : convolution kernel size : convolution padding size : convolution stride size
Parameters Formula
Where:
= kernel width = kernel height = number of input channels = number of filters (kernels / output channels) - The "+ 1" accounts for the bias term for each filter.
Example

Given:
- Image size =
- Input channels =
- Filters:
kernels of size , each applied across all input channels
Parameters
Output Features
How does a typical CNN architecture for image classification look like?

| Layer | Operation | Formula Inputs ( |
Output Size (nout) |
Output Volume | Channels |
Parameters Calculation | Weights | Biases | Total Parameters |
|---|---|---|---|---|---|---|---|---|---|
| 0 | Input Image | 227x227x3 | 0 | 0 | 0 | ||||
| 1 | CONV1 | 55 | 55 × 55 × 96 | (11 × 11 × 3 + 1) × 96 | 34,848 | 96 | 34,944 | ||
| 2 | POOL1 | 27 | 27 × 27 × 96 | 0 (No learnable weights) | 0 | 0 | 0 | ||
| 3 | CONV2 | 27 | 27 × 27 × 256 | (5 × 5 × 96 + 1) × 256 | 614,400 | 256 | 614,656 | ||
| 4 | POOL2 | 13 | 13 × 13 × 256 | 0 (No learnable weights) | 0 | 0 | 0 | ||
| 5 | CONV3 | 13 | 13 × 13 × 384 | (3 × 3 × 256 + 1) × 384 | 884,736 | 384 | 885,120 | ||
| 6 | CONV4 | 13 | 13 × 13 × 384 | (3 × 3 × 384 + 1) × 384 | 1,327,104 | 384 | 1,327,488 | ||
| 7 | CONV5 | 13 | 13 × 13 × 256 | (3 × 3 × 384 + 1) × 256 | 884,736 | 256 | 884,992 | ||
| 8 | POOL3 | 6 | 6 × 6 × 256 | 0 (No learnable weights) | 0 | 0 | 0 | ||
| 9 | FC1 | Flattened Input: 9,216 | - | 4096 × 1 | (9216 + 1) × 4096 | 37,748,736 | 4,096 | 37,752,832 | |
| 10 | FC2 | Input: 4096 | - | 4096 × 1 | (4096 + 1) × 4096 | 16,777,216 | 4,096 | 16,781,312 | |
| 11 | Softmax | Input: 4096 | - | 1000 × 1 | (4096 + 1) × 1000 | 4,096,000 | 1000 | 4,097,000 | |
| 12 | Output | 1000 × 1 | 0 | 0 | 0 |