Full search page →

IP 13 · Image Pattern Classification

Image ProcessingAdvanced28 minUpdated Nov 5, 2026

Needs: IP 12 · Feature Extraction

Navigate: this page and this track: Navigate: this page and this track
Explore this chapter 1 interactive experiment

Run leave-one-out k-nearest-neighbour classification on the real iris measurements, then change the unit of one feature: no flower moves, yet the neighbours and the accuracy do.

What you’ll learn

  • How patterns, pattern vectors and pattern classes turn “what is in this image?” into a precise decision problem
  • How prototype matching works: the minimum-distance classifier, correlation-based template matching, SIFT feature matching and matching of structural descriptions
  • Why the Bayes classifier is optimal, and what it becomes when each class is Gaussian
  • How a perceptron learns, how multilayer networks are trained with backpropagation, and how a convolutional neural network (CNN) learns its own features
  • The practical side of training: overfitting, data augmentation and regularization
  • How image classification moved from AlexNet to Vision Transformers, CLIP and DINOv2, and why benchmark numbers deserve suspicion

The big picture

IP 10–12 carved an image into regions and described each region with numbers: areas, moments, Fourier descriptors, texture statistics, keypoint descriptors. This chapter closes the pipeline. It takes those descriptions and assigns each one a label: “coin”, “digit 7”, “water”, “tumor”, “cat”. Almost every practical vision system ends with such a decision, so this is where image processing meets machine learning.

The chapter follows a historical arc that is also a conceptual one [1]. First come classifiers that work directly with prototypes (a typical member of each class). Then comes the statistically optimal classifier, which needs the class probability distributions. Finally come neural networks, which learn the decision rule from data. In their convolutional form they also learn the features, which removes much of the hand-crafted feature engineering of IP 12. If you want a gentle refresher on supervised learning, cost functions and gradient descent first, see ML 01 · Introduction to Machine Learning.

Background

Plain version. A classifier is a function that looks at a description of something and answers “which group does this belong to?”. We build it from examples whose answers we already know.

A pattern is an arrangement of descriptors that represents an object or region. A pattern class is a family of patterns that share some property. We write the WW classes as ω1,ω2,…,ωW\omega_1, \omega_2, \dots, \omega_W. Pattern recognition by machine means assigning each pattern to its class automatically and with as few mistakes as possible.

The work splits into two stages:

  1. Representation. Choose what to measure: pixel values, region descriptors, keypoint descriptors, or learned features. IP 12 covered this stage.
  2. Decision. Given the measurements, choose a class. This chapter covers this stage.

Methods are usually trained with supervised learning: we have a training set of patterns with known labels and use it to set the classifier’s parameters. We then measure performance on a separate test set that the classifier never saw. A third split, the validation set, is used to choose settings such as the network size or the stopping time. Mixing these sets up is the most common source of over-optimistic results.

A useful way to think about any classifier is through decision functions. For each class ωj\omega_j we define a function dj(x)d_j(\mathbf{x}) and assign x\mathbf{x} to the class with the largest value:

x∈ωiifdi(x)>dj(x)for all j≠i.\mathbf{x} \in \omega_i \quad \text{if} \quad d_i(\mathbf{x}) > d_j(\mathbf{x}) \quad \text{for all } j \neq i .

Here x\mathbf{x} is the pattern and djd_j is a scalar score for class ωj\omega_j. The decision boundary between classes ii and jj is the set where di(x)−dj(x)=0d_i(\mathbf{x}) - d_j(\mathbf{x}) = 0. Every classifier in this chapter, from the simplest to a deep network, is a particular way of building these functions.

Patterns and pattern classes

Plain version. We describe objects either with a list of numbers (a vector) or with a description of how their parts connect (a string or a tree).

Pattern vectors

The most common representation is a column vector of nn measurements:

x=[x1x2⋮xn],\mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} ,

where each xkx_k is one descriptor, such as the area of a region, its hue, a moment invariant or the response of a texture filter. A vector is a point in nn-dimensional feature space. Good features put patterns from the same class close together and patterns from different classes far apart. If the features are poor, no classifier can rescue them.

Two practical points matter here. First, features with different units need normalization; otherwise the one with the largest numeric range dominates any distance. In the fruit example, hue lies in [0,1][0, 1] while diameter is measured in centimetres, so we standardize each feature to zero mean and unit variance before comparing distances. Second, the whole image can itself be a pattern vector: an M×NM \times N image flattened into an MNMN-dimensional vector. This is how neural networks see images, and it is why they need so much data, because the space is enormous.

Optional: Structural patterns: strings and trees (in the Supplementary notes). Describing objects as strings and trees instead of vectors.

Pattern classification by prototype matching

Plain version. Keep one typical example of each class. To classify something new, see which typical example it looks most like.

Minimum-distance classifier

The simplest prototype is the mean vector of each class, computed from its training patterns:

mj=1nj∑x∈ωjx,j=1,2,…,W,\mathbf{m}_j = \frac{1}{n_j} \sum_{\mathbf{x} \in \omega_j} \mathbf{x}, \qquad j = 1, 2, \dots, W ,

where njn_j is the number of training patterns of class ωj\omega_j. A new pattern goes to the class whose mean is nearest in Euclidean distance, Dj(x)=∥x−mj∥D_j(\mathbf{x}) = \lVert \mathbf{x} - \mathbf{m}_j \rVert.

Minimizing Dj2=x⊤x−2x⊤mj+mj⊤mjD_j^2 = \mathbf{x}^\top\mathbf{x} - 2\mathbf{x}^\top \mathbf{m}_j + \mathbf{m}_j^\top \mathbf{m}_j over jj is the same as maximizing

dj(x)=x⊤mj−12 mj⊤mj,d_j(\mathbf{x}) = \mathbf{x}^\top \mathbf{m}_j - \tfrac{1}{2}\, \mathbf{m}_j^\top \mathbf{m}_j ,

because x⊤x\mathbf{x}^\top\mathbf{x} does not depend on jj. This djd_j is linear in x\mathbf{x}. The boundary between classes ii and jj is

di(x)−dj(x)=x⊤(mi−mj)−12(mi−mj)⊤(mi+mj)=0,d_i(\mathbf{x}) - d_j(\mathbf{x}) = \mathbf{x}^\top(\mathbf{m}_i - \mathbf{m}_j) - \tfrac{1}{2}(\mathbf{m}_i - \mathbf{m}_j)^\top(\mathbf{m}_i + \mathbf{m}_j) = 0 ,

