Rishabh Garg developed a fault detection system for a smart lathe machine using Python. He extracted vibration data from the machine and used linear regression and logistic regression models to predict vibration levels and classify the machine state as normal or faulty. Key aspects included preparing the biased dataset, training and testing models, and deploying the system with a Streamlit frontend and Flask API to a Heroku backend. The system provides real-time monitoring and predictive maintenance to improve machine availability.
2. Fault Detection of
Smart Lathe Machine
Using Python
Rishabh Garg
BITS - PILANI
K.K. Birla Goa Campus
IIT Delhi - AIA Foundation For Smart Manufacturing
.………………
Best Project Award
Samarth Udyog 4.0
Indian Institute of
Technology Delhi
Department of Heavy Industry
Ministry of HI & PE
Automation Industry
Association
A Government of India
Initiative Hosting Institute Government of India Industry Partner
1
3
A
U
G
U
S
T
2
0
2
1
3. Fault Detection of Smart Lathe
Machine using Python
Rishabh Garg
BITS - PILANI | GOA
IITD-AIA Foundation For Smart Manufacturing
5. Project Background
Problem Statement
Machines having large investments in capital also
deploy high skilled labor for active operation and
periodic maintenance. The challenge for companies is to
protect this investment by ensuring high availability.
Unpreceded breakdowns in machinery and lack of
skilled labor becomes a major challenge for
manufacturing industries. Customer orders get delayed
and company loses money
Solution: Deploy Machine Learning models and Real
time dashboards and Predictive maintenance that
constantly monitor the health of the machine and the
associated tools.
RISHABH GARG | BITS
6. Project Background
Physical Equipment on which it is implemented
No specific hardware required, apart from a
regular PC.
GPUs can be used for faster training and results.
OS: Ubuntu – 18.04 LTS and Google
Collaboratory (with GPUs)
Unique challenge
Development of accurate model despite high bias and
limited dataset.
RISHABH GARG | BITS
7. LOREM IPSUM DOLOR SIT AMET,
CONSECTETUER ADIPISCING ELIT. 12
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Maecenas porttitor congue massa. Fusce posuere, magna
sed pulvinar ultricies, purus lectus malesuada libero, sit
amet commodo magna eros quis urna.
7
Solution
RISHABH GARG | BITS
8. Objective
Predict the instantaneous RMS value of vibrations
of a Smart Lathe Machine using the traditional
input parameters
Use the prediction for classification of the
machine state into Normal and Faulty behavior.
9. Objective
Display the prediction results through Streamlit
Web App.
Implement the API endpoints using Flask.
Deployment to Heroku using Docker containers.
RISHABH GARG | BITS
10. Methodology
Exploration of data
Data extraction from CSV files, Data preparation
and filtering
Representation of data and its analysis (kurtosis,
skewness etc. for appropriate model selection)
Machine Learning Model Development
Developed some sample machine learning models for
checking accuracy and other metrics like sensitivity
or positivity rate. Research was done on the models
for hyper-parameter tuning etc.
RISHABH GARG | BITS
11. Methodology
Flask
Model was packed and API implementation was done
using Flask
Deployment through Docker containers
Streamlit
Necessary pathways for connection with dashboard
using Streamlit
Deployment to Heroku was done using CLI
RISHABH GARG | BITS
12. Implementation
Data Extraction
Dataset provided from the FSM Lab consisted of
raw data which was directly taken from the DAC
device connected to the accelerometer.
For machine learning models to be built, first the
required input parameters were identified.
RMS value of vibration was the best output
parameter for predicting the machine state.
RISHABH GARG | BITS
13. Implementation
Preparation of raw data
Using Python OS library, the vibration data stored in
CSV files was aggregated and summarized in an Excel
file.
60 One-Minute Experiments used as the training data for
the linear regression model.
Redundant columns such as Dates, Timestamps, Serial
numbers, Status etc. were removed and only numeric
columns were retained.
RMS buffer values and Actual RMS values were used as
output variables.
RISHABH GARG | BITS
14. Implementation
Preparation of raw data
One-Minute experiments were used to predict the
initial level of vibrations.
Full run experiments were used to determine the
slope of RMS values with time.
RMS value were compared against the value
provided by the line at a given time for
classification.
RISHABH GARG | BITS
15. Implementation
Preparation of raw data
Note: The data was very biased due to low occurrences
of failure in the Lathe machine. This affected the
accuracy of the model in the later stages.
RISHABH GARG | BITS
16. Implementation
Training the model
Cubic SVM and Linear Regression models were
compared for performance using MAE (Mean Absolute
Error), RMSE (Root Mean Squared Error) metrics.
Linear Regression model was chosen out of the two due
to higher dimensionality of data.
The threshold value of RMS vibration came out to be
around 372.86 for the classifier model.
Logistic Regression was used to implement the classifier
layer of model.
The predicted / actual RMS values were fed into the
classifier for prediction of the machine state.
RISHABH GARG | BITS
17. Implementation
Testing the model
After training both the models, the test dataset, generated
using
Scikit learn library was fed the model and the predictions
were stored.
The models were also
evaluated based on a few
metrics from the scikit
learn library like MAE,
R2, RMSE (for
regression) and F1 score
(for classification).
RISHABH GARG | BITS
18. Implementation
Deployment
Heroku was used for the deployment of the final
deliverable product which was connected to a Git
repository for storage of the codebase.
A Docker file, Procfile and requirements.txt file
was required for the appropriate stack selection by
Heroku.
Streamlit was used for creation of the deployed
frontend webapp and Flask was used to make the
required API calls.
RISHABH GARG | BITS
21. Innovations
Real time monitoring of the input parameters,
instantaneous and accurate prediction of RMS values
of vibration data along with display of associated
metrics was the biggest industrial level achievement of
this product.
One can also
select multiple
models for
prediction in
the web app
along with
intuitive
visualization.
RISHABH GARG | BITS
22. Innovations
This model, despite the associated bias, provides
decent predictions due to proper choice of degree of
SVR (here, behaves like Linear regressor). Tunable
parameters have been added as sidebars in the webapp
for customized accuracy as per the use case.
RISHABH GARG | BITS
23. Outcome
Final deliverable product
The following applications and repositories were made
on the completion of the internship project for
addressing the problem statement:
The app was deployed to Heroku as a frontend
webapp: https://streamlitappml.herokuapp.com/
Source code for the Base models, Docker files and
Flask: https://github.com/rishabhgargdps/IITD_ML
RISHABH GARG | BITS
24. Outcome
Final deliverable product
Source code for the Front end application:
https://github.com/rishabhgargdps/IITD_streamlit
Heroku app for customized models:
https://streamlitml.herokuapp.com/
Heroku flask app that contains the API, and Docker
containers: https://svmml2.herokuapp.com/
The codebase of the project was stored in Git Version
control systems (here, GitHub).
RISHABH GARG | BITS
25. Scalability
This model can be used for prediction of RUL of any
modern / traditional machine / tools if we can
identify the most relevant input and output
parameters pertaining to the quality of the product
and the life of the machine.
The vibration data can be collected from the
accelerometer attached to the tool holder which can
be sent to the cloud for data storage using the
Ethernet. There it can be processed and used for
automated prediction.
Additional parameters like temperature, humidity of
environment can be added for even better
predictions. Thermo-hygrometers (DHT-11) can be
used in the rooms for temperature and humidity
monitoring.
RISHABH GARG | BITS
26. Scalability
One can also adjust the model for false positives /
negatives as per need in the case of legacy
hardware / biological equipment manufacturing.
The operator can be alerted using a web monitor
service (e.g. Distil web monitor) running on the
web app through an alarm sound, email
notification etc.
Pre-trained neural nets or decision trees in a
random forest can be used if we cannot acquire a
large dataset and a similar use case has already
been solved for a large dataset.
RISHABH GARG | BITS