1/36
Looks like no tags are added yet.
Recognition tasks (the 6 types)
Verification: is that a lamp?
Detection: where are the people?
Identification: is that Potala Palace (a specific instance)?
Object categorization: label the objects (mountain, tree, building, people).
Scene and context categorization: outdoor, city.
Activity/event recognition: what are these people doing?
Why template matching fails for recognition
Pointwise correlation of a model pattern with the image (e.g., normalized correlation to find a chair) gives "pretty much garbage" output. It is inadequate for 3D scenes because of occlusion, changes in viewing angle, and articulation of parts
SIFT matching: when it works vs. not
Works well for object instances (a specific object or distinctive images such as logos).
Not great for generic object categories, because different instances of a category do not share the same local appearance
Image classifier (definition)
Input: an image.
Output: a class label, generally one of the discrete labels used in training (e.g., cat, dog, cow, toaster).
The semantic gap: The difference between what we see and what the computer sees (a grid of pixel values). It is why classification is hard: nothing in the raw numbers says what we see
Challenges for image classification (5)
Illumination
deformation
occlusion
background clutter
intraclass variation (instances of the same class look very different)
Why recognition is under-constrained
Distinct realities can produce the same image, so we generally can't compute the "right" answer, only the most likely one. That requires a prior to condition on, and we learn the prior from data
Statistical learning framework
y = f(x)
x is the feature representation of the image, f is the prediction function, and y is the output prediction.
Training: given a labeled training set {(x1, y1), …, (xN, yN)}, learn f by minimizing prediction error on the training set.
Testing: given an unlabeled test instance x, predict y = f(x)
Classifiers listed
kNN (k-nearest neighbors)
linear classifier
neural network
deep neural network
Linear classifier: score function
f(xᵢ, W, b) = W xᵢ + b
xᵢ is the image stretched into a single column vector, W is the weights matrix (one row per class), b is the bias vector (one per class), and the output is a vector of class scores. W and b are the parameters.
Parametric approach: f(x, W) maps the image to class scores.
W = num of classes * image size (flat)
Num parameters = W + b
Linear classifier: geometric interpretation + hard cases
The parameters define a hyperplane for each class (a line in 2D). The class score is the signed distance from that hyperplane, so a class score is proportional to distance from the corresponding hyperplane in the space of all images
Hard cases for a linear classifier: Data that cannot be separated by a line/hyperplane (e.g., one class forming a ring around another in the original space)
Feature transform trick
Map the data into a feature space where the classes become linearly separable.
Example: (x, y) → (r, θ) with r = √(x² + y²), θ = tan⁻¹(y/x).
A linear classifier in feature space is a nonlinear classifier in the original space
Image features vs. neural networks
Old pipeline: hand-designed feature extraction, then a trainable classifier f that outputs 10 class scores (only the classifier is trained).
Deep network: one network trained end-to-end maps pixels directly to the class scores, so the features are learned too
Last layer of a CNN
The last layer of most CNNs is just a linear classifier.
Key idea: do enough processing in the earlier layers that, by the end of the network, the classes are linearly separable
CNN application: digit recognition
Convolutional networks that classified handwritten digits and were deployed commercially to process handwritten checks. Trained with the backprop algorithm
CNN definition (two key properties) + why took off
A multi-layer neural network with (1) local connectivity: neurons in a layer are connected only to a small region of the layer before it, and (2) shared weights: the same parameters are used across spatial positions
CNN + big datasets (ImageNet) + GPUs → great improvement from hand engineered features . CNNs provided the architecture, ImageNet provided the data, and GPUs provided the comput.
hand Engineered vs. learned features
Engineered: feature extraction, then pooling, then a classifier, then the label.
CNN: stacked Convolution/pool layers, then Dense layers, then the label, all trained in a supervised manner by backpropagation. In CNNs the filter weights are learned from data
CNN layer types (4)
Convolutional layer
activation layer (ReLU: y = max(0, x)),
pooling layer, normalization (x̂ = (x − μ)/√(σ² + ε)),
fully-connected layer (y = Wx + b)
Convolution layer: what one filter does
A filter always extends the full depth of the input volume.
Slide it over all spatial positions, computing a dot product + bias at each: wᵀx + b.
One filter gives one 1×H′×W′ activation map.
Convolution layer hyperparameters and output size
Input: Cin × H × W
Hyperparameters: kernel size K = (KH×KW), number of filters Cout, padding P, stride S.
Weights/Parameters: Cout × Cin × KH × KW (+ Cout if including bias)
Cout filters size: Cin × KH × KW
bias: Cout.
same padding: P = (K − 1) / 2 (preserves spatial dimensions)
Output: Cout × H′ × W′
with H′ = (H − K + 2P)/S + 1 and W′ = (W − K + 2P)/S + 1
Parameters: conv vs. fully connected
Fully connected: input size × output size + output size = num of weights weights.
Convolutional: usually orders of magnitude fewer.
Reasons: local connectivity (each unit sees kernel size, not the whole image) and weight sharing (same filter at every position)
Note: Spatial size (H, W), padding, and stride do not change a conv layer's parameter count, because the filters are shared across positions
Receptive field rule
Stride and pooling multiply the receptive field instead of adding to it. This is how a CNN gets global context
r_l = r_(l−1) + (k_l − 1) · j_(l−1) and j_l = j_(l−1) · s_l, where r = receptive field, j = jump (distance between adjacent units, in input pixels), k = kernel size, s = stride, starting at r_0 = 1, j_0 = 1.
Closed form: r = 1 + Σ_l (k_l − 1) · S_l with S_l = s_1 · s_2 · … · s_(l−1).
Stride-1 stack of L layers: r = L(K − 1) + 1
1×1 convolution
Mixes channels at a single pixel: a learned linear map from input channels to output channels, applied identically at every position.
Why it matters: cheap channel reduction before an expensive 3×3
Stacking convs without a nonlinearity
Two stacked linear convs collapse into one: y = W₂(W₁x) = (W₂W₁)x = Wₙx.
Fix: add a nonlinearity (e.g., ReLU) between conv layers so depth adds representational power
Activation functions
output = activation(wᵀx + b).
Pooling
Reduces the dimensionality of the features, making them more manageable.
Applied to each feature (activation) map separately.
Max pooling with a 2×2 filter and stride 2 keeps the max in each window.
Learnable parameters: none
output C×H′×W′ with H′ = (H − K)/S + 1 and W′ = (W − K)/S + 1 .
Fully-connected layer
Stretch the input I to a vector and compute y = Wx + b.
For o outputs, W is o × I^T;
each output is the dot product of one row of W with the whole input
Typical CNN layer pattern
INPUT → [[CONV → RELU]*N → POOL?]*M → [FC → RELU]*K → FC,
where * means repetition, POOL? is optional
What a CNN learns
A hierarchical representation of the data.
Typical first-layer filters look like oriented edges/color blobs (inferred from the figure); deeper layers combine them into more complex patterns (shown by visualizing the learned filters)
Plain Deeper networks + problem
Deeper networks learn richer representations and perform better: But plain deeper networks become hard to train/optimize and can perform worse (not from overfitting).
Stacking more layers on a plain CNN makes the deeper model perform worse, and it is not due to overfitting. Deeper models are very hard to optimize
ResNet
Fix to plain deeper networks: have the layers fit a residual mapping instead of the direct underlying mapping (the block's output is added to its input).
Learn F(x) = H(x) − x and add x back, rather than learning the underlying mapping H(x) directly.
It reduces the vanishing gradient problem and allows training networks with many more layers
Gradient shortcut: ∂L/∂x = ∂L/∂y · (1 + ∂F/∂x), so the "1" reaches every layer undiminished
MobileNet: main idea
Depthwise separable convolution: factor the conv kernel into two operations, a depthwise conv (one spatial filter per input channel) and a pointwise conv (1×1 conv that mixes channels).
Built for efficient embedded/mobile vision
MobileNet: compute savings
Input H_in × W_in × C_in, output H_out × W_out × C_out with KH × KW kernels.
Normal conv: C_out · KH × KW · C_in · H_out · W_out multiplications.
Depthwise: C_in · KH × KW · 1 · H_out · W_out. Pointwise: C_out · 1 · C_in · H_out · W_out. Total C_in · H_out · W_out · (KH × KW + C_out), about 1 / (1/C_out + 1/(KH × KW)) fewer.
Full MobileNet: ~1% accuracy loss vs. its full-convolution version, using about 1/9 of the multiply-adds and 1/7 of the parameters
Human stereopsis and disparity
Disparity occurs when the eyes fixate on one object (d = 0 there);
other objects appear at different visual angles.
Disparity d = r − l (positions in the right and left eye)
Random dot stereograms
Test of whether we identify local brightness patterns before fusion (monocular) or after (binocular): a pair of synthetic images made by randomly spraying black dots on white objects.
Each image alone looks random, but viewed stereoscopically it shows 3D structure.
Conclusion: binocular fusion is not directly tied to the physical retinas but involves the central nervous system (an imaginary "cyclopean retina" that combines left and right images)
Stereograms and autostereograms
Stereograms: pairs of images fused to give a sense of depth.
Autostereograms: exploit disparity as a depth cue using a single image
Score function (nonlinear): s = W2 max(0, W1 x + b1) + b2.
Data loss per element: L_i = Σ_(j≠y_i) max(0, s_j − s_(y_i) + 1).
L2 regularization: R(W) = Σ_k W_k².
Total loss: L = (1/N) Σ_i L_i + λR(W1) + λR(W2).
Goal: compute ∂L/∂W1, ∂L/∂W2, ∂L/∂b1, ∂L/∂b2, then optimize with SGD
A loss takes the network's output vector plus the label and collapses them into a single scalar to differentiate.
Requirements: differentiable almost everywhere, and its gradient must be informative where the model is currently wrong.
Changing the loss changes the model: same architecture and data with a different loss gives a different predictor.
Most vision tasks are covered by classification losses (cross-entropy) and regression losses (L1, L2, Huber), plus per-pixel or per-box versions of the two