which is the perpendicular bisector of the segment joining mi\mathbf{m}_i and mj\mathbf{m}_j: a line in 2-D, a plane in 3-D, a hyperplane in general. Figure 13.1 shows the result on our fruit data.

Scatter plot of apples, limes and oranges by hue and diameter, with class means as stars and straight decision boundaries
Figure 13.1 — Minimum-distance classification of synthetic fruit (hue, diameter). Stars are the class means; the boundaries are perpendicular bisectors between means (computed on standardized features).
Code · Python · 17 lines
import numpy as np

def fit_min_distance(X, y):
    """X: (n, d) pattern vectors, y: (n,) labels -> class list and mean vectors."""
    classes = np.unique(y)
    M = np.stack([X[y == c].mean(axis=0) for c in classes])
    return classes, M

def predict_min_distance(X, classes, M):
    d2 = ((X[:, None, :] - M[None, :, :]) ** 2).sum(axis=-1)  # (n, W) squared distances
    return classes[d2.argmin(axis=1)]

rng = np.random.default_rng(0)
X = np.r_[rng.normal([0, 0], 1, (100, 2)), rng.normal([4, 3], 1, (100, 2))]
y = np.repeat([0, 1], 100)
classes, M = fit_min_distance(X, y)
print("training accuracy:", (predict_min_distance(X, classes, M) == y).mean())

The classifier works well when classes are compact, roughly round blobs whose means are far apart compared with their spread. It fails when a class is elongated, curved or made of several clusters, because one mean cannot represent it. Two simple extensions help: keep several prototypes per class, or keep all training patterns and use the nearest one (the nearest-neighbor rule).

Matching by correlation (template matching)

When the prototype is a small image rather than a vector, we compare it with every position of a larger image. This is the 2-D version of prototype matching. Raw correlation ∑w f\sum w\,f is biased toward bright regions, so we use the normalized correlation coefficient:

γ(x,y)=∑s,t[w(s,t)−wˉ][f(x+s,y+t)−fˉxy]∑s,t[w(s,t)−wˉ]2  ∑s,t[f(x+s,y+t)−fˉxy]2,\gamma(x, y) = \frac{\sum_{s,t} \big[w(s,t) - \bar{w}\big]\big[f(x+s, y+t) - \bar{f}_{xy}\big]} {\sqrt{\sum_{s,t} \big[w(s,t) - \bar{w}\big]^2 \; \sum_{s,t} \big[f(x+s, y+t) - \bar{f}_{xy}\big]^2}} ,

where ww is the template, wˉ\bar{w} its mean, ff the image, and fˉxy\bar{f}_{xy} the mean of the image patch under the template when its corner is at (x,y)(x, y). The sums run over the template’s support. Because of the subtraction and the division, γ\gamma lies in [−1,1][-1, 1] and does not change if the patch’s brightness is scaled or offset. A value of 11 means a perfect match up to brightness and contrast. Note that this operation is correlation, not convolution: the template is not flipped (see ML 03 · Convolution, Image Filtering and CNNs).

A coin template, its normalized correlation map over the coins image, and detected matches drawn as red boxes
Figure 13.2 — Template matching on skimage's coins image. Left: one coin used as template. Middle: the correlation map, bright where the image looks like the template. Right: local maxima above 0.6.
Code · Python · 9 lines
import cv2
import numpy as np
from skimage import data

img = data.coins().astype(np.float32)
w = img[170:225, 180:235]                            # one coin as the template
R = cv2.matchTemplate(img, w, cv2.TM_CCOEFF_NORMED)  # values in [-1, 1]
y0, x0 = np.unravel_index(R.argmax(), R.shape)
print("best match at", (int(x0), int(y0)), "score", round(float(R.max()), 3))

Figure 13.2 also shows the method’s limits. The template finds almost every coin, because every coin is a bright disk of similar size on a dark background. It cannot tell one coin design from another at this resolution. Correlation is also sensitive to rotation and scale: a template rotated by 30° or enlarged by 30% may no longer produce a clear peak. The usual remedies are to search over a set of rotated and scaled templates, or to match invariant features instead of raw pixels.

Matching SIFT features

The scale-invariant feature transform (SIFT) from IP 12 [3] gives exactly those invariant features. Each keypoint has a location, scale, orientation and a 128-dimensional descriptor. To decide whether a prototype object appears in a scene image:

  1. Extract keypoints and descriptors from the prototype and from the scene.
  2. For each prototype descriptor, find its nearest and second-nearest scene descriptors in Euclidean distance.
  3. Accept the match only if the nearest distance is clearly smaller than the second-nearest, for example d1/d2<0.8d_1 / d_2 < 0.8. This ratio test [3] rejects ambiguous matches in repetitive texture.
  4. Check that the accepted matches agree on one geometric transformation (a similarity, affine or projective map). Matches that disagree are outliers.

The decision is then “object present” if enough geometrically consistent matches survive. This is still prototype matching: the prototype is the set of descriptors, and the “distance” is the number of consistent correspondences. It tolerates rotation, scale change, partial occlusion and moderate viewpoint change, which template matching cannot.

Optional: Matching structural prototypes (in the Supplementary notes). Shape-number similarity and string edit distance for structural prototypes.

Optimum (Bayes) statistical classifiers

Plain version. If we know how often each class occurs and what its measurements usually look like, there is a best possible rule: pick the class that is most probable given what we measured. No other rule makes fewer mistakes on average.

Derivation

In plain words: give every possible mistake a cost, and for each pattern choose the class whose expected cost is smallest.

Let p(ωk∣x)p(\omega_k \mid \mathbf{x}) be the probability that pattern x\mathbf{x} comes from class ωk\omega_k. Let LkjL_{kj} be the loss incurred when a pattern that truly belongs to ωk\omega_k is assigned to ωj\omega_j. The expected loss of choosing class ωj\omega_j, called the conditional risk, is

rj(x)=∑k=1WLkj p(ωk∣x).r_j(\mathbf{x}) = \sum_{k=1}^{W} L_{kj}\, p(\omega_k \mid \mathbf{x}) .

