0% found this document useful (0 votes)
30 views

CNN Sensor Fault Detection

The document describes a seminar presentation on using CNN models for predictive maintenance by detecting faults from sensor data. It discusses the objectives of fault detection using CNNs, describes the methodology which includes data collection, preprocessing, model architecture design, training and evaluation. It also provides details about simulations conducted with code snippets.

Uploaded by

Srushti Giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

CNN Sensor Fault Detection

The document describes a seminar presentation on using CNN models for predictive maintenance by detecting faults from sensor data. It discusses the objectives of fault detection using CNNs, describes the methodology which includes data collection, preprocessing, model architecture design, training and evaluation. It also provides details about simulations conducted with code snippets.

Uploaded by

Srushti Giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

A SEMINAR ON

CNN for Predictive Maintenance: Fault Detection from Sensor Data

By
Srushti Giri - 112009012

Guide
Prof. Meera Khandekar

February 29,2024

Instrumentation and Control COEP Technological University FEB 28,2024


TABLE OF CONTENT

INTRODUCTION
OBJECTIVES

METHODOLOGY TO

BE ADOPTED

REFERENCES

Instrumentation and Control COEP Technological University FEB 28,2024


INTRODUCTION

INTRODUCTION

Condition Monitoring of Hydraulic System

Instrumentation and Control COEP Technological University FEB 28,2024


OBJECTIVES

Objectives
INTRODUCTION
Attribute Information:
Attributes are sensor data (all numeric and continuous) from measurements taken at the
same point in time, respectively, of a hydraulic test rig's working cycle.
The sensors were read with different sampling rates, leading to different numbers of
attributes per sensor despite they were all exposed to the same working cycle.

1. Pressure sensors (PS1-6): 100 Hz, 6000 attributes per sensor (6 sensors)
2. Motor power sensor (EPS1): 100 Hz, 6000 attributes per sensor (1 sensor)
3. Volume flow sensors (FS1/2): 10 Hz, 600 attributes per sensor (2 sensors)
4. Temperature sensors (TS1-4): 1 Hz, 60 attributes per sensor (4 sensors)
5. Vibration sensor (VS1): 1 Hz, 60 attributes per sensor (1 sensor)

Instrumentation and Control COEP Technological University FEB 28,2024


INTRODUCTION

6. Efficiency factor (SE): 1 Hz, 60 attributes per sensor (1 sensor)

7. Virtual cooling efficiency sensor (CE): 1 Hz, 60 attributes per sensor (1


sensor)

8. Virtual cooling power sensor (CP): 1 Hz, 60 attributes per sensor (1 sensor)

Instrumentation and Control COEP Technological University FEB 28,2024


Burner Management System

OBJECTIVE
● Present a real-world case study demonstrating the application of
CNNs for fault detection in industrial equipment.

● Enhanced Accuracy: CNNs are capable of learning intricate patterns


and features from sensor data, leading to more accurate fault
detection compared to traditional methods. Their hierarchical feature
extraction ability enables them to discern subtle differences indicative
of faults.
● Automation and Efficiency: CNN-based fault detection systems can
automate the analysis of sensor data, reducing the need for manual
inspection and enabling real-time monitoring. This automation
increases efficiency by swiftly identifying potential faults and
minimizing downtime.
Instrumentation and Control COEP Technological University FEB 28,2024
Literature Survey

Literature
METHODOLOGY Survey
Data: The data set was experimentally obtained with a hydraulic test rig.

Class Distribution: there are 5 different class value vectors provided in profile.txt.
All but number 5 (stable flag) describe degradation processes over time and, thus, their values do not
represent distinct categories, but continuous values.

1. Cooler condition / %:
3: close to total failure (732 instances)
20: reduced efficiency (732 instances)
100: full efficiency (741 instances)

2. Valve condition / %:
100: optimal switching behaviour (1125 instances)
90: small lag (360 instances)
80: severe lag (360 instances)
73: close to total failure (360 instances)

Instrumentation and Control COEP Technological University FEB 28,2024


METHODOLOGY

METHODOLOGY
3. Internal pump leakage:
0: no leakage (1221 instances)
1: weak leakage (492 instances)
2: severe leakage (492 instances)

4. Hydraulic accumulator / bar:


130: optimal pressure (599 instances)
115: slightly reduced pressure (399 instances)
100: severely reduced pressure (399 instances)
90: close to total failure (808 instances)

5. stable flag:
0: conditions were stable (1449 instances)
1: static conditions might not have been reached yet (756 instances)

Instrumentation and Control COEP Technological University FEB 28,2024


METHODOLOGY

CNN METHODOLOGY

