Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack...

51
최신 AI 기반 시스템에서 데이터 세트의 중요성 음성 인식 AI 장규환, MathWorks

Transcript of Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack...

Page 1: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

최신AI 기반시스템에서데이터세트의중요성–음성인식AI장규환, MathWorks

Page 2: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

1980s1950s 2010s

ARTIFICIAL INTELLIGENCEAny technique that enables machines to mimic

human intelligence

MACHINE LEARNINGStatistical methods that enable machines to

“learn” tasks from data without explicitly

programming DEEP LEARNINGNeural networks with many layers that learn

representations and tasks “directly” from data

Deep learning is a key technology driving the AI megatrend

Page 3: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

3

What does it take to develop an effective

real-world deep learning system for signal

processing applications?

Page 4: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

4

Deep learning use in signal processing applications is growing rapidly

https://www.mathworks.com/company/user_stories/matlab-based-algorithm-wins-the-2017-physionet-

cinc-challenge-to-automatically-detect-atrial-fibrillation.html

https://library.seg.org/doi/pdf/10.1190/segam2019-3215081.1

https://www.mathworks.com/company/user_stories/ut-austin-researchers-convert-

brain-signals-to-words-and-phrases-using-wavelets-and-deep-learning.html

https://www.mathworks.com/company/mathworks-stories/ai-signal-processing-for-voice-assistants.html

Page 5: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

5

A Practical Example: Trigger Word Detection

(The embedded gateway to your cloud-based voice assistant)

Page 6: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

6

Let's take a look at an example application prototype

Page 7: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Find most of the code for this example online

https://www.mathworks.com/help/audio/examples/keyword-spotting-in-noise-using-mfcc-and-lstm-networks.html

Page 8: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

8

What does it take to develop an effective

real-world deep learning system for signal

processing applications?

Page 9: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

9

A: "The right deep network design"

A: "A lot of data, a good dose of signal processing

expertise, and the right tools for the specific

application in hand"

"A BiLSTM network with layers of 150 hidden

units each, followed by one fully-connected

layer and a softmax layer"

Page 10: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

10

Data Investments in Deep Learning

Research vs. Industry

Research

Models andAlgorithms

Data

Industry

[Man × Hours]

Based on: Andrej Karpathy – Building the Software 2.0 Stack (Spark+AI Summit 2018)

Page 11: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

11

DEVELOP PREDICTIVE

MODELS

Analyze and tune

hyperparameters

Import Reference Models/

Design from scratch

Hardware-Accelerated

Training

Data sources

Data Labeling

CREATE AND ACCESS

DATASETS

Simulation and augmentation

PREPROCESS AND

TRANSFORM DATA

Feature extraction

Transformation

Pre-Processing

ACCELERATE AND DEPLOY

Embedded Devices and

Hardware

Desktop Apps

Enterprise Scale Systems

Page 12: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

▪ Basics on training deep neural networks for signals

▪ Annotating data to train networks for practical applications

▪ Generating new data – synthesis and augmentation

▪ Creating inputs for deep networks

▪ From system models to real-time prototypes

Agenda

Page 13: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Defining a deep network architecture

Page 14: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Long Short Term Memory (LSTM) Layer

(Recursive Neural Networks, RNN)

Page 15: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Defining a deep network architecture

Page 16: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

* Random examples found via web search

(No endorsement implied)

Start from published recipes... ...or import models developed

by others (including from

different frameworks)

Page 17: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training a deep network

Page 18: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters
Page 19: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters
Page 20: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training Set

Validation Set

or "Dev Set"

Page 21: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

▪ Basics on training deep neural networks for signals

▪ Annotating data to train networks for practical applications

▪ Generating new data – synthesis and augmentation

▪ Creating inputs for deep networks

▪ From system models to real-time prototypes

Agenda

21

Page 22: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training, Validation, and Test Data

Your full dataset (All of your data + labels)

Page 23: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training, Validation, and Test Data

Training Validation Test

Used During Training

~60% ~20% ~20%KB – MBGB – TB +

Page 24: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training, Validation, and Test Data

Training

Used During Training

~98%

~1% ~1%

Validation Test

GB – TB +

Page 25: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

A good validation data sample –

Realistic recording, accurately labeled

Page 26: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

How to label new non-annotated data?

For example:

- Humans

Use an intelligent system trained to carry out a

similar tasks with proven accuracy!

Page 27: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters
Page 28: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

How to label new non-annotated data?

For example:

- Humans

- Pre-trained machine learning models

Use an intelligent system trained to carry out a

similar tasks with proven accuracy!

Page 29: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters
Page 30: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

30Full code available here: https://www.mathworks.com/help/audio/ref/audiolabeler-app.html#mw_4e740c85-499f-4087-8d52-95d1b508b7da

Page 31: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training, Validation, and Test Data

Training

Used During Training

~98%

~1% ~1%

Validation Test

?

Page 32: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training Set

Validation Set

or "Dev Set"

Page 33: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

▪ Basics on training deep neural networks for signals