Bayes’ rule, p(ωk∣x)=p(x∣ωk) P(ωk)/p(x)p(\omega_k \mid \mathbf{x}) = p(\mathbf{x} \mid \omega_k)\, P(\omega_k) / p(\mathbf{x}), rewrites this in terms of the class-conditional density p(x∣ωk)p(\mathbf{x} \mid \omega_k) (what patterns of class ωk\omega_k look like) and the prior P(ωk)P(\omega_k) (how common the class is). The factor 1/p(x)1/p(\mathbf{x}) is the same for every jj, so it can be dropped when comparing risks.

The classifier that picks the jj with the smallest rj(x)r_j(\mathbf{x}) for every x\mathbf{x} minimizes the total average loss. That is why it is called optimal: it is the best any rule can do, given the true distributions. With the common 0–1 loss (Lkj=0L_{kj} = 0 if k=jk = j, otherwise 11), every error costs the same and

rj(x)∝p(x)−p(x∣ωj)P(ωj).r_j(\mathbf{x}) \propto p(\mathbf{x}) - p(\mathbf{x} \mid \omega_j)P(\omega_j) .

Minimizing it means maximizing the decision function

dj(x)=p(x∣ωj) P(ωj).d_j(\mathbf{x}) = p(\mathbf{x} \mid \omega_j)\, P(\omega_j) .

In words: choose the class with the largest posterior probability. The catch is that we never know the true densities. We must estimate them from training data, and the classifier is only as good as those estimates.

Bayes classifier for Gaussian pattern classes

In plain words: if the measurements of each class form a bell-shaped cloud, the optimal rule becomes an explicit formula in each cloud’s centre and spread.

Assume each class is a multivariate Gaussian with mean mj\mathbf{m}_j and covariance matrix Cj\mathbf{C}_j:

p(x∣ωj)=1(2π)n/2∣Cj∣1/2exp⁡ ⁣[−12(x−mj)⊤Cj−1(x−mj)],p(\mathbf{x} \mid \omega_j) = \frac{1}{(2\pi)^{n/2} \lvert \mathbf{C}_j \rvert^{1/2}} \exp\!\Big[-\tfrac{1}{2}(\mathbf{x} - \mathbf{m}_j)^\top \mathbf{C}_j^{-1} (\mathbf{x} - \mathbf{m}_j)\Big] ,

where nn is the dimension of x\mathbf{x} and ∣Cj∣\lvert \mathbf{C}_j \rvert the determinant of Cj\mathbf{C}_j. Because the logarithm is increasing, we can maximize ln⁡dj\ln d_j instead and drop the constant n2ln⁡2π\tfrac{n}{2}\ln 2\pi:

dj(x)=ln⁡P(ωj)−12ln⁡∣Cj∣−12(x−mj)⊤Cj−1(x−mj).d_j(\mathbf{x}) = \ln P(\omega_j) - \tfrac{1}{2}\ln \lvert \mathbf{C}_j \rvert - \tfrac{1}{2}(\mathbf{x} - \mathbf{m}_j)^\top \mathbf{C}_j^{-1} (\mathbf{x} - \mathbf{m}_j) .

The last term is half the squared Mahalanobis distance, a distance that stretches space so that each class’s spread looks round. This djd_j is quadratic in x\mathbf{x}, so boundaries between classes are quadrics: ellipses, parabolas or hyperbolas in 2-D. Two special cases connect back to earlier sections:

  • Equal covariances (Cj=C\mathbf{C}_j = \mathbf{C} for all jj). The quadratic term x⊤C−1x\mathbf{x}^\top \mathbf{C}^{-1} \mathbf{x} is common to all classes and cancels, leaving a linear function dj(x)=ln⁡P(ωj)+x⊤C−1mj−12mj⊤C−1mjd_j(\mathbf{x}) = \ln P(\omega_j) + \mathbf{x}^\top \mathbf{C}^{-1} \mathbf{m}_j - \tfrac{1}{2}\mathbf{m}_j^\top \mathbf{C}^{-1} \mathbf{m}_j. Boundaries become hyperplanes.
  • Identity covariance and equal priors (C=I\mathbf{C} = \mathbf{I}, P(ωj)=1/WP(\omega_j) = 1/W). The function reduces to x⊤mj−12mj⊤mj\mathbf{x}^\top \mathbf{m}_j - \tfrac{1}{2}\mathbf{m}_j^\top \mathbf{m}_j: the minimum-distance classifier. So minimum distance is the Bayes-optimal rule for round, equally spread, equally likely Gaussian classes, and only then.
Two panels of Gaussian point clouds with the Bayes decision boundary: a straight line when covariances are equal, a curved line when they differ
Figure 13.3 — Bayes decision boundaries (thick black) for two Gaussian classes. Thin contours show each class density. Left: equal covariances give a straight line. Right: unequal covariances give a curved (quadratic) boundary that wraps around the tighter class.

Estimating mj\mathbf{m}_j and Cj\mathbf{C}_j from samples is easy: the sample mean and sample covariance. The priors can be the class frequencies in the training set, if those reflect reality.

Code · Python · 20 lines
import numpy as np

class GaussianBayes:
    def fit(self, X, y):
        self.classes = np.unique(y)
        self.m = [X[y == c].mean(0) for c in self.classes]
        self.C = [np.cov(X[y == c].T) for c in self.classes]
        self.logP = [np.log((y == c).mean()) for c in self.classes]
        return self

    def decision(self, X):
        scores = []
        for m, C, lp in zip(self.m, self.C, self.logP):
            d = X - m
            maha = np.einsum("ni,ij,nj->n", d, np.linalg.inv(C), d)
            scores.append(lp - 0.5 * np.linalg.slogdet(C)[1] - 0.5 * maha)
        return np.stack(scores, axis=1)            # (n, W): one d_j(x) per class

    def predict(self, X):
        return self.classes[self.decision(X).argmax(1)]

The number of covariance parameters grows as n(n+1)/2n(n+1)/2 per class. With 4 features that is 10 numbers per class, easily estimated. With 1,000 features it is about half a million, and the estimate becomes unreliable unless there is a huge amount of data. This is one reason the Gaussian Bayes classifier works best on short, well-chosen feature vectors.

Application: classifying pixels in a multispectral image

