CNN Sensor Fault Detection
CNN Sensor Fault Detection
By
Srushti Giri - 112009012
Guide
Prof. Meera Khandekar
February 29,2024
INTRODUCTION
OBJECTIVES
METHODOLOGY TO
BE ADOPTED
REFERENCES
INTRODUCTION
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)
8. Virtual cooling power sensor (CP): 1 Hz, 60 attributes per sensor (1 sensor)
OBJECTIVE
● Present a real-world case study demonstrating the application of
CNNs for fault detection in industrial equipment.
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)
METHODOLOGY
3. Internal pump leakage:
0: no leakage (1221 instances)
1: weak leakage (492 instances)
2: severe leakage (492 instances)
5. stable flag:
0: conditions were stable (1449 instances)
1: static conditions might not have been reached yet (756 instances)
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.
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.
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.
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
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)
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 = []
df = pd.concat(dfs, ignore_index=True)
print(df.shape)
df.head()
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'))
plt.figure(figsize=(7,7))
plot_confusion_matrix(cnf_matrix, classes=list(diz_reverse_label.values()))
plt.show()
Making the prediction on the test data the model reaches an ACCURACY of
Output:
0.9909%.
SIMULATION
Output:
Output:
REFERENCES