Training Deep Learning Models for Vision
Day 1
Course Overview
Organisation
Organisation
Exercises
Exercises
Exercises
Content
Machine Learning Recap
Science at large
Machine Learning
Machine Learning
xkcd.com/1838
Learning techniques
Learning techniques
Supervised learning
Two main tasks
Supervised learning
Supervised learning
Supervised learning
Train and test set
Train and test set
Shallow Models
Shallow Models
Logistic Regression
Shallow Models
Logistic Regression
Shallow Models
Logistic Regression
Shallow Models
Logistic Regression
Very simple artificial neural network!
Input
Prediction
x1
x2
x3
+
w1
w2
w3
py
sig
Going deeper
Hidden
Input
Prediction
Going deeper
Prediction
Input
Hidden layers
Going deeper
Prediction
Input
Hidden layers
Training
Training
Gradient Descent: Simplest Example
x1
x2
y
L
w1
w2
Gradient Descent: Simplest Example
x1
x2
y
L
w1
w2
Gradient Descent: Simplest Example
�
x1
x2
y
L
0.1
0.1
Gradient Descent: Simplest Example
0
1
0.1
L
0.1
0.1
Gradient Descent: Simplest Example
0
1
0.1
0.08
0.1
0.1
Gradient Descent: Simplest Example
0
1
0.1
0.08
0.1
0.1
0
-0.4
Gradient Descent: Simplest Example
x1
x2
y
L
0.1
0.14
Gradient Descent: Simplest Example
0
1
0.14
0.065
0.1
0.14
Gradient Descent
Computer Vision Recap
Why is vision difficult?
Summer project: program a computer to use a camera to identify objects�Marvin Minsky, 1966
Why is vision difficult?
Summer project: program a computer to use a camera to identify objects�Marvin Minsky, 1966
Cat
Why is vision difficult?
Summer project: program a computer to use a camera to identify objects�Marvin Minsky, 1966
Cat
Cat
Why is vision difficult?
Summer project: program a computer to use a camera to identify objects�Marvin Minsky, 1966
Cat
Cat
Cat
Why is vision difficult?
Summer project: program a computer to use a camera to identify objects�Marvin Minsky, 1966
Cat
Cat
Cat
Dog
Computer Vision tasks
Cat
Dog
Image Classification
Object detection
Semantic segmentation
Example: Semantic Segmentation
Rule based
Cells vs background segmentation
[Image: Gerlich Lab]
Is the pixel white?
Cell!
Rule based
Cells vs background segmentation
[Image: Gerlich Lab]
Is the pixel white?
Are all neighbors white?
Cell!
Cell!
Rule based
Cells vs background segmentation
[Image: Gerlich Lab]
Is the pixel white?
Are all neighbors white?
Is the pixel near an edge?
Cell!
Cell!
Not Cell!
Rule based
Cells vs background segmentation
[Image: Gerlich Lab]
Is the pixel white?
Are all neighbors white?
Is the pixel near an edge?
Is the texture smooth?
Cell!
Cell!
Not Cell!
Learn it instead!
Cells vs background segmentation
[Image: Gerlich Lab]
Is the pixel white?
Are all neighbors white?
Is the pixel near an edge?
Is the texture smooth?
Cell!
Cell!
Not Cell!
Shallow learning
Black�Box
Training data
Compute features
Add (sparse) training data
Add (sparse) training data
Train classifier
Predict all pixels or new data
Deep Learning
Deep Learning
Convolutional Neural Network�(here: U-Net, will cover later)�
Deep Learning Libraries �and Pytorch Basics
Why do we need a deep learning framework?
x1
x2
y
L
w1
w2
Why do we need a deep learning framework?
x1
x2
y
L
w1
w2
Why do we need a deep learning framework?
���
Why do we need a deep learning framework?
�Deep Learning Frameworks:
Most popular libraries
Tensorflow - low level framework���� Keras - high level framework based on tensorflow���� Pytorch - low level framework
Most popular libraries
Tensorflow - low level framework���� Keras - high level framework based on tensorflow��� � Pytorch - low level framework
Torch tensor
nd array, like numpy.array but supports auto-differentiation
Torch nn
functionality for neural networks
Torch nn.Module
define custom models
Torch Basics
�Resources:
Implementing from scratch ...
Torch is low level: a lot of (basic) functionality still needs to be implemented��Educational: we implement everything in torch to understand how it works���
Implementing from scratch ...
Torch is low level: a lot of (basic) functionality still needs to be implemented��Educational: we implement everything in torch to understand how it works��In Practice: good idea to use suited library on top of torch
Exercises
Machine learning and computer vision with pytorch
Dataset: CIFAR10
���� https://www.cs.toronto.edu/~kriz/cifar.html
First steps in machine learning for vision
First steps in machine learning for vision
https://github.com/constantinpape/training-deep-learning-models-for-vison