Remote-sensing satellites record each ground location in several spectral bands. Each pixel is then a natural pattern vector, x=(xblue,xgreen,xred,xNIR)⊤\mathbf{x} = (x_{\text{blue}}, x_{\text{green}}, x_{\text{red}}, x_{\text{NIR}})^\top, where NIR is near-infrared. Healthy vegetation reflects strongly in NIR and weakly in red; water is dark in NIR; built-up areas are moderately bright everywhere.

We built a synthetic 128×128128 \times 128 scene with three classes (water, vegetation, built-up), gave each class a mean reflectance in four bands, and added independent Gaussian noise with standard deviation 0.060.06 to every band. We picked only 50 random pixels per class as training data, estimated mj\mathbf{m}_j and Cj\mathbf{C}_j, and classified every pixel with the Gaussian Bayes rule.

Ground-truth map, noisy red band, noisy near-infrared band, and the Bayes classification map
Figure 13.4 — Bayes classification of a synthetic four-band scene. Single bands are noisy and ambiguous (red barely separates water from vegetation), but the four-dimensional pattern vector separates the classes well: 98.8% of pixels are labelled correctly from only 150 training pixels.

Two lessons stand out. First, no single band is enough: in the red band, water and vegetation have similar values. The combination of bands separates them. Second, the remaining errors are isolated pixels. The Bayes rule here treats each pixel independently and ignores neighbors. Adding spatial context, for example by smoothing the decision scores or using a classifier that sees a neighborhood, removes most of those errors. That observation leads naturally to convolutional networks.

Neural networks and deep learning

Plain version. A neural network is a stack of very simple units. Each unit adds up its inputs with weights, then decides how strongly to “fire”. By nudging the weights after each mistake, the network learns a decision rule on its own, without our writing down the probability distributions.

Background

The Bayes classifier needs density estimates, which are hard to get in high dimensions. An alternative is to learn the decision functions directly from training data. Neural networks do this with many simple, adjustable computing elements arranged in layers. The idea goes back to the perceptron of the late 1950s [4]. It became practical for multilayer networks once backpropagation was popularized in 1986 [5], and it became dominant for images after deep convolutional networks won the ImageNet challenge in 2012 [7]. For a fuller treatment of perceptrons, MLPs, activation functions and training tricks, see ML 02 · Neural Networks.

The perceptron

A perceptron computes a weighted sum of its inputs plus a bias and outputs the sign:

