| title | Object Detection and CNNs |
|---|---|
| textbook | #object-detection-and-avoidance |
autonomous vehicle uses sensory input devices
(cameras, radar and lasers)
autonomous vehicle uses sensory input devices
(cameras, radar and lasers)
how does it actually "perceive"?
perception involves not just identifying that an object exists, but also,
perception involves not just identifying that an object exists, but also,
| object classification | what is it? |
perception involves not just identifying that an object exists, but also,
| object classification | what is it? |
| object localization | where is it? |
consider a camera,
consider a camera,
| object classification | what is it? | recognizing objects (cars, traffic lights, pedestrians) |
| object localization | where is it? | |
consider a camera,
| object classification | what is it? | recognizing objects (cars, traffic lights, pedestrians) |
| object localization | where is it? | generating bounding boxes |
consider a camera,
multiple classes of object detection and localization methods,
1. Histogram of Gradient Objects (HOG)
- mainly used for face and image detection
- mainly used for face and image detection
- image (
$width \times height \times channels$ ) → feature vector, length$n$ -
$n$ → chosen by user
-
Note:
- convert the image to a feature vector
- mainly used for face and image detection
- image (
$width \times height \times channels$ ) → feature vector, length$n$ -
$n$ → chosen by user
-
- histogram of gradients → used as image "features"
HOG example
gradients are important
gradients are important
- check for edges and corners in image
- through regions of intensity changes
gradients are important
- check for edges and corners in image
- through regions of intensity changes
- often pack much more information than flat regions
2. Scale Invariant Feature Transform (SIFT)
- extracting distinctive invariant features from images
- extracting distinctive invariant features from images
- reliable matching → between different views of an object or scene
- extracting distinctive invariant features from images
- reliable matching → between different views of an object or scene
- finds keypoints in an image that do not change
finds keypoints based on,
- scale
- rotation
- illumination
SIFT example
- image recognition → matches individual features to database
- database → known objects
- image recognition → matches individual features to database
- database → known objects
- using a fast nearest-neighbor algorithm
SIFT → robustly identify objects
SIFT → robustly identify objects
while achieving near real-time performance
- used to accurately identify and analyze human faces
- used to accurately identify and analyze human faces
- mainly works with grayscale images
- given an image → looks at many smaller subregions
- given an image → looks at many smaller subregions
- tries to find a face → looking for specific features in each subregion
- given an image → looks at many smaller subregions
- tries to find a face → looking for specific features in each subregion
- check many different positions and scales
- image can contain many faces of various sizes
uses Haar-like features to detect faces
Haar wavelets → sequence of rescaled “square-shaped” functions which together form a wavelet family or basis
Viola-Jones example
textbook has links to the actual papers
use neural networks → classification, regression, representation
inspiration from biological neuroscience
inspiration from biological neuroscience
- stacking artificial "neurons" into layers
inspiration from biological neuroscience
- stacking artificial "neurons" into layers
- "training" them to process data
inspiration from biological neuroscience
- stacking artificial neurons into layers
- "training" them to process data
"deep" → multiple layers (3 to 1000s) in the network
a brief detour... into neural networks
a brief detour... into neural networks
no way I can possibly speedrun all of neural networks in one class!
- representation of mathematical operations
- using directed acyclic graphs
- representation of mathematical operations
- using directed acyclic graphs
- used by neural networks for computation
| nodes can be variables or functions | ![]() |
| nodes can be variables or functions edges represent flow of data |
![]() |
| nodes can be variables or functions edges represent flow of data leaf nodes → inputs/parameters |
![]() |
| nodes can be variables or functions edges represent flow of data leaf nodes → inputs/parameters internal nodes → operations |
![]() |
| nodes can be variables or functions edges represent flow of data leaf nodes → inputs/parameters internal nodes → operations |
![]() |
computation strictly proceeds: inputs → outputs
consider a simple example...
consider a simple example...
- a single neuron computes,
$y = x_1 w_1 + x_2 w_2$
consider a simple example...
- a single neuron computes,
$y = x_1 w_1 + x_2 w_2$ - drawn as a graph
- two multiplciation nodes
- feeding into a summation node
consider a simple example...
- a single neuron computes,
$y = x_1 w_1 + x_2 w_2$ - drawn as a graph
- two multiplciation nodes
- feeding into a summation node
directed edges carry values forward and gradients backward
- many layers of parameterized operations
- many layers of parameterized operations
- every deep learning framework (e.g., PyTorch, TensorFlow, JAX)
- many layers of parameterized operations
- every deep learning framework (e.g., PyTorch, TensorFlow, JAX)
- builds internal computation graphs
- traversed in reverse order
- compute gradients
keep the following separate:
keep the following separate:
| concern | description |
|---|---|
| data | input values (e.g., pixel values of an image) |
keep the following separate:
| concern | description |
|---|---|
| data | input values (e.g., pixel values of an image) |
| weight | learnable parameters that network adjusts during training |
keep the following separate:
| concern | description |
|---|---|
| data | input values (e.g., pixel values of an image) |
| weight | learnable parameters that network adjusts during training |
| structures | graph topology which ops connect to which inputs |
| concern | graphical example |
|---|---|
| data weight structures |
![]() |
| concern | changes/static |
|---|---|
| data | changes during inference |
| concern | changes/static |
|---|---|
| data | changes during inference |
| weight | changes during training |
| concern | changes/static |
|---|---|
| data | changes during inference |
| weight | changes during training |
| structures | stays fixed |
| computes weighted sum of inputs | ![]() |
| computes weighted sum of inputs with two inputs, corresponding weights |
![]() |
| computes weighted sum of inputs with two inputs, corresponding weights |
![]() |
| computes weighted sum of inputs with two inputs, corresponding weights |
![]() |
|
|
![]() |
|
|
![]() |
|
$\begin{bmatrix}x_1 & x_2\end{bmatrix} \cdot \begin{bmatrix}w_1 \ w_2\end{bmatrix} = y$ |
![]() |
- enables efficient parallel computation
- on modern hardware (GPUs)
- a full layer with
$n$ input neurons
- a full layer with
$n$ input neurons - represented as matrix multiplication:
- simplest example of "learnable component"
- given → inputs
$x_1$ ,$x_2$ with weights$w_1$ ,$w_2$
- given → inputs
$x_1$ ,$x_2$ with weights$w_1$ ,$w_2$
- given → inputs
$x_1$ ,$x_2$ with weights$w_1$ ,$w_2$
![]() |
multiplication nodes → |
![]() |
multiplication nodes → feeding into summation node → |
![]() |
multiplication nodes → feeding into summation node → each quantity → has a precise mathematical rule |
![]() |
multiplication nodes → feeding into summation node → each quantity → has a precise mathematical rule every operation → well-defined derivative |
this is what makes backpropagation possible
Note:
- at some point we need to be able to send "feedback" to the neural net
training a neural network...
training a neural network...
- finding weight values
$\vec{w}$
training a neural network...
- finding weight values
$\vec{w}$ - make network's outputs
$\hat{y}$ match → ground-truth labels$y$
measure mismatch between outputs and ground-truths
mismatch measured via → loss function
mismatch measured via → loss function
(mean square error)
- optimization problem
- optimization problem
- minimise
$\mathcal{L}$ over → weight space
- optimization problem
- minimise
$\mathcal{L}$ over → weight space - iteratively moving weights
- optimization problem
- minimise
$\mathcal{L}$ over → weight space - iteratively moving weights
- in the direction that reduces loss
so we need a way to update the graph...
so we need a way to update the graph...
...rather the weights
- step size your algorithm takes
- trying to find bottom of a hill
- point of minimum error
- step size your algorithm takes
- trying to find bottom of a hill
- point of minimum error
typically very small positive number → $0.1-10^{-5}$
Note:
When a model is learning, it calculates which direction it needs to move to make fewer mistakes. The learning rate is the dial that controls how far it moves in that direction during each update. It is typically a very small positive number, often between
- key quantity →
$\nabla \mathcal{L}$ - gradient of loss w.r.t. every weight in the network
- backpropagation → efficient application of chain rule
- backpropagation → efficient application of chain rule
- for a composition of functions,
$f(x) = f(g(x))$ :
- backpropagation → efficient application of chain rule
- for a composition of functions,
$f(x) = f(g(x))$ :
- backpropagation → efficient application of chain rule
- for a composition of functions,
$f(x) = f(g(x))$ :
but what does this mean...in practice?
but what does this mean...in practice?
but what does this mean...in practice?
gradient flowing back through a node equals...
but what does this mean...in practice?
gradient flowing back through a node equals...
gradient from output
but what does this mean...in practice?
gradient flowing back through a node equals...
gradient from output
but, why do we care about derivatives?
Note: Imagine you are standing on a foggy mountain (representing the network's loss or error) and your goal is to get to the bottom (the lowest error possible). Because of the fog, you can't see the bottom.
Without derivatives, you'd have to take a step in a random direction, see if the altitude went down, and repeat. With millions of knobs, this would take forever.
The derivative tells you the exact slope of the ground right under your feet. By moving in the opposite direction of the gradient (gradient descent), you are guaranteed to be taking the most efficient step down the mountain.
a derivative tells you → exact slope in front of you
a derivative tells you → exact slope in front of you
we want to move in a direction opposite that of the gradient
a derivative tells you → exact slope in front of you
we want to move in a direction opposite that of the gradient
- if a neural network is a giant machine
- if a neural network is a giant machine
- with millions of knobs (weights and biases)
- if a neural network is a giant machine
- with millions of knobs (weights and biases)
- derivative → compass that tells us
- if a neural network is a giant machine
- with millions of knobs (weights and biases)
- derivative → compass that tells us
- which way to turn each knob
- to make the machine better at its job
- good for quick optimizations
- assigning credit/blame at fine granularity
- scalability
but also comes with problems
- "vanishing" and "exploding" gradients
let's look at a concrete example...
consider the following functions...
|
|
|
|
assign concrete values: |
|
|
assign concrete values: |
![]() |
propagate values → from inputs to output
| substitute numerical values into each node from L to R |
|
| substitute numerical values → into each node from L to R store every intermediate value → needed during the backward pass |
|
| substitute numerical values → into each node from L to R store every intermediate value → needed during backward pass |
![]() |
(1) |
(2) |
(1) |
(2) |
(3) |
once
once
so, we can compute the mean square error,
| starting point for backward pass | ![]() |
recall,
recall,
so, the loss function is:
we decompose loss graph → with intermediate variable,
we decompose loss graph → with intermediate variable,
propagate gradients from loss → back through the graph
propagate gradients from loss → back through the graph
| start from loss node, work backwards | |
propagate gradients from loss → back through the graph
| start from loss node, work backwards multiplying upstream gradients → by local derivatives at each step |
|
propagate gradients from loss → back through the graph
| start from loss node, work backwards multiplying upstream gradients → by local derivatives at each step |
![]() |
propagate gradients from loss → back through the graph
| start from loss node, work backwards multiplying upstream gradients → by local derivatives at each step |
![]() |
gradients (in
propagate gradients from loss → back through the graph
(1) |
(2) |
gradients (in
backward pass is complete
backward pass is complete...but, we must update the weights
we now have
we now have
| forward values are stored gradients accumulate as we traverse backwards |
|
| forward values are stored gradients accumulate as we traverse backwards |
![]() |
let's look at the complete backward sequence...
(1) |
(2) |
(1) |
(2) |
(3) |
(1) |
(2) |
(3) |
(4) |
final state...
linear activation function does poor job at
linear activation function does poor job at
approximating non-linear relationships
a network composed of only linear operations...
a network composed of only linear operations...
collapses into a single linear transformation
a network composed of only linear operations...
collapses into a single linear transformation
e.g., a
parabolic decision boundary |
multi-class problems with non-linear boundaries |
to learn useful representations of complex data...
(e.g., images, audio, languages)
to learn useful representations of complex data...
(e.g., images, audio, languages)
(Rectified Linear Unit)
most widely used activation function in modern deep learning
most widely used activation function in modern deep learning
ReLU is piecewise linear
| ReLU is piecewise linear it passes positive values unchanged zeros out negative values |
|
| ReLU is piecewise linear it passes positive values unchanged zeros out negative values |
![]() |
- computationally cheap
- ReLU networks → train
$6x$ faster than others
Note: This piecewise-constant derivative is computationally cheap (just a comparison) and does not vanish for positive inputs, which greatly accelerates training compared to sigmoid and tanh activations that saturate and cause the vanishing gradient problem. Empirically, ReLU networks train roughly 6× faster than sigmoid networks of the same depth.
| value | gradient effect |
|---|---|
| passes through unchanged |
| value | gradient effect |
|---|---|
| passes through unchanged | |
| zeroed out | |
| value | gradient effect |
|---|---|
| passes through unchanged | |
| zeroed out | |
creates sparse gradient flows → helps in regularization
- prevents model from memorizing data i,e., overfitting
- can generalize for new data
- node with negative input → blocks gradient
it looks like a straight line!
it looks like a straight line!
how does something that looks linear help with nonlinearities?
- combination of many ReLUs across a network
Note:
Think of a single ReLU as a sheet of paper being folded in half. One half is flat (
- combination of many ReLUs across a network
- piecewise construction of a non-linear function
- preserves the easy, fast optimization of linear functions
- while yielding expressive power of non-linear functions
convolutional neural networks (CNNs) for object detection
class of deep learning neural networks
class of deep learning neural networks
learns "features"` → "filter" (or kernel) optimization
convolution operations at runtime
convolution operations at runtime
used in object detection → classify images from the camera
but first, some basics...
from simple graphs to image models
from simple graphs to image models
- computational graphs introduced earlier
from simple graphs to image models
- computational graphs introduced earlier
- can now handle images
from simple graphs to image models
| 2 input computational graph | |
|---|---|
![]() |
|
| 2 input computational graph | "deeper" CNN for image classification |
|---|---|
![]() |
![]() |
the output (of say YOLO)...
the output (of say YOLO +)...
[+ more on this later...]
the output (of say YOLO)...
| code | ||
|---|---|---|
![]() |
||
the output (of say YOLO)...
| code | inputs | |
|---|---|---|
![]() |
![]() |
|
the output (of say YOLO)...
| code | inputs | output |
|---|---|---|
![]() |
![]() |
![]() |
| dimension type | number | descriptions |
|---|
| dimension type | number | descriptions |
|---|---|---|
| spatial | 2 | height ( |
| dimension type | number | descriptions |
|---|---|---|
| spatial | 2 | height ( |
| color channels | 3 (or more) |
|
| dimension type | number | descriptions |
|---|---|---|
| spatial | 2 | height ( |
| color channels | 3 (or more) |
|
| greyscale | 1 | |
a
a
a
each entry → integer in
a
each entry → integer in
(or a float in
![]() |
![]() |
![]() |
![]() |
grayscale image patch and its tensor representation
a batch of
a batch of
a batch of
a batch of
standard input format for GPU-accelerated CNN training
coming back to CNNs...
before deep learning
before deep learning → hand-crafted image operations
before deep learning → hand-crafted image operations
- identifying sharp transitions in pixel intensity
- identifying sharp transitions in pixel intensity
- corresponding to object boundaries
Note:
- Edge detection applied to an image highlights structural content of the scene
consider a photograph of a brick house,
| original image | after edge detection |
|---|---|
![]() |
![]() |
Note:
- Structure is preserved while texture is removed — a "stick figure" of the house
edges are computed by convolving the image with a small filter
edges are computed by convolving the image with a small filter
- a small matrix → slid across the image
edges are computed by convolving the image with a small filter
- a small matrix → slid across the image
- computes dot products at each position
edges are computed by convolving the image with a small filter
- a small matrix → slid across the image
- computes dot products at each position
- transforms the image → highlight specific features
this operation — the convolution — is the core building block of CNNs
what is a convolution operation?
what is a convolution operation?
operation on two functions,
what is a convolution operation?
operation on two functions,
integral of product → after one is reflected about y-axis and shifted
visual examples of convolutions
we are really interested in discrete convolutions
(complex-valued) functions,
(complex-valued) functions,
defined on the set
(complex-valued) functions,
defined on the set
at a high level this can be visualized as,
- flipping one sequence
- flipping one sequence
- shifting it across another
- flipping one sequence
- shifting it across another
- multiplying corresponding elements
- flipping one sequence
- shifting it across another
- multiplying corresponding elements
- summing up the results over the range of overlap
convolution blends two functions
convolution blends two functions
- creates a third function
convolution blends two functions
- creates a third function
- represents how one function modifies the other
how kernels (that act as filters) → alter or transform input data
images contain a hierarchy of features
images contain a hierarchy of features
| low-level | edges, corners, textures |
images contain a hierarchy of features
| low-level | edges, corners, textures |
| high-level | eyes, wheels, faces |
images contain a hierarchy of features
Note:
- A hierarchy of visual features, from simple edges to complex object parts
define a kernel (filter)
define a kernel (filter) → small matrix of learned weights
define a kernel (filter) → small matrix of learned weights
- convolving image with kernel → produces a feature map
define a kernel (filter) → small matrix of learned weights
- convolving image with kernel → produces a feature map
- highlights where in the image that feature appears
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
let's look at a simple example...
values of given pixel in output image,
values of given pixel in output image,
multiplying each kernel value by corresponding input image pixel values
kernel "slides" across the image
kernel "slides" across the image
- computing element-wise products
- and summing them
kernel "slides" across the image
- computing element-wise products
- and summing them
produce each output value in feature map
| operation | kernel/matrix | result |
|---|---|---|
| identity | $\left[\begin{array}{lll}0 & 0 & 0 \newline 0 & 1 & 0 \newline 0 & 0 & 0\end{array}\right]$ | ![]() |
in its simplest form → convolution is defined as,
the process of adding each element of the image to its local neighbors, weighted by the kernel
for each image row in input image:
for each pixel in image row:
set accumulator to zero
for each kernel row in kernel:
for each element in kernel row:
if element position corresponding* to pixel position
multiply element value corresponding* to pixel value
add result to accumulator
endif
set output image pixel to accumulator
general form of a matrix convolution
general form of a matrix convolution
general form of a matrix convolution
$$ \left[\begin{array}{cccc} x_{11} & x_{12} & \cdots & x_{1 n} \newline x_{21} & x_{22} & \cdots & x_{2 n} \newline \vdots & \vdots & \ddots & \vdots \newline x_{m 1} & x_{m 2} & \cdots & x_{m n} \end{array}\right] *\left[\begin{array}{cccc} y_{11} & y_{12} & \cdots & y_{1 n} \newline y_{21} & y_{22} & \cdots & y_{2 n} \newline \vdots & \vdots & \ddots & \vdots \newline y_{m 1} & y_{m 2} & \cdots & y_{m n} \end{array}\right]=\sum_{i=0}^{m-1} \sum_{j=0}^{n-1} x_{(m-i)(n-j)} y_{(1+i)} $$when specific kernel is applied to an image,
when specific kernel is applied to an image,
- it modifies or transforms the image
when specific kernel is applied to an image,
- it modifies or transforms the image
- highlights or emphasizes → feature that kernel is specialized to detect
when specific kernel is applied to an image,
- it modifies or transforms the image
- highlights or emphasizes → feature that kernel is specialized to detect
- creates a new representation of original image
when specific kernel is applied to an image,
- it modifies or transforms the image
- highlights or emphasizes → feature that kernel is specialized to detect
- creates a new representation of original image
- focusing on specific feature → encoded by applied kernel
kernels come in various shapes
ReLU after convolution
ReLU after convolution
- zero out negative activations
ReLU after convolution
- zero out negative activations
- positions where the feature was absent
ReLU after convolution
Note:
- Applying ReLU after convolution produces a non-negative feature map, highlighting positive matches of the filter pattern
stride → how many pixels the filter moves at each step
stride → how many pixels the filter moves at each step
| stride | result |
|---|---|
| 1 | filter moves one pixel at a time |
stride → how many pixels the filter moves at each step
| stride | result |
|---|---|
| 1 | filter moves one pixel at a time |
| 2 | filter skips every other position, halving output dimensions |
Note:
- Stride 1 (dense) vs. larger strides. Increasing stride reduces the output spatial size.
for input width
for input width
Note:
CNNs → do not hand code kernels to extract features
CNNs → do not hand code kernels to extract features
neural network learns kernels → extract different features
which kernel to learn?
which kernel to learn?
up to the model!
which kernel to learn?
up to the model!
whatever feature it wants to extract → CNN will learn the kernel
- act as specialized filters that modify input
- act as specialized filters that modify input
- highlighting specific patterns or structures
- act as specialized filters that modify input
- highlighting specific patterns or structures
- enabling network → learn and discern various features
- act as specialized filters that modify input
- highlighting specific patterns or structures
- enabling network → learn and discern various features
essential for → image recognition, object detection, etc.
| a CNN learns which kernels to use | ![]() |
| a CNN learns which kernels to use through backpropagation |
![]() |
| a CNN learns which kernels to use through backpropagation directly from labelled training data |
![]() |
Note:
- Rather than manually designing kernels (like the Sobel operator for edges), a CNN learns which kernels to use
- classification problems with
$C$ classes
- classification problems with
$C$ classes - the final layer typically uses softmax function
- classification problems with
$C$ classes - the final layer typically uses softmax function
- to produce a valid probability distribution over classes
given a vector of raw scores (logits)
given a vector of raw scores (logits)
softmax ensures all class probabilities are non-negative and sum to
the resulting framework → Convolutional Neural Network
| filter type | result |
|---|---|
| single filter | one feature map |
| filter type | result |
|---|---|
| single filter | one feature map one view of the image |
| filter type | result |
|---|---|
| single filter | one feature map one view of the image |
| many in parallel | each learning different feature |
| filter type | result |
|---|---|
| single filter | one feature map one view of the image |
| many in parallel | each learning different feature outputs stacked along new channel dimension |
Note:
- Applying multiple filters in parallel. Each filter produces its own feature map; together they form a volume.
applying
applying
- a volume of
$K$ feature maps
applying
- a volume of
$K$ feature maps -
$K$ distinct views of the image
example: consider a small patch of image of a car
three color channels (R, G, B)
s consider a grayscale image first (for simplicity):
one version of convolution
If we run it forward, this is what the result looks like:
we have to deal with,
solution is simple...apply kernel to each channel!
solution is simple...apply kernel to each channel!
combine
combine
(+ usually summed up)
combine
(+ usually summed up)
Note: The "bias" helps in shifting the activation function and influences the feature maps’ outputs. This is a constant that is added to the product of features and weights. It is used to offset the result. It helps the models to shift the activation function towards the positive or negative side.
- stacking multiple convolutional layers
- stacking multiple convolutional layers
- increasingly abstract hierarchy of features
Note:
- Multiple layers of convolution. Early layers detect simple features (edges); later layers detect complex features (object parts) by composing earlier features.
| layer | use |
|---|---|
| 1 | detects edges, corners, colours |
| layer | use |
|---|---|
| 1 | detects edges, corners, colours |
| 2 | detects combinations of edges |
| layer | use |
|---|---|
| 1 | detects edges, corners, colours |
| 2 | detects combinations of edges [textures, simple shapes] |
| layer | use |
|---|---|
| 1 | detects edges, corners, colours |
| 2 | detects combinations of edges [textures, simple shapes] |
| 3+ | detects object parts |
| layer | use |
|---|---|
| 1 | detects edges, corners, colours |
| 2 | detects combinations of edges [textures, simple shapes] |
| 3+ | detects object parts eventually whole objects |
this hierarchical representation → power of deep CNNs
for a convolutional layer with,
for a convolutional layer with,
| parameter | description |
|---|---|
| kernel size | |
| input channels | |
| output filters | |
number of learnable parameters =
learnable parameters =
as network depth/filter count increase → parameter counts grow rapidly
parameter sharing
parameter sharing → same filter weights at every spatial position
parameter sharing → same filter weights at every spatial position
- a feature detector useful at one position → likely useful everywhere
parameter sharing → same filter weights at every spatial position
- a feature detector useful at one position → likely useful everywhere
- far fewer parameters than an equivalent fully-connected layer
- max pooling → reduces spatial dimensions of feature maps
- max pooling → reduces spatial dimensions of feature maps
-
$2 \times 2$ max pooling with stride 2- takes maximum value in each window
Note:
- Max pooling with a 2x2 window and stride 2. Each output value is the maximum in its window.
why max pooling?
why max pooling?
| benefit | description |
|---|---|
| translational invariance | small shifts in input do not change pooled output |
why max pooling?
| benefit | description |
|---|---|
| translational invariance | small shifts in input do not change pooled output |
| dimensionality reduction | controls computational cost |
why max pooling?
| benefit | description |
|---|---|
| translational invariance | small shifts in input do not change pooled output |
| dimensionality reduction | controls computational cost |
| increased receptive field | later layers "see" larger region of the image |
- after convolution and pooling
- spatial feature volume must become → fixed-length vector
flattening → reshape
Note:
- Flattening "unpacks" the feature volume into a 1xn vector, preparing it for fully-connected layers
e.g., feature volume
Important note for YOLO:
YOLO does not fully flatten to a 1D vector.
It preserves spatial structure in its output, producing a$7 \times 7 \times 30$ tensor
so, then...what are cnns?
so, then...what are cnns?
- multiple layers of artificial neurons
so, then...what are cnns?
- multiple layers of artificial neurons
- mathematical functions
- calculate weighted sum of inputs/outputs
so, then...what are cnns?
- multiple layers of artificial neurons
- mathematical functions
- calculate weighted sum of inputs/outputs
- on activation value
- multiple layers of artificial neurons
- why multiple layers?
each layer has a unique function
each layer has a unique function
each layer has a unique function
each layer has a unique function
each layer has a unique function
each layer has a unique function
each layer has a unique function
Note:
- A complete CNN architecture: convolutional layers, pooling, flattening and fully-connected layers
fully-connected layers (dense layers)
fully-connected layers (dense layers)
- connect every neuron in one layer to every neuron in the next
fully-connected layers (dense layers)
- connect every neuron in one layer to every neuron in the next
- integrate information from across the entire feature map
many different architectures with trade-offs between,
many different architectures with trade-offs between,
- accuracy
many different architectures with trade-offs between,
- accuracy
- speed
many different architectures with trade-offs between,
- accuracy
- speed
- parameter efficiency
deeper networks → higher accuracy, more parameters/computation cost
same classification task → very different network designs
[Simonyan and Zisserman, 2015]
- depth → critical factor in network performance
- depth → critical factor in network performance
- uses exclusively small
$3 \times 3$ convolution filters throughout
Note:
- VGG-16 architecture. All convolutional filters are 3x3; five max pooling layers progressively reduce spatial dimensions
why only
two stacked
two stacked
but with fewer parameters:




































































































