Deep Learning For Signal Processing
Deep Learning For Signal Processing
Introduction
Deep learning networks have been used for image classification for many years, but they are powerful tools for signal
data as well. A deep learning network can do everything a mathematical model can do without requiring you to
know which signal features to bring into the model. The network itself decides these features during the training
process.
Whether the input data is a 1D signal, time-series data, or even text, deep learning networks such as convolutional
neural networks (CNNs) make it possible to process data in new ways. They open doors to non-specialists—you
don’t need to be a signal processing expert to run a signal through a CNN—and can yield accurate results very
quickly.
This white paper reviews some deep learning basics and then describes three signal processing examples:
• Speech command recognition
• Remaining useful life (RUL) estimation
• Signal denoising
These examples will show you how deep learning with MATLAB® can make signal processing tasks quicker and with
more accurate results.
W H I T E PA P E R | 2
Deep Learning for Signal Processing with MATLAB
CRICKET
CAR
OWL
TRUCK
RACOON
VAN
BAT
BICYCLE
FULLY
FULLY
INPUT
INPUT CONVOLUTION + RELU
CONVOLUTION + RELU POOLING
POOLING CONVOLUTION + RELU
CONVOLUTION + RELU POOLING
POOLING FLATTEN
FLATTEN SOFTMAX
SOFTMAX
CONNECTED
FEATURE
FEATURE LEARNING
LEARNING CLASSIFICATION
CLASSIFICATION
Architecture of a CNN comprising commonly used layers such as convolution, ReLU, and pooling.
An LSTM is a type of recurrent neural network (RNN) that can learn long-term dependencies between time steps of
sequence data. Unlike a CNN, an LSTM can remember the state of the network between predictions.
The core components of an LSTM network are a sequence input layer and an LSTM layer. A sequence input layer
incorporates time-series data into the network. An LSTM layer learns long-term dependencies between time steps of
sequence data over time.
Selecting a Network
A CNN is typically used in signal and time series prediction when the input signal has been converted into an
“image” by transforming it from 1D into a 2D representation.
An LSTM is good for classifying sequence and time-series data, when the prediction or output of the network must
be based on a remembered sequence of data points.
with image data. Often, you can pass raw images into a you may get better results if you use machine learning
network and get results, but the same workflow is highly and manually extract the most relevant features. While
unlikely to work with signals. Most raw signal data is the results can be impressive, this approach requires more
noisy, variable, and smaller than image data. Careful signal processing knowledge than deep learning.
W H I T E PA P E R | 3
Deep Learning for Signal Processing with MATLAB
The Workflow
The main steps in the deep learning workflow are as follows:
No matter which network configuration you use, or which problem you are using deep learning to solve, the process
is always iterative: If the network does not give you the accuracy you’re looking for, you go back and change the setup
to see if there are ways to improve it.
Each of the following examples follows this basic workflow.
W H I T E PA P E R | 4
Deep Learning for Signal Processing with MATLAB
Top: Original audio signals. Bottom: The audio signals’ corresponding spectrograms.
Follow along in MATLAB: Get the full example and a link to the data set
W H I T E PA P E R | 5
Deep Learning for Signal Processing with MATLAB
Wavelets are also used in an automated feature extraction technique called wavelet scattering or “invariant
scattering convolutional networks.” This technique mimics the features learned in the first few layers of a CNN.
However, they use fixed weight patterns, which don’t need to be learned from data, significantly reducing
requirements for network complexity and training data size.
Next, we divide the data into three sets:
• Training data: the original input data, which the network will use to learn and understand features
• Validation data: to be used while the network is training to verify the algorithm is learning features while also
generalizing its understanding of the data
• Testing data: data the network has never seen before, which will be passed into the network after training to
assess the network performance while making sure the result is unbiased
We distribute the training data evenly between the classes of words we want to classify.
To reduce false positives, we include a category for words likely to be confused with the intended categories. For
example, if the intended word is “on,” then words like “mom”, “dawn”, and “won” would be placed in the “unknown”
category. The network does not need to know these words, just that they are NOT the words to recognize.
used for image classification. For this application, we’ll research paper or other published source and modify it
W H I T E PA P E R | 6
Deep Learning for Signal Processing with MATLAB
It is up to the designer of the network to determine how many iterations of convolution, batch normalization, and
ReLU to perform, but keep in mind that the more complex the network, the more data required to train and test it.
W H I T E PA P E R | 7
Deep Learning for Signal Processing with MATLAB
The network will learn to identify unique features in these samples and classify them accordingly. As we’re dealing
with spectrogram data, the learning process is essentially image classification: The initial layers of the network learn
broad features in the spectrogram, such as color, thickness, and orientation of lines and shapes. As training
continues, the network identifies more fine-grained features of the individual signals.
This result might be acceptable for a simple speech-recognition task, but if we wanted to implement the model in,
say, a security system or a voice-activated device, we’d need higher accuracy.
This is where we really start to see the value of a deep learning approach: It gives us a variety of options for achieving
greater accuracy. We can improve the result by simply adding more training samples to the network. To gain more
insight into where the network is making incorrect predictions, we can visualize a confusion matrix.
W H I T E PA P E R | 8
Deep Learning for Signal Processing with MATLAB
The confusion matrix shows the network’s predicted class (word) versus the true class. The blue shades indicate correct predictions,
while beige shows incorrect predictions.
With deep learning we can keep going until we get the accuracy we want. With traditional signal processing we
would need considerable expertise to understand the nuances of the signal.
W H I T E PA P E R | 9
Deep Learning for Signal Processing with MATLAB
The first step, choosing the sensors (feature selection), is no easy task. A system often has upwards of 50 sensors, not
all of which exhibit signs of stress as the system approaches failure. With deep learning, the model does the feature
extraction for us. The network identifies which sensors are the best predictors of a problem.
Follow along in MATLAB: Get the full example and a link to the data set
The data set contains training and test observations, as well as a vector of actual RUL values to use for validation.
Each time series represents a single engine. Each engine operates normally at the start of a time series and develops a
fault at some point during the series. In the training set, the fault grows to the point of system failure.
W H I T E PA P E R | 10
Deep Learning for Signal Processing with MATLAB
Clip responses. Clipping the responses focuses the network on the point at which the system starts to fail. The figure
below shows the sensor data for one engine (top plot) and the remaining useful life for the sensor data at each point
(bottom plot). Initial values of the signal (shown in green) that are more than 150 cycles from failure have their
remaining useful life value capped at 150, forcing the network to be somewhat conservative.
Top: Sensor data for one engine. Bottom: RUL for the sensor data at each point.
W H I T E PA P E R | 11
Deep Learning for Signal Processing with MATLAB
With these settings, training the network will take about element-wise moving average of both the parameter
two minutes. We plot the training progress while the gradients and their squared values.
W H I T E PA P E R | 12
Deep Learning for Signal Processing with MATLAB
Because predicting RUL is a regression problem, the first plot shows the progression of the root mean squared error
(RMSE) instead of accuracy. The lower the number, the closer the predicted time to failure to the actual values.
W H I T E PA P E R | 13
Deep Learning for Signal Processing with MATLAB
To visualize the performance of the network, we select data from four test engines and plot the true remaining useful
life against the prediction.
Model predictions for four engines (100, 52, 67, and 45) comparing the actual RUL (dotted blue line) and the estimated RUL (orange line).
The LSTM provides reasonably accurate time-to-failure estimates for engines 100 and 45, but less accurate estimates for
engines 52 and 67. This result may indicate that we need more training data representative of the engine’s performance
in those cases. Alternatively, we could tweak the network training settings and see if performance improves.
In this example we have designed, trained, and tested a simple LSTM network and used that network to predict
remaining useful life. By using deep learning instead of traditional signal processing, we eliminated the difficult and
time-consuming task of feature extraction.
W H I T E PA P E R | 14
Deep Learning for Signal Processing with MATLAB
Follow along in MATLAB: Get example files and the full example
W H I T E PA P E R | 15
Deep Learning for Signal Processing with MATLAB
The predictor input consists of eight consecutive noisy STFT vectors, so each STFT output estimate is computed based on the current noisy STFT and
the seven previous noisy STFT vectors for more context.
W H I T E PA P E R | 16
Deep Learning for Signal Processing with MATLAB
W H I T E PA P E R | 17
Deep Learning for Signal Processing with MATLAB
W H I T E PA P E R | 18
Deep Learning for Signal Processing with MATLAB
Summary
Deep learning for signal processing helps engineers create accurate, reusable models and reduces the expertise
needed to extract and select features in signals and make changes to improve a model’s performance.
In the speech recognition and signal denoising examples, we showed how to prepare and transform the audio data to
use in a CNN and fully connected network, respectively. We visualized the performance of the models and looked at
how to make changes without considerable signal processing expertise.
In the RUL example we used an LSTM and preprocessed the sensor data to give the network the best data possible
and created a working model without manual feature extraction and selection.
Additional Resources
MATLAB for Deep Learning
Deep Learning for Signals and Sound
© 2019 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See mathworks.com/trademarks for a list of additional trademarks.
Other product or brand names may be trademarks or registered trademarks of their respective holders.
W H I T E PA P E R | 19