introduction to deep learning - heriot-watt university · introduction to deep learning musab...

39
1 © 2018 The MathWorks, Inc. Introduction to Deep Learning Musab Khawaja Application Engineer [email protected]

Upload: others

Post on 22-May-2020

28 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

1© 2018 The MathWorks, Inc.

Introduction to Deep Learning

Musab Khawaja

Application Engineer

[email protected]

Page 2: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

2

What is deep learning?

Page 3: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

3

Deep learning is a type of machine learning in which a model learns to

perform automated predictions directly from images or sequences such as

text, sound.

Deep learning is usually implemented using a neural network architecture.

What is Deep Learning?

Page 4: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

4

Diverse Applications of Deep Learning

Automated iris recognition – 99.4% accuracy1

1. “An experimental study of deep convolutional features for iris recognition” Minaee et al

2. “Learning to See in the Dark” Chen et al

3. “Cardiologist-Level Arrhythmia Detection with Convolutional Neural Networks” Rajpurkar et al

Cardiologist-level arrhythmia detection3

Seeing in the dark – boosting the contrast of an image2

ISO 8,000 ISO 400,000 Deep Learning

Page 5: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

5

Deep Learning vs Other TechniquesClassical Image Processing

▪ Classical image processing to create a set of rules, heuristics

▪ What happens when the image changes slightly?

Page 6: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

6

Deep Learning vs Other TechniquesMachine Learning

▪ Classical image processing to extract summary statistics – “features”

▪ Machine learning to find patterns amongst the features

▪ What happens when the image changes?

Machine

learning

Page 7: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

7

Deep Learning vs Other TechniquesDeep Learning

▪ Automated feature extraction, using whole images

Rabbit

Kangaroo

Bus

Page 8: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

8

Why Now?

▪ Publicly available labelled data

▪ Increased GPU acceleration

▪ Race for better models through challenges

– e.g. ImageNet image recognition

– Models are then made publicly available

AlexNetPRETRAINED MODEL

ResNet PRETRAINED MODEL

VGG-16PRETRAINED MODEL

GoogLeNetPRETRAINED MODEL

And many more…

Page 9: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

9

Human

Accuracy

Why now?

ImageNet Challenge

Source: ILSVRC Top-5 Error on ImageNet

Page 10: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

10

How does deep learning work?Network architecture

Input OutputHidden (n)

• Pass data in

• Perform operations

• Get output prediction

• Training: the process of tuning

the weights in the hidden

layers so that the predicted

output matches the expected

output

• Inference/prediction: pass new

input through the network,

obtain prediction

Page 11: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

11

Deep learning in MATLAB

Page 12: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

12

Demo: Deep Learning in 12 Lines of Code

Page 13: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

14

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

Files Databases Sensors

▪ Import data from multiple sources

Cloud

Page 14: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

15

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

LABELLING AND

PREPROCESSING

▪ Apps for labelling data

Ground Truth Labeler App

Page 15: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

16

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

LABELLING AND

PREPROCESSING

▪ Apps for labelling data

▪ Load reference models

AlexNetPRETRAINED MODEL

ResNet PRETRAINED MODEL

VGG-16PRETRAINED MODEL

GoogLeNetPRETRAINED MODEL

And many more…

Page 16: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

17

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

LABELLING AND

PREPROCESSING

▪ Apps for labelling data

▪ Load reference models

▪ Import models from other frameworks

– Caffe

– Keras-Tensorflow

– ONNX

Page 17: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

18

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

DEVELOP PREDICTIVE

MODELS

LABELLING AND

PREPROCESSING

▪ Train from scratch

▪ Transfer learning

Page 18: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

19

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

DEVELOP PREDICTIVE

MODELS

LABELLING AND

PREPROCESSING

▪ Train from scratch

▪ Transfer learning

▪ Visualise networks

Deep Network Designer App

Page 19: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

20

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

DEVELOP PREDICTIVE

MODELS

LABELLING AND

PREPROCESSINGDEPLOY AND SCALE

▪ Code generation

MATLAB

Coder

Products

Deep Learning

Networks

NVIDIA

TensorRT &

cuDNN

Libraries

ARM