▪ Annotating data to train networks for practical applications

▪ Generating new data – synthesis and augmentation

▪ Creating inputs for deep networks

▪ From system models to real-time prototypes

Agenda

33

Page 34: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Augmentation – Application-Specific Effects

Add Kitchen

Reverberation

Add Washing

Machine Noise

>> auAugm.AugmentationInfoans = struct with fields:

WashingMachineNoise: 9

>> auAugm.AugmentationInfoans = struct with fields:

Reverb: 1

Page 35: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Augmentation – Common Effective Speech Effects

Time

Stretching

Pitch

Shifting

>> data.AugmentationInfo(2)

ans = struct with fields:SemitoneShift: -2

>> data.AugmentationInfo(1)

ans = struct with fields:SpeedupFactor: 1.3

Learn more on audioDataAugmenter

Page 36: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Synthesis – Generative AI models or domain-specific simulations

36

https://www.mathworks.com/matlabcentral/fileexchange/73326-text2speech

New text2speech function Pedestrian and Bicyclist (Radar) Classification

https://www.mathworks.com/help/phased/examples/pedestrian-and-

bicyclist-classification-using-deep-learning.html

WLAN Router Impersonation Detection

https://www.mathworks.com/help/comm/examples/design-a-deep-neural-

network-with-simulated-data-to-detect-wlan-router-impersonation.html

5G Channel Estimation

https://www.mathworks.com/help/5g/examples/deep-learning-data-

synthesis-for-5g-channel-estimation.html

Page 37: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

▪ Basics on training deep neural networks for signals

▪ Annotating data to train networks for practical applications

▪ Generating new data – synthesis and augmentation

▪ Creating inputs for deep networks

▪ From system models to real-time prototypes

Agenda

37

Page 38: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Training deep networks with time-domain signals

most often requires extracting features

Domain-Specific

Feature ExtractionLong Short Term Memory (LSTM) NetworksLabel

Deep learning ≠ End-to-end learning

Page 39: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Different applications require different feature extraction techniques

... ...

spectrogram, stft melSpectrogram

mfcc

Page 40: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

cwt(Continuous wavelet transform)

wsstridge(Synchrosqueezing)

Many other time-frequency transforms and signal features

waveletScattering

cqt(Constant Q transform)

(Spectral statistics) (Harmonic analysis)

Page 41: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Extract Features

Extract Features

Extract Features

Train

Augment

Augment

Augment

Providing Input Data for Network Training

Label...

...

...

...

...

...

...

...

...

Label

Label

Label

Label

Label

Label

Label

Label

...

...

...

Label

Label

Label

La

be

lL

ab

el

La

be

l

...

gpuArray

mfcc

Page 42: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

InferenceExtract Features

Using Network for Prediction (aka Inference)

...

... ...

Mask

Page 43: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

...

Inference

Extract Features

Mask

...

... ...

Trigger

Using Network for Prediction (aka Inference)

[...]

[...]

Page 44: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

▪ Basics on training deep neural networks for signals

▪ Annotating data to train networks for practical applications

▪ Generating new data – synthesis and augmentation

▪ Creating inputs for deep networks

▪ From system models to real-time prototypes

Agenda

44

Page 45: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

DEVELOP PREDICTIVE

MODELS

Analyze and tune

hyperparameters

Import Reference Models/

Design from scratch

Hardware-Accelerated

Training

Data sources

Data Labeling

CREATE AND ACCESS

DATASETS

Simulation and augmentation

PREPROCESS AND

TRANSFORM DATA

Feature extraction

Transformation

Pre-Processing

ACCELERATE AND DEPLOY

Embedded Devices and

Hardware

Desktop Apps

Enterprise Scale Systems

Page 46: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Inference

Extract Features

Mask

...

... ...

Trigger

Using Network for Prediction (aka Inference)

triggerWordDetector.m

>> generateAudioPlugin triggerWordDetector

[...]

[...]

Page 47: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

>> generateAudioPlugin triggerWordDetector

Page 48: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

>> generateAudioPlugin triggerWordDetector

Page 49: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

49

Deploy to any processor with best-in-class performance

AI models in MATLAB and Simulink can be deployed on embedded devices, edge devices,

enterprise systems, the cloud, or the desktop.

FPGA

CPU

GPUCode

Generation

Page 50: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

Q: "What do I need to develop such a system?"

A: "A simple and proven deep learning model"

A: "A lot of data, a good dose of signal processing

expertise, and the right tools for the specific

application in hand"

Deep learning systems can only be as

good as the data used to train them

Page 51: Template for MATLAB EXPO 2019€¦ · Based on: Andrej Karpathy –Building the Software 2.0 Stack (Spark+AI Summit 2018) 11 DEVELOP PREDICTIVE MODELS Analyze and tune hyperparameters

mathworks.com

© 2020 The MathWorks, Inc. MATLAB and Simulink are registered

trademarks of The MathWorks, Inc. See

www.mathworks.com/trademarks for a list of additional

trademarks. Other product or brand names may be trademarks or

registered trademarks of their respective holders.