Skip to content

Commit 99db9de

Browse files
Including new updates
1 parent 4118bda commit 99db9de

File tree

177 files changed

+12665
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+12665
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2020 The MathWorks, Inc.
2+
3+
AirCompressorData
4+
AirCompressorDataset.zip
5+
*.asv

AirCompressorDataset.rights

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
License for Air Compressor Dataset Repository
2+
Copyright 2016 Nishchal K. Verma, R. K. Sevakula, S. Dixit and A. Salour
3+
4+
Redistribution and use of this dataset, with or without modification, are permitted provided that the following conditions are met:
5+
1. Redistribution in any form must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistribution and use in any form must be accompanied by the following citation:
8+
9+
Nishchal K. Verma, R. K. Sevakula, S. Dixit and A. Salour, Intelligent Condition Based Monitoring using Acoustic Signals for Air Compressors, IEEE Transactions on Reliability, vol. 65, no. 1, pp. 291-309, 2016.
10+
11+
THIS DATASET IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DATASET, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Aircompressorclassification.prj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/>

HelperFiles/DownloadData.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
% Copyright 2020 The MathWorks, Inc.
2+
3+
dataZip = "AirCompressorDataset.zip";
4+
url = "https://www.mathworks.com/supportfiles/audio/AirCompressorDataset/AirCompressorDataset.zip";
5+
dataFolder = "AirCompressorData";
6+
7+
disp("Checking for dataset...");
8+
9+
if ~isfolder(dataFolder)
10+
answer = questdlg("Do you want to download the dataset now?","Dataset not found","Yes","No","Yes");
11+
12+
switch answer
13+
case "Yes"
14+
if ~isfile(dataZip)
15+
outFile = websave(dataZip,url);
16+
disp("Data zip file saved as " + outFile);
17+
end
18+
19+
disp("Unzipping data file...");
20+
unzip(dataZip, dataFolder);
21+
disp("Data unzipped successfully.");
22+
case "No"
23+
disp("Dataset not downloaded. You will need to download the dataset to run the example. Please run DownloadData.")
24+
end
25+
else
26+
disp("Dataset found.");
27+
end
28+

HelperFiles/OpenCodegenReport.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
% Copyright 2018-2020 The MathWorks, Inc.
2+
3+
function OpenCodegenReport
4+
5+
prj = currentProject;
6+
open(fullfile(prj.RootFolder,'arm_compute','html','report.mldatx'));
7+
8+
end

HelperFiles/OpenPart1.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
% Copyright 2020 The MathWorks, Inc.
2+
3+
edit Part01_DataPreparation.mlx

HelperFiles/OpenPart2.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
% Copyright 2020 The MathWorks, Inc.
2+
3+
edit Part02_Modeling.mlx

HelperFiles/OpenPart3.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
% Copyright 2020 The MathWorks, Inc.
2+
3+
edit Part03_Deployment.mlx

HelperFiles/extractFeatures.m

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
% Copyright 2020 The MathWorks, Inc.
2+
3+
function features = extractFeatures(audioIn,fs)
4+
5+
%#codegen
6+
7+
persistent stf F winPower
8+
9+
if(isempty(stf))
10+
% Setup a short time fourier transform object
11+
FFTLength = 512;
12+
windowLength = 512;
13+
hopLength = 512;
14+
win = hamming(windowLength,'periodic');
15+
winPower = 2/(sum(win)^2);
16+
stf = dsp.STFT(win,windowLength-hopLength,FFTLength);
17+
[~,temp] = stft(zeros(windowLength,1),fs,'Window',win,'OverlapLength',windowLength-hopLength,'centered',false);
18+
F = temp(1:257);
19+
end
20+
21+
Xcomp = stf(audioIn);
22+
Xcomp= Xcomp(1:257,:);
23+
24+
% Get power spectrum
25+
X = real(Xcomp.*conj(Xcomp));
26+
27+
% Normalize by window power
28+
X = X .* winPower;
29+
30+
X(1,:) = 0.5*X(1,:);
31+
X(end,:) = 0.5*X(end,:);
32+
33+
S1 = spectralCentroid(X,F);
34+
S2 = spectralCrest(X,F);
35+
S3 = spectralDecrease(X,F);
36+
S4 = spectralEntropy(X,F);
37+
S5 = spectralFlatness(X,F);
38+
% S6 = spectralFlux(X,F);
39+
S7 = spectralKurtosis(X,F);
40+
S8 = spectralRolloffPoint(X,F);
41+
S9 = spectralSkewness(X,F);
42+
S10 = spectralSlope(X,F);
43+
S11 = spectralSpread(X,F);
44+
45+
features = [S1 S2 S3 S4 S5 S7 S8 S9 S10 S11];
46+
47+
end
48+

HelperFiles/reloadDatastore.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
% Copyright 2020 The MathWorks, Inc.
2+
3+
% Recreate the datastore again
4+
5+
dataFolder = 'AirCompressorData';
6+
ads = audioDatastore(dataFolder,'IncludeSubfolders',true,'LabelSource','foldernames');
7+
rng(3);
8+
ads = shuffle(ads);
9+
[adsTrain,adsValidation] = splitEachLabel(ads,0.9,0.1);

0 commit comments

Comments
 (0)