d(x)=w⊤x+w0=∑k=1nwkxk+w0,class={ω1d(x)>0ω2d(x)≤0d(\mathbf{x}) = \mathbf{w}^\top \mathbf{x} + w_0 = \sum_{k=1}^{n} w_k x_k + w_0, \qquad \text{class} = \begin{cases} \omega_1 & d(\mathbf{x}) > 0 \\ \omega_2 & d(\mathbf{x}) \le 0 \end{cases}

where w=(w1,…,wn)⊤\mathbf{w} = (w_1, \dots, w_n)^\top are the weights and w0w_0 is the bias. The boundary d(x)=0d(\mathbf{x}) = 0 is a hyperplane. To simplify notation, append a constant 11 to every pattern, y=(x1,…,xn,1)⊤\mathbf{y} = (x_1, \dots, x_n, 1)^\top, and fold the bias into the weights, w=(w1,…,wn,w0)⊤\mathbf{w} = (w_1, \dots, w_n, w_0)^\top, so that d=w⊤yd = \mathbf{w}^\top \mathbf{y}.

Learning rule. Encode the label as t=+1t = +1 for ω1\omega_1 and t=−1t = -1 for ω2\omega_2. Present the training patterns one at a time. At step kk:

w(k+1)={w(k)+α t y(k)if t w(k)⊤y(k)≤0 (misclassified)w(k)otherwise,\mathbf{w}(k+1) = \begin{cases} \mathbf{w}(k) + \alpha\, t\, \mathbf{y}(k) & \text{if } t\, \mathbf{w}(k)^\top \mathbf{y}(k) \le 0 \ \text{(misclassified)} \\ \mathbf{w}(k) & \text{otherwise,} \end{cases}

where α>0\alpha > 0 is the learning rate. Each correction moves the hyperplane so that the offending pattern is pushed toward its correct side: after the update, t w⊤yt\,\mathbf{w}^\top\mathbf{y} increases by α∥y∥2\alpha \lVert \mathbf{y} \rVert^2. If the two classes are linearly separable, this procedure is guaranteed to stop after a finite number of corrections with a separating hyperplane. If they are not, it never settles. In that case we instead minimize a smooth error, such as the squared difference between w⊤y\mathbf{w}^\top \mathbf{y} and tt, by gradient descent (the least-mean-squares, or delta, rule). That idea leads directly to backpropagation.

Four panels showing a perceptron's line rotating toward the correct separation after each mistake
Figure 13.5 — Perceptron training on two separable classes. The circled point is the misclassified pattern that triggered the update. After six corrections the line separates the classes and learning stops.
Code · Python · 15 lines
import numpy as np

def train_perceptron(X, y, alpha=0.5, epochs=100):
    """X: (n, d), y in {-1, +1}. Returns augmented weights (w_1..w_d, w_0)."""
    Xa = np.c_[X, np.ones(len(X))]                 # append the constant input 1
    w = np.zeros(Xa.shape[1])
    for _ in range(epochs):
        mistakes = 0
        for xi, yi in zip(Xa, y):
            if yi * (w @ xi) <= 0:                 # wrong side (or on the line)
                w += alpha * yi * xi
                mistakes += 1
        if mistakes == 0:                          # a full clean pass: converged
            break
    return w

A single perceptron can only draw one hyperplane. It cannot solve XOR, where the two classes sit on opposite corners of a square. To draw curved or multi-piece boundaries we need more layers.

Multilayer feedforward networks

A multilayer feedforward network (or multilayer perceptron, MLP) stacks layers of units. Layer ℓ\ell receives the outputs of layer ℓ−1\ell - 1, and nothing flows backward during prediction. Unlike the perceptron, each unit passes its weighted sum through a smooth, differentiable activation function hh, such as the sigmoid h(z)=1/(1+e−z)h(z) = 1/(1+e^{-z}), the hyperbolic tangent, or the rectified linear unit ReLU(z)=max⁡(0,z)\text{ReLU}(z) = \max(0, z). Smoothness is what makes gradient-based training possible. Nonlinearity is what makes depth useful: a stack of purely linear layers collapses into one linear layer.

With two hidden layers and enough units, a network can form decision regions of essentially any shape. In practice the question is not whether a network can represent a boundary, but whether training will find it from the data available.

Forward pass

In plain words: each layer multiplies its input by a weight matrix, adds a bias and applies the activation; the last layer turns its scores into class probabilities.

Number the layers ℓ=1,…,L\ell = 1, \dots, L, with layer 00 being the input a(0)=x\mathbf{a}^{(0)} = \mathbf{x}. For each layer,

z(ℓ)=W(ℓ)a(ℓ−1)+b(ℓ),a(ℓ)=h(z(ℓ)),\mathbf{z}^{(\ell)} = \mathbf{W}^{(\ell)} \mathbf{a}^{(\ell-1)} + \mathbf{b}^{(\ell)}, \qquad \mathbf{a}^{(\ell)} = h\big(\mathbf{z}^{(\ell)}\big),

where W(ℓ)\mathbf{W}^{(\ell)} is the weight matrix (row ii holds the weights into unit ii), b(ℓ)\mathbf{b}^{(\ell)} the bias vector, z(ℓ)\mathbf{z}^{(\ell)} the net inputs and a(ℓ)\mathbf{a}^{(\ell)} the activations, with hh applied element by element. For a WW-class problem the output layer has WW units. Its net inputs are turned into probabilities with the softmax function,

pj=ezj(L)∑i=1Wezi(L),j=1,…,W,p_j = \frac{e^{z_j^{(L)}}}{\sum_{i=1}^{W} e^{z_i^{(L)}}}, \qquad j = 1, \dots, W ,

and the predicted class is the one with the largest pjp_j. Notice that the output layer is a set of decision functions dj(x)=zj(L)d_j(\mathbf{x}) = z^{(L)}_j, exactly as in the Background section. The hidden layers compute features in which those simple, linear decision functions suffice.

Backpropagation

Training adjusts all weights to reduce a loss EE that measures how wrong the outputs are. For classification the standard choice is the cross-entropy E=−∑jtjln⁡pjE = -\sum_j t_j \ln p_j, where t\mathbf{t} is the one-hot label (1 for the true class, 0 elsewhere). For a sigmoid output the classic alternative is the squared error E=12∥a(L)−t∥2E = \tfrac{1}{2}\lVert \mathbf{a}^{(L)} - \mathbf{t} \rVert^2. We need ∂E/∂W(ℓ)\partial E / \partial \mathbf{W}^{(\ell)} for every layer. Backpropagation computes all of them with one backward sweep of the chain rule [5].

In plain words: backpropagation sends the output error backward through the network, layer by layer, and the gradient of each weight is “the error arriving at its output end” times “the activation at its input end”. Define the error signal of layer ℓ\ell as δ(ℓ)=∂E/∂z(ℓ)\boldsymbol{\delta}^{(\ell)} = \partial E / \partial \mathbf{z}^{(\ell)}. For softmax with cross-entropy the output signal is simply δ(L)=p−t\boldsymbol{\delta}^{(L)} = \mathbf{p} - \mathbf{t}. Each earlier signal is the next one passed back through the transposed weights and multiplied by the activation’s derivative; the gradient of W(ℓ)\mathbf{W}^{(\ell)} is δ(ℓ)a(ℓ−1)⊤\boldsymbol{\delta}^{(\ell)}\mathbf{a}^{(\ell-1)\top}, and gradient descent then updates every weight with a learning rate α\alpha. The backward pass costs about as much as the forward pass, which is why networks with millions of weights can be trained at all. The perceptron learning rule [4] is a separate mistake-driven update, not ordinary backpropagation through a hard step: the step derivative is zero away from its threshold and undefined at the threshold. Differentiable activations let the chain rule in [5] supply useful gradients.

Optional: Backpropagation step by step (in the Supplementary notes). The four steps with every equation, including the squared-error variant.

Training

In practice we average the gradient over a small random mini-batch of training patterns, update, and repeat. This is stochastic gradient descent (SGD). One pass through the whole training set is an epoch. Training runs for many epochs while we watch the loss on the validation set. The learning rate is the most important setting: too large and the loss oscillates or explodes; too small and training crawls. Weights must start as small random numbers, not zeros, or all units in a layer would compute the same thing and receive the same updates forever.

The following NumPy program trains a two-layer network on XOR, the problem a single perceptron cannot solve:

Code · Python · 22 lines
import numpy as np

rng = np.random.default_rng(0)
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], float)
y = np.array([[0], [1], [1], [0]], float)         # XOR: not linearly separable

W1, b1 = rng.normal(0, 1, (2, 8)), np.zeros(8)    # input -> 8 hidden units
W2, b2 = rng.normal(0, 1, (8, 1)), np.zeros(1)    # hidden -> 1 output
sig = lambda z: 1 / (1 + np.exp(-z))
alpha = 1.0

for step in range(5000):
    # forward pass
    a1 = np.tanh(X @ W1 + b1)
    out = sig(a1 @ W2 + b2)
    # backward pass (cross-entropy loss with a sigmoid output)
    d2 = (out - y) / len(X)                        # delta at the output layer
    d1 = (d2 @ W2.T) * (1 - a1 ** 2)               # delta at the hidden layer
    W2 -= alpha * a1.T @ d2;  b2 -= alpha * d2.sum(0)
    W1 -= alpha * X.T @ d1;   b1 -= alpha * d1.sum(0)

print(out.round(3).ravel())                        # close to [0, 1, 1, 0]

(Here patterns are rows, so the matrix products are transposed relative to the equations above.)

Deep convolutional neural networks

Plain version. Instead of telling the network which features to measure, we let it slide small learnable filters over the image, exactly like the filters of IP 03, and learn which filters help it classify. Early layers end up finding edges and blobs; later layers combine them into parts and whole objects.

Why fully connected networks struggle with images

Feed a 20×2020 \times 20 image into a fully connected layer with 2,048 hidden units, and that one layer has 400×2048=819,200400 \times 2048 = 819{,}200 weights. The layer also ignores the fact that nearby pixels are related and that a “3” shifted two pixels to the right is still a “3”. A CNN builds both facts into its structure [6].

Convolutional layers

A convolutional layer applies FF small kernels (for example 5×55 \times 5) to its input. With CC input channels aca_c, the net input of output channel ff at pixel (x,y)(x, y) is

