Convolutional Neural Network

الشبكة العصبية التلافيفية

Abbreviation: CNN

Definition

A deep neural network that uses convolution layers with small filters sliding over the input to extract spatial features; used mainly for images.

Definition

A convolutional neural network is a deep network that uses convolutional layers with small learnable filters shared across spatial positions, typically followed by pooling, to learn spatial feature hierarchies from grid-like data such as images.

Practical examples

Code example Python
import torch
from torch import nn

cnn = nn.Sequential(
    nn.Conv2d(1, 8, kernel_size=3, padding=1),
    nn.ReLU(),
    nn.MaxPool2d(2),
    nn.Flatten(),
    nn.Linear(8 * 14 * 14, 10),
)
x = torch.randn(4, 1, 28, 28)   # 4 صور رمادية بحجم 28×28
print(cnn(x).shape)

Expected output

torch.Size([4, 10])

Mathematical equations

S(i,j) = \sum_{m}\sum_{n} I(i+m,\, j+n)\, K(m,n)

Scientific sources

References and scientific sources

Learn and review

Suggested terms to learn next