Deep Learning Fundamentals with PyTorch
Deep Learning Fundamentals with PyTorch
Deep Learning
of the course
withPytorch
Juan Pablo Morales
@juanpamf
What is Deep
Learning?
Deep Learning
1950-1990: Creation of
main algorithms for
training of NNs
1990:Difficulties in
train deep models
Investigation
2010: Deepwater Horizon Explosion
Learning
The boom of deep learning
Achievements
Resolution with almost human performance of
a large part of the perception tasks:
Vision: object detection, segmentation
semantics
Listening: Speech-to-text, sound playback
Language: Machine translation
○Juegos: Ajedrez, Go, LoL, SC2
Increasingly impacting more fields, such as the
physics, medicine, and finance.
2018 Turing Award
Applications: Generative DL
Aplicaciones: MusicVAE
Applications: Pix2Pix
Applications: CycleGAN
Why the Deep
Learning now?
What changed?
Labeled datasets
large size
GPUs and hardware
Improvements in the
algorithms
Open Source Software
Labeled Datasets or
labeled
´
Work cycle in
Deep Learning
The importance of understanding
how a network learns
Model space H
A loss function L
An optimization method
Model prediction:
Loss function:
●Problema de minimización:
Model space
parameterized
A flow with similarities to ML
traditional
Objective
Data preparation
Features
Learning algorithm
Set the parameters (internal settings)
Tuning
Hyperparameter search (external settings)
Differences: Preparation of
the data
Differences: Algorithm of
learning
Differences: Algorithm of
learning
Diferencias: Tuning
Deep learning flow
Architecture:
Layers
Model space
Model space
●Locally connected
They share parameters
Very efficient without having a high cost!
Convolutional architecture
Classical architecture:
(Conv - ReLU - Pool)* - FC
Formula for convolutions
Last FC Sin
Layer activation
x1 x1
L = Squared error
average
(MSE)
Binary Classification
Last
Sigmoid
FC Layer
x1 y1
L = Entropy
binary crusade
(BCE)
Multiclass Classification
Last FC Softmax
Layer
x1 x1
x2 x2
L = Negative Log-
x3 x3 Likelihood
(NLL)
x4 x4
x5 x5
Classification
Multiclass Multilabel
Ultima FC Sigmoid
Layer
x1 x1
x2 x2
x3 x3 L = BCE
x4 x4
x5 x5
In summary
In deep learning
(large datasets):
Training: 98%
Validation: 1%
Test: 1%
Underfitting-Overfitting
Regularization of
Neural Networks
deep
Build a
good model of
deep learning
The recipe for building a neural network
good performance is similar to the
machine learning models:
1. Build a simple first model that achieves
learn about the data.
2. This model probably despite having
learned to be very simple and have bias
(underfitting).
3. Increase the model capacity until it overfits.
4. Regularize to find the right balance
between underfitting and overfitting.
How to control capacity
of my model
To increase capacity:
Add layers
Add number of neurons per layer
Increase the number of epochs
Choose another optimization method.
complex (adaptability, momentum, etc.)
To decrease the capacity:
Train with a larger amount of data
Use regularization techniques
L2 or weight decay
Algorithm
With a certain probability p
we will deactivate certain
neurons (== 0)
In each iteration, the layer
it will recalculate if 'deactivates' one
neuron.
During the training phase
dropout acts, during the phase of
evaluation of dropout layers
they have no effect.
Data augmentation
Optimization of
hyperparameters
Babysitting (panda)
Learning rate
Momentum
Mini-batch size
Neurons in each layer
Number of layers
The problem
what we will resolve
Style transfer
Types of transfer
of style
●Example based vs
Collection Based
Collection Based
Paired
Unpaired
A common tool:
the GAN
GANs
The greatest innovation in
network architectures
post-2010 neural
Ian Goodfellow, MIT Top 35
under 35, Forbes top 40
under 40, etc.
Architecture:
Generative Network
Discriminative Network
Zero-sum game (losses
opposite)
GANs
Loss of GANs
●4 networks:
○G_x_y
○G_y_x
○D_x
○D_y
Deep
Convolutional
GANs
DCGAN Tips
CycleGAN loss
Anonymous