zf(x,y)=∑c=1C∑s,twf,c(s,t) ac(x+s,y+t)+bf,z_f(x, y) = \sum_{c=1}^{C} \sum_{s,t} w_{f,c}(s, t)\, a_c(x+s, y+t) + b_f ,

followed by an activation, usually ReLU: af(x,y)=max⁡(0,zf(x,y))a_f(x,y) = \max(0, z_f(x,y)). The sum is a spatial correlation, as in IP 03, but the kernel values wf,cw_{f,c} are learned. Each output channel is a feature map: it is large where its kernel’s pattern appears. Two ideas cut the parameter count dramatically:

  • Local connectivity. Each output depends only on a small neighborhood (its receptive field).
  • Weight sharing. The same kernel is used at every position, so a feature learned in one place is detected everywhere.

Eight 5×55 \times 5 kernels on a single-channel image need 8×25+8=2088 \times 25 + 8 = 208 parameters, against the 819,200 above.

Pooling layers

A pooling layer shrinks each feature map, typically by taking the maximum (max-pooling) or average of each non-overlapping 2×22 \times 2 block. It halves the width and height, makes the response tolerant to small shifts, and enlarges the receptive field of later layers. Stacking convolution and pooling several times yields features that respond to larger and more abstract structures.

Fully connected layers and the whole pipeline

After the last pooling layer the feature maps are flattened into one vector and passed through one or more fully connected layers ending in a softmax. Figure 13.6 shows the small network we trained.

Diagram of a CNN: input 20x20, eight 5x5 convolution maps of 16x16, max-pooling to 8x8x8, flatten to 512 values, a fully connected layer to 10 scores, softmax
Figure 13.6 — The tiny CNN used in this chapter. The convolution and pooling layers form a learned feature extractor; the fully connected layer is a learned linear classifier on those features.

This is the key conceptual point of the chapter. The classical pipeline was hand-designed features → classifier. A CNN is learned features → classifier, with both parts trained together by backpropagation to minimize the same loss. The fully connected softmax layer at the end is just a set of linear decision functions, the same object we met in the minimum-distance and equal-covariance Bayes classifiers. What changed is that the space in which those linear functions operate is itself learned.

Training a CNN

Backpropagation works unchanged; only the local derivatives differ. A shared kernel weight collects its gradient from every position where it was used, max-pooling passes the gradient only to the input that was the maximum, and ReLU passes it only where its input was positive.

Optional: Gradients through convolution, pooling and ReLU (in the Supplementary notes). The local derivative of each CNN layer, written out.

Here is the forward pass of one convolution, ReLU and pooling stage with SciPy:

Code · Python · 9 lines
import numpy as np
from scipy.signal import correlate2d
from skimage import data, transform

img = transform.resize(data.camera(), (64, 64), anti_aliasing=True)
k = np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], float)    # one 3x3 "filter"
fmap = np.maximum(correlate2d(img, k, mode="valid") + 0.0, 0)  # conv + bias + ReLU
pooled = fmap[:62, :62].reshape(31, 2, 31, 2).max(axis=(1, 3))  # 2x2 max-pooling
print(img.shape, "->", fmap.shape, "->", pooled.shape)

Worked example: digits

The classic test bed for CNNs is handwritten digit recognition, where LeNet-style networks were developed on the MNIST digits [6]. To keep everything self-contained and reproducible, we generate MNIST-like 20×2020 \times 20 digits: each digit 0–9 is drawn with one of six OpenCV fonts at a random size, stroke width, shift and rotation (±15°), then noise is added (Figure 13.7).

Twenty small grayscale images of digits 0 to 9 in different fonts, sizes and angles
Figure 13.7 — Synthetic training digits. Variation in font, size, position and angle forces the classifier to learn shape rather than memorize pixels.

The network of Figure 13.6 (eight 5×55 \times 5 filters, ReLU, 2×22 \times 2 max-pooling, a fully connected layer to 10 outputs, softmax with cross-entropy) is written in about 80 lines of NumPy in scripts/figures/dip_ch13.py. We trained it with mini-batch SGD (batch size 32, learning rate 0.05, small weight decay) on 3,000 digits for 12 epochs. It reached 98.5% accuracy on 1,000 separate validation digits. Figure 13.8 shows what it learned.

A digit 3, eight learned 5x5 filters shown in red and blue, and the eight feature maps they produce
Figure 13.8 — Inside the trained CNN. Top: the eight learned 5×5 kernels (red positive, blue negative). Bottom: their ReLU feature maps for the input digit. Several kernels act as oriented edge or stroke detectors, similar to the hand-designed gradient filters of IP 10.

Nobody told the network to detect edges. Oriented, edge-like kernels emerge because they are useful for telling digits apart. Large networks trained on natural images show the same behavior in their first layer, with progressively more complex patterns in deeper layers.

Some additional details of implementation

Plain version. A network that memorizes its homework can still fail the exam. Most of the practical craft of training is about making it learn the general rule instead of the specific examples.

Overfitting

A network with many parameters and few training examples can drive its training error to zero by memorizing. Its error on new data then stays high. This gap between training and validation performance is overfitting. Figure 13.9 (left) shows it clearly: trained on only 150 digits, the CNN reaches 100% training accuracy but only 86.2% validation accuracy.

The basic defenses:

  • More data. Nothing helps as reliably. Data augmentation (below) is a cheap way to get more.
  • A validation set and early stopping. Track validation accuracy and keep the weights from the best epoch.
  • Smaller or better-structured models. Weight sharing in CNNs is itself a strong regularizer compared with fully connected layers.

Data augmentation

Data augmentation creates new training examples by applying label-preserving transformations: small shifts, rotations, scaling, flips (where they make sense: a flipped “cat” is still a cat, but a flipped “b” becomes a “d”), crops, brightness and contrast changes, and added noise [18]. Each epoch sees a slightly different version of each image, so memorizing is harder and invariance to those transformations is learned from data.

Two training curves: without augmentation training accuracy reaches 1.0 while validation stays near 0.86; with augmentation the curves stay close and validation reaches about 0.91
Figure 13.9 — The same CNN trained on only 150 synthetic digits for 60 epochs. Left: without augmentation, a large train–validation gap opens (overfitting). Right: random shifts, rotations and scaling keep the curves together, and final validation accuracy rises from 86.2% to 91.3%.

Regularization

