Introduction to Deep Learning with Python
Samar HaiderUniversity of Engineering and Technology, Lahore
PyCon Pakistan16/12/2017
Artificial intelligence, machine learning & deep learning
The AI universe
Samar Haider PyCon Pakistan 2017 3
Goodfellow et. al., “Deep Learning.” MIT Press (2016)
The AI universe
“What's the difference between AI and ML?”
“It's AI when you're raising money, it's ML when you're trying to hire people.”
Samar Haider PyCon Pakistan 2017 4
Machine learning
Samar Haider PyCon Pakistan 2017 5
Data
Machine learning
Samar Haider PyCon Pakistan 2017 6
Learning Algorithm
Data
Machine learning
Samar Haider PyCon Pakistan 2017 7
Hypothesis
Learning Algorithm
Data
Machine learning
Samar Haider PyCon Pakistan 2017 8
HypothesisInput Prediction
Data
Learning Algorithm
Machine learning
Samar Haider PyCon Pakistan 2017 9
Engineer features Learn mapping
Data Features Labels
Deep learning
Samar Haider PyCon Pakistan 2017 10
Learn features Learn mapping
Data Features Labels
The rise of deep learning
Samar Haider PyCon Pakistan 2017 11
The rise of deep learning
Samar Haider PyCon Pakistan 2017 12
Goodfellow et. al., “Deep Learning.” MIT Press (2016)
The rise of deep learning
Samar Haider PyCon Pakistan 2017 13
Dean, “Large-Scale Deep Learning for Intelligent Computer Systems.” WSDM (2016)
The rise of deep learning
1. Bigger datasets
2. More computational power
3. Improvements in algorithms (due to 1 and 2)
Samar Haider PyCon Pakistan 2017 14
The rise of deep learning
“If big data is the new oil, deep learning is the new internal combustion engine.”
– Yann LeCun
(Director, Facebook AI Research)
Samar Haider PyCon Pakistan 2017 15
The rise of deep learning
“AI is the new electricity: Just as electricity transformed almost everything 100 years ago, today I actually have a hard time thinking of an industry that I don’t think AI will transform in the next several years.”
– Andrew Ng
(Founder, deeplearning.ai)
Samar Haider PyCon Pakistan 2017 16
Neural networks
Biological neuron
Samar Haider PyCon Pakistan 2017 18
Artificial neuron
Samar Haider PyCon Pakistan 2017 19
Biological vs artificial neuron
Samar Haider PyCon Pakistan 2017 20
Activation functions
Samar Haider PyCon Pakistan 2017 21
Sze et. al., “Efficient Processing of Deep Neural Networks: A Tutorial and Survey.” arXiv (2017)
Activation functions
Samar Haider PyCon Pakistan 2017 22
LeCun et. al., “Deep Learning.” Nature (2015)
A shallow neural network
Samar Haider PyCon Pakistan 2017 23
A deep neural network
Samar Haider PyCon Pakistan 2017 24
What we want
Samar Haider PyCon Pakistan 2017 25
Good features/representations
Correct predictions
What we want
Samar Haider PyCon Pakistan 2017 26
Goodfellow et. al., “Deep Learning.” MIT Press (2016)
The need for depth
Samar Haider PyCon Pakistan 2017 27
Goodfellow et. al., “Deep Learning.” MIT Press (2016)
… and even more depth
Samar Haider PyCon Pakistan 2017 28
Szegedy et. al., “Going Deeper with Convolutions.” CVPR (2015)
Specialized architectures
Vision: Convolutional Neural Networks
Samar Haider PyCon Pakistan 2017 29
Specialized architectures
Language: Recurrent Neural Networks
Samar Haider PyCon Pakistan 2017 30
Deep learning
The learning process
1. Pick a training example
2. Make a prediction for it
3. Compare your prediction with the truth (= error)
4. Modify your weights in order to minimize this error
5. Repeat until convergence
Samar Haider PyCon Pakistan 2017 32
Minimizing the error
Samar Haider PyCon Pakistan 2017 33
Gradient descent
Samar Haider PyCon Pakistan 2017 34
Gradient descent in higher dimensions
Samar Haider PyCon Pakistan 2017 35
Learning multiple layers
Samar Haider PyCon Pakistan 2017 36
Forward pass
Samar Haider PyCon Pakistan 2017 37
Backward propagation
Samar Haider PyCon Pakistan 2017 38
Backward propagation
Samar Haider PyCon Pakistan 2017 39
Backward propagation
Samar Haider PyCon Pakistan 2017 40
Backward propagation
Samar Haider PyCon Pakistan 2017 41
Backpropagation algorithm in full
Samar Haider PyCon Pakistan 2017 42
LeCun et. al., “Deep Learning.” Nature (2015)
Applications
Object Detection
Samar Haider PyCon Pakistan 2017 44
Ren et. al., “Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks.” NIPS (2015)
Scene segmentation
Samar Haider PyCon Pakistan 2017 45
Badrinarayanan et. al., “SegNet: A Deep Convolutional Encoder-Decoder Architecture…” PAMI (2016)
Super resolution
Samar Haider PyCon Pakistan 2017 46
Dahl et. al., “Pixel Recursive Super Resolution.” arXiv (2017)
Style transfer
Samar Haider PyCon Pakistan 2017 47
Gatys et. al., “A Neural Algorithm of Artistic Style.” arXiv (2015)
Image translation
Samar Haider PyCon Pakistan 2017 48
Liu et. al., “Unsupervised Image-to-Image Translation Networks.” NIPS (2017)
Image generation
Samar Haider PyCon Pakistan 2017 49
Karras et. al., “Progressive Growing of GANs for Improved Quality, Stability, and Variation.” arXiv (2017)
Image generation
Samar Haider PyCon Pakistan 2017 50
Karras et. al., “Progressive Growing of GANs for Improved Quality, Stability, and Variation.” arXiv (2017)
Learning word representations
Samar Haider PyCon Pakistan 2017 51
Mikolov et. al., “Efficient Estimation of Word Representations in Vector Space.” arXiv (2013)
Learning sentiment representations
Samar Haider PyCon Pakistan 2017 52
Radford et. al., “Learning to Generate Reviews and Discovering Sentiment.” arXiv (2017)
Image captioning
Samar Haider PyCon Pakistan 2017 53
Vinyals et. al., “Show and Tell: A Neural Image Caption Generator.” CVPR (2015)
Visual question answering
Samar Haider PyCon Pakistan 2017 54
Yang et. al., “Stacked Attention Networks for Image Question Answering.” CVPR (2016)
Playing games
Samar Haider PyCon Pakistan 2017 55
Silver et. al., “Mastering the Game of Go with Deep Neural Networks and Tree Search.” Nature (2016)
Building better neural networks
Samar Haider PyCon Pakistan 2017 56
Zoph et. al., “Neural Architecture Search with Reinforcement Learning.” ICLR (2017)
Building better software
Samar Haider PyCon Pakistan 2017 57
Kraska et. al., “The Case for Learned Index Structures.” arXiv (2017)
What you need to get started with deep learning
These, pretty much
Samar Haider PyCon Pakistan 2017 59
… plus a handful of other stuff
Samar Haider PyCon Pakistan 2017 60
https://medium.com/towards-data-science/building-your-own-deep-learning-box-47b918aea1eb
Building a deep learning rig
Samar Haider PyCon Pakistan 2017 61
https://pcpartpicker.com/list/FRp8XH
An alternative
Samar Haider PyCon Pakistan 2017 62
Amazon Web Services
Samar Haider PyCon Pakistan 2017 63
Amazon Web Services
Samar Haider PyCon Pakistan 2017 64
Amazon Web Services
Samar Haider PyCon Pakistan 2017 65
Deep learning software ecosystem
Samar Haider PyCon Pakistan 2017 66
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
https://twitter.com/fchollet/status/915366704401719296
A typical beginner stack
Samar Haider PyCon Pakistan 2017 67
A typical beginner stack
Samar Haider PyCon Pakistan 2017 68
A typical beginner stack
Samar Haider PyCon Pakistan 2017 69
A typical beginner stack
Samar Haider PyCon Pakistan 2017 70
Deep learning in a day
1. Create an AWS account
2. Launch an EC2 instance
3. SSH into your instance
4. Launch a Jupyter Notebook
5. ???
6. Profit!
Samar Haider PyCon Pakistan 2017 71
Samar Haider PyCon Pakistan 2017 72
Samar Haider PyCon Pakistan 2017 73
Samar Haider PyCon Pakistan 2017 74
Samar Haider PyCon Pakistan 2017 75
Samar Haider PyCon Pakistan 2017 76
Samar Haider PyCon Pakistan 2017 77
Samar Haider PyCon Pakistan 2017 78
Samar Haider PyCon Pakistan 2017 80
Samar Haider PyCon Pakistan 2017 83
Where to learn more
Courses
fast.aiby Jeremy Howard
Samar Haider PyCon Pakistan 2017 85
Courses
Samar Haider PyCon Pakistan 2017 86
deeplearning.aiby Andrew Ng
Books
Samar Haider PyCon Pakistan 2017 87
Goodfellow
Bengio
& Courville
Books
Samar Haider PyCon Pakistan 2017 88
Michael Nielsen
Papers
Samar Haider PyCon Pakistan 2017 89
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton, “Deep Learning.” Nature (2015)
Most Cited Deep Learning Papers
https://github.com/terryum/awesome-deep-learning-papers
Deep Learning Papers Reading Roadmap
https://github.com/songrotek/Deep-Learning-Papers-Reading-Roadmap
Demos
Samar Haider PyCon Pakistan 2017 90
TensorFlow Playground
https://playground.tensorflow.org/
ConvNetJS
https://cs.stanford.edu/people/karpathy/convnetjs/
Quick, Draw!
https://quickdraw.withgoogle.com/
“Software is eating the world, but AI is going to eat software.”
– Jensen Huang
(CEO, Nvidia)
Samar Haider PyCon Pakistan 2017 91
Thank you
@samarhdr