What is CNN?

CNN (Convolutional Neural Network) is a neural-network architecture that applies shared local kernels across grid-like or spatially organized inputs, producing feature maps that encode a strong locality and translation-equivariance bias.

Quick Facts

Full NameConvolutional Neural Network
Created1989 by Yann LeCun et al. (LeNet)
SpecificationOfficial Specification

How It Works

Convolution produces feature maps

For every output channel, a kernel spans all input channels and a local spatial window. Stride controls where the kernel is evaluated, padding controls boundary behavior, and dilation expands the sampled receptive field. Output size follows the exact kernel, padding, stride, and dilation configuration; an incorrect shape assumption can silently break alignment with labels or skip connections.

Equivariance is not invariance

With ideal boundary handling and unit stride, translating an input translates a convolutional feature map: this is translation equivariance. Classification invariance requires later aggregation, pooling, augmentation, or a learned decision and remains approximate. Padding, downsampling, cropping, and aliasing can break exact equivariance, so CNNs do not recognize an object at every position by definition.

Receptive field and channel mixing shape the model

Stacking local layers expands the theoretical receptive field, but the effective influence of distant pixels can be smaller. Pointwise, grouped, depthwise, dilated, residual, and strided convolutions trade channel interaction, spatial coverage, compute, and memory differently. Pooling and fully connected layers are common options, not mandatory defining components of every CNN.

Choose and evaluate CNNs by the workload

CNNs remain useful where locality, streaming, edge deployment, or predictable memory access matters; Transformers may be preferable when global interactions and large-scale pretraining dominate. Compare them on the same data split and augmentation policy, then measure accuracy or task loss, calibration, corruption and shift robustness, peak memory, throughput, and tail latency on target hardware.

Key Characteristics

  • Uses sparse local connectivity instead of connecting every input to every output
  • Shares each kernel across spatial or temporal positions
  • Produces translation-equivariant feature maps under specific stride and boundary conditions
  • Builds larger receptive fields by stacking or dilating local operations
  • Supports multidimensional inputs and multiple learned input and output channels
  • Trades spatial resolution, aliasing, compute, and memory through stride and downsampling

Common Use Cases

  1. Image classification with controlled crop, resolution, and class-shift evaluation
  2. Object detection and segmentation where output geometry must remain aligned
  3. Audio, waveform, and sensor processing with one-dimensional convolutions
  4. Edge vision systems constrained by memory, throughput, or power
  5. CNN backbones or convolutional blocks inside hybrid and generative architectures

Example

loading...
Loading code...

Frequently Asked Questions

What does a convolutional layer compute?

It applies each learned kernel to local windows across all input channels and writes the resulting dot products into feature maps. Most libraries compute cross-correlation rather than mathematically flipped convolution. Stride, padding, dilation, groups, and channel counts determine output shape and cost.

Are CNNs translation invariant?

A standard unit-stride convolution is translation equivariant under suitable boundary assumptions: shifting the input shifts the feature map. Invariance means the final output does not change. Pooling, aggregation, augmentation, and training can encourage approximate invariance, but padding, stride, cropping, and aliasing can weaken it.

How is a CNN different from an RNN or Transformer?

A CNN applies shared local kernels and can process positions largely in parallel. An RNN updates a recurrent state sequentially. A Transformer uses attention to mix information across positions. None is universally best; input structure, required context, training data, latency, memory, and target hardware determine the choice.

Do all CNNs require pooling and fully connected layers?

No. Convolution is the defining operation. Modern networks may downsample with strided convolutions, preserve resolution for dense prediction, use global average pooling, or remain fully convolutional. Pooling and dense heads are architectural choices whose information loss and compute effects must be evaluated.

How should a CNN be evaluated before deployment?

Use an untouched split that preserves entity and capture-session boundaries, then report task metrics by class and relevant subgroup. Test resolution changes, crop policy, corruption, lighting or sensor shifts, calibration, and adversarially relevant cases. Benchmark the exported model's memory, batch and tail latency, and throughput on target hardware.

Related Tools

Related Terms

Related Articles