Detect Air Compressor Sounds in Simulink Using Wavelet Scattering
This example shows how to use wavelet scattering and a pretrained deep learning network within a Simulink® model to classify audio signals obtained from an air compressor.
The deep learning network is pretrained using a data set that contains recordings from air compressors. The deep learning network is paired with a wavelet scattering network. The data set is classified into eight classes, one healthy state and seven faulty states. For more information on training, see Fault Detection Using Wavelet Scattering and Recurrent Deep Networks (Wavelet Toolbox).
To download this pretrained network and a set of air compressor sounds to detect, run the following commands. These commands download and unzip the files to a location on the MATLAB® path. The airCompressorWaveletNet.mat
file stores the pretrained network.
zipFile = matlab.internal.examples.downloadSupportFile('dsp','AirCompressorWaveletScatteringNet.zip'); dataFolder = fileparts(zipFile); unzip(zipFile,dataFolder); addpath(fullfile(dataFolder,'WaveletScatteringNet'))
Open the AirCompressorHealthModel.slx
model. Click the Select State
block. The sound type by default is set to 'Bearing'
. The model contains a Wavelet Scattering block followed by an Stateful Classify block. The Wavelet Scattering block parameters are identical to the waveletScattering
parameters in the original training example, with the exception of SignalLength
. In this example, the network is trained with a shorter signal length (16e3) to reduce latency.
Run the model. The Wavelet Scattering block generates a 329-by-8 matrix of features from the input audio. The Stateful Classify block uses the airCompressorWaveletNet.mat
file and classifies the signal into one of the eight classes the model is trained on. The label of the predicted class is displayed using the Display block. The scope shows the score of the predicted class and the other classes.
open_system("AirCompressorHealthModel.slx") sim("AirCompressorHealthModel.slx")
While the simulation is running, you can change the input sound by double clicking the Select State block and choosing a different type of sound from the drop-down list.
For this example, select 'Healthy'
while the simulation is running. The Display block updates the predicted label and the Scope block shows the new scores.
See Also
Wavelet Scattering | Audio Device Writer | Display (Simulink) | Scope (Simulink)