Regularization adds a preference for simpler solutions:

  • Weight decay (L2L_2 regularization) adds λ2∑w2\tfrac{\lambda}{2}\sum w^2 to the loss, which adds λw\lambda w to every weight’s gradient and shrinks weights toward zero. Our training script uses λ=10−4\lambda = 10^{-4}.
  • Dropout randomly sets a fraction of the units to zero at each training step, so no unit can rely on specific partners. At test time all units are used, with appropriately scaled weights. This behaves like averaging an ensemble of many thinned networks [17].

Other practical details matter just as much: normalizing inputs (zero mean, unit variance), initializing weights with a variance scaled to the number of inputs (so activations neither explode nor vanish through the layers), lowering the learning rate during training, and always reporting final results on a test set that was not used for any decision during development.

Modern view

The textbook chapter ends where modern image classification begins. Six survey and review papers map how the field has moved since.

Statistical pattern recognition before deep learning. Jain, Duin and Mao’s review [2] maps the classical territory, from representation and feature selection to classifiers, classifier combination and error estimation. Its main takeaway, that the feature representation and the evaluation protocol matter more than the choice of classifier, aged well: deep learning automated the representation part.

The CNN era. Rawat and Wang [11] review CNNs for image classification up to 2017. The line runs from LeCun et al.’s gradient-trained networks for document recognition [6] through AlexNet [7], winner of the ImageNet challenge in 2012 [10], to VGG [8] and ResNet [9], whose identity shortcuts made very deep networks trainable. Each is still recognizably the architecture of Figure 13.6.

Transformers in vision. The Vision Transformer (ViT) [12] treats image patches as tokens and replaces convolution with self-attention; Khan et al. [13] survey its many variants, and ConvNeXt [14] showed that a modernized pure CNN is competitive again. The practical lesson: architecture families matter less than training data, scale and recipe.

Foundation features and zero-shot classification. CLIP [15] trains an image encoder and a text encoder together, so a classifier can be built without labelled images by comparing each image with text prompts such as a photo of a {class}: a minimum-distance classifier whose prototypes come from language. DINOv2 [16] learns general-purpose features by self-supervision, and a linear layer or a nearest-neighbor rule on its frozen features classifies well. The expensive feature extractor is trained once; the classifier on top is often one of this chapter’s simple rules.

Data augmentation. Shorten and Khoshgoftaar’s survey [18] sorts augmentation methods into basic image manipulations and learned approaches. Its takeaway matches Figure 13.9: augmentation is one of the cheapest and most effective ways to reduce overfitting when labelled data are limited.

Evaluation pitfalls and dataset bias. Torralba and Efros [19] showed that a classifier can tell which dataset an image came from, and Liu and He [20] found that this still holds for modern networks and web-scale datasets. Accuracy on one benchmark is a statement about that benchmark; whenever possible, test on data collected independently of the training data.

Optional: Guide to the Modern view papers (in the Paper guides). What each review and study covers, how it organizes the field, and what it found.

What changed and what did not. Deep learning replaced hand-crafted features and made the classifier itself almost an afterthought: a linear softmax layer. It did not change the decision-theoretic foundations. The softmax output is trained to estimate posterior probabilities, so the network approximates the Bayes rule. Cross-entropy is the negative log-likelihood. Prototype matching survives as nearest-neighbor search in embedding spaces, used in zero-shot classification and retrieval. Template matching by normalized correlation is still the right tool in controlled industrial inspection, where the object’s appearance is fixed and training data are scarce. Understanding the classical methods tells you what the modern ones are optimizing and when a simpler method is enough.

Key takeaways

  • Classification assigns a label to a pattern via decision functions dj(x)d_j(\mathbf{x}); the boundaries are where two decision functions are equal.
  • Minimum-distance classification uses class means as prototypes; its boundaries are perpendicular bisectors. Normalized correlation and SIFT matching are prototype matching for images and keypoints.
  • The Bayes classifier minimizes the average loss. For Gaussian classes it is quadratic; with equal covariances it is linear; with identity covariance and equal priors it reduces to minimum distance.
  • A perceptron learns a separating hyperplane by correcting mistakes. Multilayer networks with smooth activations learn nonlinear boundaries, and backpropagation computes all gradients in one backward pass.
  • A CNN is a learned feature extractor (convolution, nonlinearity, pooling) followed by a learned linear classifier. Weight sharing makes it efficient and shift-tolerant.
  • Overfitting is the central practical risk. Use validation data, data augmentation, weight decay and dropout, and keep the test set untouched.
  • Modern systems often pair a large pre-trained feature extractor (CLIP, DINOv2) with a very simple classifier. Benchmark accuracy reflects dataset biases, so test on independently collected data.

Exercises

  1. Bisector by hand. Two class means are m1=(1,2)⊤\mathbf{m}_1 = (1, 2)^\top and m2=(5,4)⊤\mathbf{m}_2 = (5, 4)^\top. Write the minimum-distance boundary d1(x)−d2(x)=0d_1(\mathbf{x}) - d_2(\mathbf{x}) = 0 as an equation in x1,x2x_1, x_2, and verify that the midpoint of the two means lies on it.
Hint

m1−m2=(−4,−2)⊤\mathbf{m}_1 - \mathbf{m}_2 = (-4, -2)^\top and 12(m1−m2)⊤(m1+m2)=12(−4⋅6−2⋅6)=−18\tfrac{1}{2}(\mathbf{m}_1 - \mathbf{m}_2)^\top(\mathbf{m}_1 + \mathbf{m}_2) = \tfrac{1}{2}(-4 \cdot 6 - 2 \cdot 6) = -18. The boundary is −4x1−2x2+18=0-4x_1 - 2x_2 + 18 = 0, i.e. 2x1+x2=92x_1 + x_2 = 9. The midpoint (3,3)(3, 3) gives 6+3=96 + 3 = 9. ✓

  1. When priors matter. In a one-dimensional problem, class ω1\omega_1 is Gaussian with mean 0 and class ω2\omega_2 with mean 4, both with variance 1. Find the Bayes threshold when P(ω1)=P(ω2)P(\omega_1) = P(\omega_2), and when P(ω1)=0.9P(\omega_1) = 0.9. In which direction does the threshold move, and why does that make sense?
Hint

