neural-networks-part1
neural-networks-part1
Part 1: NetworkBasics
1
Image Classification
“cat
”
“5” 2
Semantic
Segmentation
“a label
for each
pixel”
3
Neural Networks
Machine learning technique
Often used for classification,
semantic segmentation, and related
tasks
First ideas discussed in the
1950/60ies
Theory work on NNs in the 1990ies
Increase in attention from 2000 on
Deep learning took off around 2010
CNNs for image tasks from 2012 on 4
Part 1
Neural Networks Basics
5
Neural Network
8
Neurons
Receive inputs / activations from
sensors or other neurons
Combine / transform information
Create an output / activation
9
Neurons as Functions
We can see a neuron as a function
Input given by
Transformation of the input data
can be described by a function
Output
10
Neural Network
NN is a network/graph of neurons
Nodes are neurons
Edges represent input-output
connections of the data
flow
12
Neural Networks are Functions
Neural networks are functions
Consist of connected artificial
neurons
Input layer takes (sensor) data
Output layer provides the
function result (informationor
command)
Hidden layers do some
computations
input layer hidden layers output layer
13
Different Types of NNs
Perceptron
MLP – Multilayer perceptron
Autoencoder
CNN – Convolutional NN
RNN – Recurrent NN
LSTM – Long/short term memory NN
GANs – Generative adversarial network
Graph NN
Transformer
...
14
[Image courtesy: van Veen]
6
1
[Image courtesy: van Veen]
7
1
Multi-layer Perceptron (MLP)
17
Multi-layer
Perceptron Seen as a
Function
input layer hidden layers output layer
18
Image Classification Example
“cat
”
An image consists
of individual
pixels.
imag 20
e
What is the Network’s Input?
An image consists
of individual
pixel intensities
pixels.
Each pixel stores
an intensity
value.
imag 21
e
What is the Network’s Input?
pixel intensities
An image consists
of individual
pixels.
Each pixel stores
an intensity
value.
imag 22
e
What is the Network’s Input?
An image consists
of individual
pixels.
Each pixel stores
an intensity
value.
We have N+1 such
intensity values.
23
What is the Network’s Input?
This vector is
the input layer
of our network!
27
What is the Network’s
Output?
“cat
”
28
What is the Network’s
Output?
Is it a...
cat or a
dog or a
human
or a
...?
29
What is the Network’s
Output?
Is it a...
cat or a
dog or a
human
or a
...?
indicato
r
30
vector
What is the Network’s
Output?
Is it a...
cat or a
dog or a
human
or a
...?
indicato
r
31
vector
What is the Network’s
Output?
Is it a...
cat or a
dog or a
human
or a
...?
we are
never
certain.. 32
.
Output of the
Network
“cat”
largest
value
35
Multi-layer Perceptron
Let’s Look at a Single
Neuron
36
Perceptron (Single Neuron)
output
output activation
for the next layer
(input) activations
weights
bias
activation function
output activation
39
Function Behind a
Neuron
A neuron gets activated ( ) through
A weighted sum of input activations
A bias activation
An activation function
40
Similarity to Convolutions?
A neuron is similar to a
convolution
Remember linear shift-invariant
kernels used as local
operators
This part looks like the
convolutions used for defining
local operators
“activated”
“no activation”
“no activation”
44
ReLU Activation
Function
Most commonly used one is the
so- called “rectified linear unit” or
ReLU
Often advantages for deep
networks
45
Neuron
Activation
A neuron is only activated if
If
the weighted activations are larger than the
46
negative bias
Common Activation
Functions
There are different activation functions
sigmoid()
ReLU()
tanh()
atan()
softplus()
identity()
step-function()
…
ReLU is often used
47
Illustration
[Courtesy of S. Sharma]
9
4
Function Behind a
Neuron
Neuron gets activated if the
weighted sum of input activations is
large enough (larger thanthe
negative bias)
51
Each Layer Can Be Expressed
Through Matrix
Multiplications
layer 1 layer 0
52
Do It Layer by Layer...
53
Do It Layer by Layer...
input = layer 0
layer 1
layer 2
layer k = output
56
Handwritten Digit
Recognition
=5
28x28 pixel image
[Image courtesy: Nielsen] 58
Handwritten Digit
Recognition
28x28
pixel
input
images outpu
t
(784 vector
dim) (10 dim)
[Partial image courtesy: Nielsen] 61
What Happens in the Layers?
61
What Happens in the 1st Layer?
pixel
value
s
-1 0 +1
white
black
pixel values weights effect on (rest
the doesn’t
weighted sum matter)
63
What Happens in the 1st Layer?
-1 0 +1
pixel
value weights tell
s what
us matters for
activating the
neuron!
the image
Link to Local Operators
Defines Through Convolutions
Direct link to defining
image operators through
-1 0 +1
convolutions
Here:
Global (not local) operators
Weight matrix does not
weights tell (yet) “slide over image”
us what
matters
65
Weights & Bias =
Patterns
Weights define the patterns to
look for in the image
Bias tells us how well the image
must
match the pattern
Activation functions “switches the
neuron on” if it matches the
pattern
66
What Happens in the 2nd Layer?
The weights in layer 2 tell us which
1st layer patterns should be
combined
The deeper we go, the more
patterns get arranged and combined
72
How to Make the
Network Compute What
We Want?
So far, the network is a recipe for
sequentially performing
computations
Structure and parameters are
the
design choices
How to set them?
Learning! 73
Summary – Part 1
What are neurons and neural
networks
Lots of different networks exists
Focus: multi-layer perceptrons (MLP)
Activations, weights, bias
Networks have many parameters
“It’s just a bunch of matrices and
vectors”
MLP for simple image
classification 74