Compute

Library

Intel

MKL-DNN

Library

Page 20: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

21

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

DEVELOP PREDICTIVE

MODELS

LABELLING AND

PREPROCESSINGDEPLOY AND SCALE

▪ Code generation

▪ Web deployment with MATLAB Production Server

MATLAB Production Server

HTML

XML

Java Script

Web Server(s)

Page 21: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

22

Deep Learning Made Easy in MATLAB

ACCESS AND EXPLORE

DATA

DEVELOP PREDICTIVE

MODELS

LABELLING AND

PREPROCESSINGDEPLOY AND SCALE

▪ Code generation

▪ Web deployment with MATLAB Production Server

▪ Scale up your processing

– MATLAB Distributed Computing Server (MDCS)

– 1 click deployment of virtual machines to the cloud

Page 22: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

23

Deep Learning Made Easy in MATLABPlenty of documentation Examples

Page 23: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

24

Deep Learning Made Easy in MATLABPlenty of documentation examples

Page 24: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

25

Deep Learning for Machine Vision at Shell

James Martin & Amjad Chaudry

Advanced Analytics COE

Page 25: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

26

Terrain recognition in hyper-spectral satellite data

• $10m’s spent on land seismic acquisition each year.

• Terrain type very important to daily shot target.

• Currently manually drawn polygons on satellite/drone

images + direct site visits - weeks.

• Automate whole workflow with DL semantic segmentation

approach (segnet).

Radar image with rough polygons overlaid

Page 26: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

27

Data prep – colour composite images

27

◼Aerial photo (RGB)

◼Radar

◼DSM

RGB

BW

BW

BW

Page 27: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

28

Network (SegNet)

28

Colour

composite

Classified image

• Currently trained with 1000 examples.

• 3 encoder and decoder sections.

• 8 hours to train on 4Gb GPU.

Page 28: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

29

Prediction (Semantic segmentation)

29

Page 29: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

30

Delivery via WebApp

• Customers interaction via WebApp tool.

• Can upload new data and regions of interest.

30

Page 30: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

31

Terrain recognition – next steps

• Optimise network and training parameters.

• Increase training data.

• Add more modalities and classes.

• Tailor app to business demands.

• Business wants technology integration + upskilling staff.

• Potential for further work with Middle East and Asian business

units.

Facilities class

Additional drone data

Page 31: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

32

Tag recognition:

Identifying Machinery at Location

3

2

Page 32: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

33

Regional Convolutional Neural Networks

Region proposal:

Use a standard

method

Use pre-trained Neural Network,

and adapt to our specific task using

“transfer learning”

Page 33: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

34

Region proposals

Pdollar’s EdgeBoxes

Fish-eye correction

Page 34: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

35

Training labels and ‘attention’ areas

Training dataset

Page 35: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

36

Identified tags ready for OCR and integration into SAP

Page 36: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

37

Tag recognition – next steps

• Transfer learning used to identify tags in industrial images.

• OCR to extract SAP codes.

• Currently 3-4 minutes detection, considering Fast RCNN for 100x

improvement.

• Use larger GPU to increase image size of network (VGG16).

• Ready to experiment with augmented reality overlay of information.

• Further interest from European and Asian business units.

Page 37: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

38

Wrap Up and Next Steps

Page 38: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

39

Wrap Up

▪ Deep learning is well-suited to problems where:

– You have plenty of (labelled) data

– It is hard to find a good set of features to use

– You need your algorithm to generalise well to different situations

– You don’t mind your model being very complex

– Systems that will run autonomously, need to scale and adapt

▪ Not a substitute for physical insights, domain knowledge – it’s about fitting

models to data

▪ BUT very effective for image-based tasks

– In many cases easier than alternatives

– Easy to try in MATLAB: lots of universities have campus-wide licences to all of our tools

Page 39: Introduction to Deep Learning - Heriot-Watt University · Introduction to Deep Learning Musab Khawaja Application Engineer musab.khawaja@mathworks.co.uk. 2 What is deep learning?

40

Hands on deep learning workshop

Go to MATLAB Academy https://matlabacademy.mathworks.com/ and launch

the Deep Learning Onramp