Data Collection: Gather sensor data from industrial equipment or systems. This
data may include temperature, pressure, vibration, or any other relevant metrics
that can provide insights into the health and performance of the machinery.
Data Preprocessing: Clean and preprocess the sensor data to ensure consistency
and remove noise. This may involve handling missing values, outlier detection,
and normalization to scale the data appropriately for training the CNN model.
Model Architecture Design: Design the architecture of the CNN model for fault
detection. This typically involves selecting the number of convolutional layers,
pooling layers, and fully connected layers. The architecture should be tailored to
effectively capture relevant patterns in the sensor data.

Instrumentation and Control COEP Technological University FEB 28,2024


METHODOLOGY

METHODOLOGY

Training Process: Split the preprocessed data into training, validation, and testing sets.
Train the CNN model using the training data, optimizing the model's parameters
through backpropagation and gradient descent algorithms. Monitor the model's
performance on the validation set to prevent overfitting.
Evaluation Metrics: Evaluate the performance of the trained CNN model using
appropriate evaluation metrics such as accuracy, precision, recall, F1-score, and ROC-
AUC curve. These metrics provide insights into the model's ability to detect faults
accurately.
Deployment and Testing: Deploy the trained CNN model in a real-world industrial
environment for fault detection. Test the model's performance on unseen data to
ensure its effectiveness in identifying faults in real-time.

Instrumentation and Control COEP Technological University FEB 28,2024


METHODOLOGY

CNN Methodology

Fine-Tuning and Iteration: Continuously fine-tune the CNN model based on feedback from
real-world deployment. This may involve retraining the model with additional data or
adjusting hyperparameters to improve its performance and adaptability to changing
conditions.
Integration with Predictive Maintenance Systems: Integrate the CNN-based fault detection
system with existing predictive maintenance frameworks or industrial control systems. This
allows for seamless integration of fault detection capabilities into overall maintenance
strategies.
Continuous Monitoring and Improvement: Continuously monitor the performance of the
CNN model in detecting faults and incorporate feedback loops for ongoing improvement. This
may involve updating the model with new data or retraining it periodically to adapt to evolving
operational conditions.

Instrumentation and Control COEP Technological University FEB 28,2024


SIMULATION

SIMULATION
IMPORTS:
import os
import random
import itertools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
import tensorflow as tf
from tensorflow.python.keras.models import *
from tensorflow.python.keras import layers
from tensorflow.python.keras.utils import *
from keras.utils import to_categorical
from keras.models import Sequential
from keras.layers import Dense, MaxPooling1D, GlobalAveragePooling1D, Dropout
from keras.layers import Conv1D
Instrumentation and Control COEP Technological University FEB 28,2024
SIMULATION

SIMULATION
Confusion matrix

def plot_confusion_matrix(cm, classes, title='Confusion matrix', cmap=plt.cm.Blues):


cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]

plt.imshow(cm, interpolation='nearest', cmap=cmap)


plt.title(title, fontsize=25)
#plt.colorbar()
tick_marks = np.arange(len(classes))
plt.xticks(tick_marks, classes, rotation=90, fontsize=15)
plt.yticks(tick_marks, classes, fontsize=15)

fmt = '.2f'
thresh = cm.max() / 2.
for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
plt.text(j, i, format(cm[i, j], fmt),
horizontalalignment="center",
color="white" if cm[i, j] > thresh else "black", fontsize = 14)

plt.ylabel('True label', fontsize=20)


plt.xlabel('Predicted label', fontsize=20)
Instrumentation and Control COEP Technological University FEB 28,2024
SIMULATION

### LOAD DATA ###

label = pd.read_csv('C:\\Users\\Asus\\condition+monitoring+of+hydraulic+systems\\profile.txt', sep='\t',


header=None)
label.columns = ['Cooler','Valve','Pump','Accumulator','Flag']

data = ['C:\\Users\\Asus\\condition+monitoring+of+hydraulic+systems\\TS1.txt',
"C:\\Users\\Asus\\condition+monitoring+of+hydraulic+systems\\TS2.txt",
"C:\\Users\\Asus\\condition+monitoring+of+hydraulic+systems\\TS3.txt",
"C:\\Users\\Asus\\condition+monitoring+of+hydraulic+systems\\TS4.txt"]
df = pd.DataFrame()

dfs = []

for txt in data:


read_df = pd.read_csv(txt, sep='\t', header=None)
dfs.append(read_df)

df = pd.concat(dfs, ignore_index=True)

print(df.shape)
df.head()

Instrumentation and Control COEP Technological University FEB 28,2024


SIMULATION

### RESHAPE DATA AMONG SENSORS ###


df = df.sort_index().values.reshape(-1,len(data),len(df.columns)).transpose(0,2,1)
df.shape

### PLOT ORIGINAL TEMPERATURE DATA ###


