File Exchange Pick of the Week

Our best user submissions

Industrial Machinery Anomaly Detection

Rachel is the product manager for predictive maintenance at MathWorks.

Rachel's pick this week is Industrial Machinery Anomaly Detection using an Autoencoder which she submitted! Today's pick was featured in the Predictive Maintenance Using Deep Learning talk at MATLAB EXPO 2021.

How do you know if a machine is operating normally? That's the question this week's pick aims to answer, by using deep learning to detect anomalies in normal vibration data from an industrial machine. Anomaly detection has lots of uses, but it's particularly useful in Predictive Maintenance.

This example uses deep learning in the form of a bi-directional LSTM-based autoencoder. That's a mouthful, but it's just training a network to reconstruct "normal" operating data. That way, when we feed the algorithm some data that looks different, the reconstruction error will indicate that there's a problem – maybe the machine needs maintenance. Autoencoders are a good approach to try when all you have for sure is "normal" data.

The dataset has two parts: data from right before maintenance, and data from right after maintenance. We can logically assume the data right after maintenance is "normal" (that is, if we have a competent maintenance team!) We aren't so sure about the before data.

Here's two sample members of the dataset overlaid on top of each other.

Rather than training on raw signals, it often helps to extract features that can better differentiate between the before and after data. Use the Diagnostic Feature Designer app to automatically extract and rank features from all the data at once. Then, the app can automatically create a function generateFeatures to redo all that work programmatically. Neat!

trainFeatures = generateFeatures(trainData);

Here's that biLSTM autoencoder.

featureDimension = 1;

% Define biLSTM network layers
layers = [ sequenceInputLayer(featureDimension, 'Name', 'in')
    bilstmLayer(16, 'Name', 'bilstm1')
    reluLayer('Name', 'relu1')
    bilstmLayer(32, 'Name', 'bilstm2')
    reluLayer('Name', 'relu2')
    bilstmLayer(16, 'Name', 'bilstm3')
    reluLayer('Name', 'relu3')
    fullyConnectedLayer(featureDimension, 'Name', 'fc')
    regressionLayer('Name', 'out') ];

An autoencoder works something like this: train a network on normal data. If you then pass it normal data, it'll be able to reconstruct it really well. If you pass it something that doesn't look normal, it won't be able to reconstruct it, and you'll be able to see that in the reconstruction error.

Train the network on the top four ranked features from each channel – from the normal (after maintenance) data only.

By picking the right threshold for reconstruction error, the algorithm identifies anomalies with pretty high accuracy. In this case we had some test data that we knew was anomalous, so we could test the algorithm accuracy explicitly. Pretty good!

Try out this method on your own data and see what you think in the comments.



Published with MATLAB® R2021b

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.