Set ln⁡P1−12x2=ln⁡P2−12(x−4)2\ln P_1 - \tfrac{1}{2}x^2 = \ln P_2 - \tfrac{1}{2}(x-4)^2. This gives x=2+14ln⁡(P1/P2)x = 2 + \tfrac{1}{4}\ln(P_1/P_2). Equal priors give x=2x = 2; P1=0.9P_1 = 0.9 gives x=2+14ln⁡9≈2.55x = 2 + \tfrac{1}{4}\ln 9 \approx 2.55. The threshold moves toward the rarer class, so more ambiguous patterns go to the common class.

  1. Correlation invariance. Show that the normalized correlation coefficient γ\gamma is unchanged if every pixel of the image patch is replaced by af+ba f + b with a>0a > 0. What happens if a<0a \lt 0? Then test it with cv2.matchTemplate on skimage.data.camera().
Hint

Subtracting the mean removes bb. The factor aa appears once in the numerator and as a2=∣a∣\sqrt{a^2} = \lvert a \rvert in the denominator, so it cancels for a>0a > 0. For a<0a \lt 0 (a photographic negative) the sign of γ\gamma flips: a perfect match becomes −1-1.

  1. A perceptron that never stops. Generate two overlapping Gaussian clouds and run the perceptron rule from this chapter for 100 epochs. Plot the number of mistakes per epoch. Then replace the rule by gradient descent on the squared error 12∑(w⊤y−t)2\tfrac{1}{2}\sum (\mathbf{w}^\top \mathbf{y} - t)^2 and compare the two learning curves.
Hint

The perceptron’s mistake count keeps fluctuating, because every mistake moves the line, even when no line can be perfect. The least-squares rule converges to a fixed compromise line, since its loss is smooth and convex.

  1. Counting parameters. A network takes 64×6464 \times 64 grayscale images. Compare the number of weights (including biases) in (a) a fully connected layer with 1,024 hidden units and (b) a convolutional layer with 32 kernels of size 3×33 \times 3. How many outputs does (b) produce without padding?
Hint

(a) 4096×1024+1024=4,195,3284096 \times 1024 + 1024 = 4{,}195{,}328. (b) 32×9+32=32032 \times 9 + 32 = 320 parameters, producing 3232 maps of 62×6262 \times 62, i.e. 123,008123{,}008 outputs. Few parameters, many outputs: that is weight sharing.

  1. Augmentation that hurts. Using the digit generator in scripts/figures/dip_ch13.py, add random 180° rotation to the augmentation. Retrain and inspect the confusion between which digits rises the most. Explain why.
Hint

A “6” rotated by 180° looks like a “9” (and “0”, “1”, “8” look like themselves). The augmentation is no longer label-preserving, so the network is taught contradictory labels for the same shape. Expect the 6/9 confusion to rise sharply.

Supplementary notes

4 supplementary notes, each on a page of its own; the main text does not depend on them.

Open the notes →

Paper guides

1 paper guide, each on a page of its own.

Open the paper guides →

References

  1. R. C. Gonzalez and R. E. Woods, Digital Image Processing, 4th ed., Pearson, 2018, Ch. 13. publisher page
  2. A. K. Jain, R. P. W. Duin, and J. Mao, “Statistical Pattern Recognition: A Review,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 22, no. 1, pp. 4–37, 2000. doi:10.1109/34.824819
  3. D. G. Lowe, “Distinctive Image Features from Scale-Invariant Keypoints,” International Journal of Computer Vision, vol. 60, 2004. doi:10.1023/B:VISI.0000029664.99615.94
  4. F. Rosenblatt, “The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain,” Psychological Review, vol. 65, 1958. doi:10.1037/h0042519
  5. D. E. Rumelhart, G. E. Hinton, and R. J. Williams, “Learning Representations by Back-Propagating Errors,” Nature, vol. 323, 1986. doi:10.1038/323533a0
  6. Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-Based Learning Applied to Document Recognition,” Proceedings of the IEEE, vol. 86, 1998. doi:10.1109/5.726791
  7. A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet Classification with Deep Convolutional Neural Networks,” Advances in Neural Information Processing Systems 25 (NIPS), 2012. paper
  8. K. Simonyan and A. Zisserman, “Very Deep Convolutional Networks for Large-Scale Image Recognition,” arXiv:1409.1556, 2014. arXiv
  9. K. He, X. Zhang, S. Ren, and J. Sun, “Deep Residual Learning for Image Recognition,” arXiv:1512.03385, 2015. arXiv
  10. O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, et al., “ImageNet Large Scale Visual Recognition Challenge,” arXiv:1409.0575, 2014. arXiv
  11. W. Rawat and Z. Wang, “Deep Convolutional Neural Networks for Image Classification: A Comprehensive Review,” Neural Computation, vol. 29, no. 9, 2017. doi:10.1162/neco_a_00990
  12. A. Dosovitskiy, L. Beyer, A. Kolesnikov, et al., “An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale,” ICLR, 2021. arXiv
  13. S. Khan, M. Naseer, M. Hayat, S. W. Zamir, F. S. Khan, and M. Shah, “Transformers in Vision: A Survey,” ACM Computing Surveys, 2022. arXiv
  14. Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell, and S. Xie, “A ConvNet for the 2020s,” CVPR, 2022. arXiv
  15. A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, et al., “Learning Transferable Visual Models From Natural Language Supervision,” arXiv:2103.00020, 2021. arXiv
  16. M. Oquab, T. Darcet, T. Moutakanni, et al., “DINOv2: Learning Robust Visual Features without Supervision,” arXiv:2304.07193, 2023. arXiv
  17. N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov, “Dropout: A Simple Way to Prevent Neural Networks from Overfitting,” Journal of Machine Learning Research, vol. 15, pp. 1929–1958, 2014. JMLR
  18. C. Shorten and T. M. Khoshgoftaar, “A Survey on Image Data Augmentation for Deep Learning,” Journal of Big Data, vol. 6, 2019. doi:10.1186/s40537-019-0197-0
  19. A. Torralba and A. A. Efros, “Unbiased Look at Dataset Bias,” CVPR, 2011. paper page
  20. Z. Liu and K. He, “A Decade’s Battle on Dataset Bias: Are We There Yet?,” ICLR, 2025. arXiv

Check your understanding

This tutorial has 6 exercises. Can you solve them without opening the hints?

Go to the exercises ↑

This is the last tutorial in Image Processing. Back to the learning map →