plt.figure(figsize=(8,5))
plt.plot(df[0])
plt.title('Original Temperature Data')
plt.ylabel('Temperature'); plt.xlabel('Time')
np.set_printoptions(False)

### LABEL DISTRIBUTION ###


label = label.Cooler
label.value_counts()

### MAPPING LABEL ###


diz_label, diz_reverse_label = {}, {}
for i,lab in enumerate(label.unique()):
diz_label[lab] = i
diz_reverse_label[i] = lab
print(diz_label)
print(diz_reverse_label)
label = label.map(diz_label)
y = to_categorical(label)
Instrumentation and Control COEP Technological University FEB 28,2024
SIMULATION
### TRAIN TEST SPLIT ###
X_train, X_test, y_train, y_test = train_test_split(df, y, random_state = 42, test_size=0.2)

### SCALE DATA ###

scaler = StandardScaler()
X_train = scaler.fit_transform(X_train.reshape(-1, X_train.shape[-1])).reshape(X_train.shape)
X_test = scaler.transform(X_test.reshape(-1, X_test.shape[-1])).reshape(X_test.shape)
num_sensors = 4
TIME_PERIODS = 60
BATCH_SIZE = 16
EPOCHS = 10
model_m = Sequential()
model_m.add(Conv1D(100, 6, activation='relu', input_shape=(TIME_PERIODS, num_sensors)))
model_m.add(Conv1D(100, 6, activation='relu'))
model_m.add(MaxPooling1D(3))
model_m.add(Conv1D(160, 6, activation='relu'))
model_m.add(Conv1D(160, 6, activation='relu'))
model_m.add(GlobalAveragePooling1D(name='G_A_P_1D'))
model_m.add(Dropout(0.5))
model_m.add(Dense(3, activation='softmax'))

model_m.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])


history = model_m.fit(X_train, y_train, batch_size=BATCH_SIZE, epochs=EPOCHS, validation_split=0.2, verbose=2)
model_m.evaluate(X_test, y_test, verbose=2)

Instrumentation and Control COEP Technological University FEB 28,2024


SIMULATION

### GET PREDICTED CLASS ###

pred_test = np.argmax(model_m.predict(X_test), axis=1)

print(classification_report([diz_reverse_label[np.argmax(label)] for label in y_test],


[diz_reverse_label[label] for label in pred_test]))

cnf_matrix = confusion_matrix([diz_reverse_label[np.argmax(label)] for label in y_test],


[diz_reverse_label[label] for label in pred_test])

plt.figure(figsize=(7,7))
plot_confusion_matrix(cnf_matrix, classes=list(diz_reverse_label.values()))
plt.show()

### MAKE A MODEL FOR EMBEDDINGS ###


emb_model = Model(inputs=model_m.input, outputs=model_m.get_layer('G_A_P_1D').output)
emb_model.summary()### EXTRACT EMBEDDINGS ###
serie_features = emb_model.predict(X_test)

### VISUALIZE EMBEDDINGS ###


tsne = TSNE(n_components=2, random_state=42, n_iter=300, perplexity=5)
T = tsne.fit_transform(serie_features)
plt.figure(figsize=(16,9))
colors = {0:'red', 1:'blue', 2:'yellow'}
plt.scatter(T.T[0], T.T[1], c=[colors[i] for i in np.argmax(y_test, axis=1)])
plt.show()
SIMULATION

Making the prediction on the test data the model reaches an ACCURACY of
Output:
0.9909%.
SIMULATION

Output:

This result is particularly


important for class 3
(component Cooler ‘ close to
total failure’) because in this
way we are able to detect
and prevent possible faults in
the system.
SIMULATION

Output:

TSNE on cycle embeddings for test data


References

REFERENCES

[1] Nikolai Helwig, Eliseo Pignanelli, Andreas Schütze, ‘Condition Monitoring of a


Complex Hydraulic System Using Multivariate Statistics’, in Proc. I2MTC-2015 - 2015 IEEE
International Instrumentation and Measurement Technology Conference, paper PPS1-39,
Pisa, Italy, May 11-14, 2015, doi: 10.1109/I2MTC.2015.7151267.
[2] N. Helwig, A. Schütze, ‘Detecting and compensating sensor faults in a hydraulic
condition monitoring system’, in Proc. SENSOR 2015 - 17th International Conference on
Sensors and Measurement Technology, oral presentation D8.1, Nuremberg, Germany,
May 19-21, 2015, doi: 10.5162/sensor2015/D8.1.
[3] Tizian Schneider, Nikolai Helwig, Andreas Schütze, ‘Automatic feature extraction and
selection for classification of cyclical time series data’, tm - Technisches Messen (2017),
84(3), 198–206, doi: 10.1515/teme-2016-0072.

Instrumentation and Control COEP Technological University FEB 28,2024

You might also like