You are on page 1of 44

Vijaya Vittala Institute of Technology

Department of Computer Science & Engineering

CNC Machine Condition Monitoring System


A Project on “

Using LSTM based Deep Learning Techniques”


by

Mr. Mohan Krishna K


[1VJ17CS028] 8th SEM Final Year, CSE , VVIT
Guided by

Prof.Mangala Patil B.E, MTech


Associate professor , CSE
VVIT, Bangalore-560077
ABSTRACT
PAGE 1
Model demo

Introduction
PAGE 2
CNC Machine introduction

Literature Survey
PAGE 3

Problem Statement
PAGE 4
Objectives

Software and Hardware Requirements


PAGE 5
System Design & Architecture
PAGE 6
Use case and DFD diagram

Methodology
PAGE 7
RNN & LSTM

Implementation
PAGE 8
Database creation , splitting and training of LSTM

System testing
PAGE 9
Automation testing

SNAPSHOTS
PAGE10
Demo
PAGE 11

Results and Discussion


PAGE 12

INNOVATION
PAGE 13

Conclusion and Future enhancement


PAGE 14

REFERENCES
PAGE 15
ABSTRACT
• Real-time condition monitoring of a CNC machine has been a challenging
project for many researchers and analysts, most of them invest a lot of money
in hardware resources for the condition of the CNC machine whether it's a
worn machine or fresh machine.
• To avoid heavy expenditure and future problems, this paper is designed for a
new real-time condition monitoring of a CNC machine using Deep learning
techniques such as LSTM Recurrent Neural Networks(RNN).
• Long Short Term Memory[LSTM] has a strong ability, can learn sequence
data without manual extraction of complex features, and has well built-in
capabilities of handling complex high dimensional massive data.
• Experimental results show that this model approach fetched an accuracy of
99.7% which is higher than of other neural network algorithms.
Brief working of the model

o
ed t
nect no
C on
ino u Wi-Fi
Ardu
eter
lerom
Acce

CNC Machine cloud

fresh Real-time
Classification
worn data

Bi-LSTM Model [RNN]


2.Introduction to CNC Machine
• In order to meet the increasing demand to design
• Everyday products by hand mechanically is not
Profitable.
• By using CNC [Computer Numerical Control]
Machine one can increase the throughput of the
Automation process[change] Figure 2: CNC
machine

• A CNC machine is an electro-mechanical device also used to manipulate


and control machine tools and devices using computer programming
Project Based on

IoT Based CNC Machine


Condition Monitoring
System Using Machine
learning Techniques
Mohan Krishna K
Prashanth Kannadaguli
9th CSNT 2020
10-12 APR
3. Literature Survey
PAPER AUTHORS TITLE Algorithm Drawbacks
NO. USED
Zhigang TIAN An Artificial Neural Artificial Neural 1.Artificial Neural Network
1. Network Approach for
Remaining Useful Life
Networks (ANN) has high computational
time
Prediction of Equipment's 2.Overfitting of the data
Subject to Condition
Monitoring

Abdelkabir Bacha, Jamal A CNC Machine Fault Data Acquisition and 1.initial training required for all
2. Benhra, Ahmed Haroun
Sabry
Diagnosis Methodology
based on Bayesian
Bayesian Networks programmers and users
2.Damage in the D.B affects
Networks and Data virtually all application
Acquisition programs
A D Patange, Milling cutter condition Signal acquisition, 1.Database systems are
3. Jegadeeshwaran R and
N C Dhobale
monitoring using machine
learning approach
Decision tree, Random
Forest, Logistic Model
complex, difficult, and time-
consuming to design
Tree Classifier Substantial hardware and
software start-up costs

Mohan krishna k and IoT Based CNC Machine Artificial Neural 1.Heavy Computational Time
4. Prashanth kannadaguli Condition Monitoring
System Using Machine
Network’s , LM
algorithm
learning Techniques

Table1: Literature Survey


4.Problem Definition
o A CNC machine in the long run and continuous usage may cause
unnecessary vibrations due to regular wear and tear
o These may cause machine breakdown and will also lead to disastrous
situation

Video 1: Demo problem of CNC Machine


4. Existing System

Figure 3: Representation of Artificial Neural Network


• Artificial Neural Network[ANN]
• Artificial Neural Networks is a popular way of implementing machine “intelligence”.
The main idea of this model is that they behave like the neurons in a human brain.
• This neuron has inputs x1 and x2, a bias b, weights w1 and w2 which are hidden and
only single output.
• Formula of Artificial Neural Network is
4.1Problem of the Existing System
High Computational load
• Complexity time is very huge .
• If error occurs in test dataset or new data set each and every time
the model has to be retrained .
• The more number of hidden layers , the more number of training
time is required.

Figure 2:Backpropagration and time complexity Figure 3:Dropout and Connected complexity
4.2 Proposed System

• To improve and reduce the drawback of accuracy,


efficiency, computational time of the model, Deep
learning algorithm RNN [Recurrent Neural network]
is used.

Figure 3.2: RNN simplified classification in


sequence of data
4.2.1 Objectives
• The goal of this work is to apply deep learning technique of RNN
such as BiLSTM will be applied to solve these problems mainly
improve Efficiency and less computation time.

Figure 4.2.1:comparison of normal LSTM


with BiLSTM architecture
5. Software & Hardware Requirements
SOFTWARE REQUIREMENTS HARDWARE REQUIREMENTS
1) Windows 10 Operating system 1)Processor: Intel core i5 9th Gen and Above

2) Software: - MATLAB R2020a and Above 2)GPU: Nvidia GTX 1050 Ti and Above

3) Frame-work: Deep Learning (Recurrent Neural 3)RAM: 16gb and above


Network)

Table 2: Representation of software & hardware


representation
6. System Design and Architecture
6.1 Use case diagram

Figure 6.1: Use case diagram


6.2 Data Flow diagram

Figure 6.2: Data Flow diagram


7. Methodology
7.1 Recurrent Neural Networks
• Jeff Elman and Jordan proposed a neural network model in the late 1980s that is called Recurrent
Neural Network [RNN], they are a class of neural networks that allow previous outputs to be used
as inputs while having hidden states .
• In the feed-forward neural networks model, the connection exists between the layers and there is
no connection between the nodes of each layer

Figure 7.1.1: recurrent Neural Network cell


7.1 RNN
• The given Fig1 with a chain-like structure reveals that RNN is intimately related to
sequences, lists, time-series hence they are used for such types of data. RNN has an
unfolded connection considering the input sequence, the hidden vector sequence, and the
output vector sequence are represented by x, H, and O.

• Where X = () is the input sequence. RNN calculates the hidden vector sequence H = ()
after it process information from the input X then passed through time gives the output
vector sequence O = () of t =1 to t as follows:
Figure 7.1.2: RNN
(1) working Methodology

(2)
• Where function is a non-linear function, parameterized by a weight matrix W and is
derivation term.
• The target output is calculated by minimizing loss L internally and the final output will
be calculated with previous output o with softmax layer.
(3)
7.2 LSTM
• A Long Short-Term Memory [LSTM] is a type of RNN that can learn
long-term dependencies between time steps of sequence data. LSTM is
a new RNN architecture proposed by Hochreiter and Schmidhuber in
the year 1997[5].
• The gradient vanishing problem and gradient explosion problem are
solved by introducing a new gate structure and memory. Gradient
vanishing problem occurs when “The gradient is small and increasing
many exponential drops there will be no effect on the output” [2]
whereas in terms of gradient explosion “If the gradient is large,
multiplying multiple exponential increases” leads to a gradient
explosion.
7.2 LSTM
Components Purpose of the component Formula

Input gate() Manage the level of cell state


update

Forget gate() Manage the level of cell state


reset()

Cell candidate() Add instruction to cell state

Output gate() Control level of cell state


combined to hidden state

Figure 7.2: Architecture of LSTM model, in


TABLE 7.2: DETAILS OF COMPONENTS IN LSTM BLOCK
which the middle block consists of four
interacting layers which are the core of the
entire model.
7.2 LSTM
• cell state and the hidden state is given by time step t as
• (4)

• Where indicates the activation function by default, denotes the gate
activation function.
• Bi Directional LSTM [6] can only be used for encoding a finite sequence.
Based on the context of elements rather than encoding the sequence in
forward direction left to right sequence, the encoding is done in backward
direction right to left sequence also, and concatenate the results from both
the forward and backward Long Short Term Memory at each timestep .This
technique has proved for sequence vector particularly useful[7].
8. IMPLEMENTATION
8.1 Condition Database creation
• The first step was to create an independent machine condition recognition system, to initiate the dataset we
had to collect all the data from the known dependent machine condition system.
• The setup for the data collection is as shown in the following Figure. 8.1.The vibration data is sensed in
terms of 3D coordinates using an accelerometer connected to Arduino Uno. Accelerometer sampled the
vibration of CNC machine at a rate of 1200 samples per second and gets stored in excel sheet. Details of the
database are shown in Table 8.1.1 [1]. Each cell consisted of 72,000 rows and 3 columns for X, Y, and Z
coordinates out of which condition database consisted of 100 such readings split into 50 for training and
testing.
Number of Number of
Condition Training samples Testing samples

Fresh tool 50 50

Worn tool 50 50

Figure 8.1: Data collection Table 8.1.1: DETAILS OF CONDITION


block diagram DATABASE
8.2 Splitting Up of Condition Database
• The conditional database is split into 3 parts which are cncTrain, cncTest, cncValidate , these have variables
X and Y.
• Here X is the cell array consisting of 50 samples of input size 3, which is transposed to a row matrix since
BiLSTM goes in sequence array from left to right and then right to left cell array.
• Y variable indicates categorical data. If Y is 1, then it will come under fresh tool and if it is 2 then it will fall
under the worn tool.
• The same will apply to other cells of cncValidate and cncTest but it is split into 25 samples each which is
shown in the below Fig 7.3.1
• The splitting of database is mainly done to solve the issue of heavy memory requirements and usage .
Split Cells Categorical(1) Categorical(2)
cncTrainX 50 50
cncTrainY 50 50
cncValidatetX 25 25
cncValidateY 25 25
cncTestX 25 25
cncTrainY 25 25

Table 8.2 : Splitting of Condition database


8.3 code for splitting up database
load MyData
for i = 1:50
cncTrainX{i,1} = machine{1,1}.training{i}';
cncTrainY(i,1) = categorical(1);
end
for i = 1:50
cncTrainX{50+i,1} = machine{1,2}.training{i}';
cncTrainY(50+i,1) = categorical(2);
end
save cncTrainingData cncTrainX cncTrainY

for i = 1:25
cncValidateX{i,1} = machine{1,1}.testing{i}';
cncValidateY(i,1) = categorical(1);
Figure 8.3: Data cells
end
save cncTestData cncTestX cncTestY
8.4 Training of BiLSTM
• After splitting the dataset into a sequence of vectors, the training is performed by
BiLSTM deep neural network architecture. The network architecture consists 4
layers namely SequenceInputLayer where the inputsize=3, BiLSTM with
hiddenlayersize=20, fully connected layer with 2 classes, softmax layer, and
classification layer which is shown in the Fig 8.4.1
• Since the Condition monitoring system has a huge dataset of sequence vector cells
the network has many parameters to train ,for more computing power we attached
a CUDA enabled GPU to the CPU.

Fig. 8.4.1: Layers of the BiLSTM network


8.5 Code for training of BiLSTM

Fig. 8.5: Code For Training of biLSTM with Layers mentioned and
training options such as Adam optimizer etc
8.6 Training Progress and Loss during
training of the Model

Figure 8.6 : Training progress(left image) and Loss during Training(right image)
• The training progress of the model is shown in the above Fig. where we can see the validation accuracy is
increased from 80% to 90% during iteration number 500 with a learning rate of 0.001. After the 750 th
iteration number, the accuracy is increased from 90% to 100%.
• The above Figure 8.6: shows there is no loss in training during iteration number 1000, which illustrates as
the learning rate increases, the Loss will gradually decrease.
9. SYSTEM TESTING
9.1 Automation testing

Fig. 9.1: Automation testing block diagram of BiLSTM Model


• During automation testing, we gave unknown test data to the previously trained Bi-LSTM model for
classification.
• It is observed that Bi-LSTM model was able to classify the unknown parameter’s on the CNC test data
based on the learned prior values of categorical class [machine is worn out tool or fresh tool].
• Hence Bi-LSTM was able to classify the unknown test data it has proved for proper condition recognition
and can be used for real-time classification of an unknown dataset.
9.2 Why no Manual testing ?
• In CNC Machine Dataset, we have huge number of hyperparameters
and huge Data because of this reason manual testing cannot be done,
we do automation testing.
• Automation testing is done by proper classification done by the model
to the actual predicted machine .
accuracy = sum(YPredicted == cncTestY)./numel(cncTestY) *100;

Figure. 9.2: Automation Test in MATLAB with


code
10. SNAPSHOTS

Figure 10.1: Data cells after Splitting


SNAPSHOTS

Figure 10.2: Initial Training Phase


SNAPSHOTS

Figure 10.3: Trained LSTM Model


SNAPSHOTS

Figure 10.4: : Layers of our BiLSTM Model


SNAPSHOTS

Figure 10.5: Perfectly trained model giving accuracy of 100% in prediction of


condition of system in real time
11. DEMO
11.1 training of BiLSTM model
11.2 testing of BiLSTM model
12. Results and Discussion
Net name Time Taken Input Output Hidden Mini Epoch Accuracy MER
with GPU Layer Class Layer size Batch size
• The result evaluation was done using ground truth, size size

which can be defined as the ratio of the total number of Net1.net 56 minutes,
32 seconds
3 2 10 10 100 54% 46%

misclassified to the total number of testing samples. The Net2.net 30 minutes, 3 2 20 20 100 64% 36%
15 seconds
misclassified errors are called Machine Error Rate
Net3.net 56 minutes, 3 2 20 10 100 99.7% 0.3%
[MER]. This is as shown in Table 12.1 40 seconds

• The above table 10.1 shows that the experiment has been Net4.net 57 minutes,
59 seconds
3 2 15 10 100 60% 40%

conducted in multiple test cases, as we compare every Net5.net 30 minutes,


14 seconds
3 2 20 20 100 98.1% 1.9%

class, with a fewer number of iterations [Epoch size x Net6.net 29 minutes, 3 2 20 10 150 97.7% 3.3%
Mini batch size] then learning time also increases. 37 seconds
Net7.net 70 minutes, 3 2 20 10 200 86% 14%
• Along with this, if the rate of learning increases then loss 38 seconds

during training will decrease. If the hidden layer size is Net8.net 30 minutes,
11 seconds
3 2 25 20 100 99.1% 0.9%

very less, then accuracy will decrease. Net9.net 29 minutes, 3 2 30 20 100 92% 8%
05 seconds
• Hence BiLSTM model yielded a good result with 20 Net10.net 39 minutes, 3 2 30 20 200 86% 14%
hidden layers having 1500 iterations. 07 seconds
Net11.net 45 minutes, 3 2 20 30 200 99% 1%
13 seconds

TABLE 10.1: DETAILS OF TESTING THE


MODEL WITH VARIOUS PARAMETERS
13. INNOVATION
Cost Effective & Efficient
Arduino uno Accelerometer

Optimization & Performance


BiLSTM Accurate

Scalability

Can be Extended for further monitoring systems Cloud Based open source real time system
14.1 Conclusion
• This work’s purpose was an attempt to prove that the Long Short-Term
Memory [LSTM] deep learning method combined with the
characteristics of RNN was very useful and cost-effective in the field
of CNC Machine condition monitoring.
• Here the LSTM was modeled with 20 hidden layers, a mini-batch size
of 10 and we found that 99.7% of excellent work was done by the
trained model.
• Due to hardware resource limitation we were not able to exceed more
than 30 hidden layers ,30 mini batch size and also 200 epoch size.
14.2 Future Extensions
• Hence this work can be further extended by increasing the parameters
with good hardware capable machine which would lead to faster
computation time.
• To make the work more flexible and portable, an IOS or an android
app can be developed. Email and SMS notification can be sent to the
user based on the condition of the machine.
Any Questions??

19th OCIT – ICIT


Bhubaneshwar
16 -18 December
REFERENCES

[1] Tian, Zhigang,” An artificial neural network method for remaining useful life prediction of equipment subject to condition monitoring”,2009
[2] Bacha, Abdelkabir & Benhra, Jamal & Sabry, Ahmed. (2016). A CNC Machine Fault Diagnosis Methodology based on Bayesian Networks and Data
Acquisition. Communications on Applied Electronics. 5. 41- 48. 10.5120/cae2016652353
[3] Puja Girhe ,Shubham Yenkar ,Arpita Chirde , “Arduino Based Cost Effective CNC Plotter Machine “.
[4] A D Patange et al 2019 IOP Conf. Ser.: Mater. Sci. Eng. 624 012030Milling cutter condition monitoring using machine learning approach
[5] M. K. K and P. Kannadaguli, "IoT Based CNC Machine Condition Monitoring System Using Machine Learning Techniques," 2020 IEEE 9th
International Conference on Communication Systems and Network Technologies (CSNT), Gwalior, India, 2020, pp. 61-65, doi:
10.1109/CSNT48778.2020.9115762
[6] Michael Paluszek and Stephanie Thomas,”Practical MATLAB Deep Learning”
[7 ]C. Y. Lai, R. Chen and R. E. Caraka, "Prediction Stock Price Based on Different Index Factors Using LSTM," 2019 International Conference on
Machine Learning and Cybernetics (ICMLC), 2019, pp. 1-6, doi: 10.1109/ICMLC48188.2019.8949162.
[8] Michael Paluszek and Stephanie Thomas “Practical MATLAB Deep Learning” A Project-Based Approach, Michael Paluszek and Stephanie
Thomas 2020, doi: https://doi.org/10.1007/978-1-4842-5124-9
[9] Jeffrey L. Elman,Finding structure in time,Cognitive Science,Volume 14, Issue 2,1990,Pages 179-211,ISSN 0364-0213,https://doi.org/10.1016/0364-
0213(90)90002-E.
[10] Y. Su, "Research on Website Phishing Detection Based on LSTM RNN," 2020 IEEE 4th Information Technology, Networking, Electronic and
Automation Control Conference (ITNEC), 2020, pp. 284-288, doi: 10.1109/ITNEC48623.2020.9084799.
[11] Hochreiter, Sepp & Schmidhuber, Jürgen. (1997). Long Short-term Memory. Neural computation. 9. 1735-80. 10.1162/neco.1997.9.8.1735.
[12] M. A. Istiake Sunny, M. M. S. Maswood and A. G. Alharbi, "Deep Learning-Based Stock Price Prediction Using LSTM and Bi-Directional LSTM
Model," 2020 2nd Novel Intelligent and Leading Emerging Sciences Conference (NILES), 2020, pp. 87-92, doi: 10.1109/NILES50944.2020.9257950.
REFERENCES
[13] P. Kannadaguli and V. Bhat, "Comparison of Artificial Neural Network and Gaussian Mixture Model Based Machine Learning Techniques Using
DDMFCC Vectors for Emotion Recognition in Kannada," 2019 3rd International Conference on Electronics, Materials Engineering & Nano-
Technology (IEMENTech), Kolkata, India, 2019, pp. 1-6.
[14] V. Mishra, T. Kumar, K. Bhalla and M. M. Patil, "SuJAL: Design and Development of IoT-Based Real-Time Lake Monitoring System," 2018 3rd
International Conference on Circuits, Control, Communication and Computing (I4C), 2018, pp. 1-4, doi: 10.1109/CIMCA.2018.8739474.
[15] Yu Wang, "A new concept using LSTM Neural Networks for dynamic system identification," 2017 American Control Conference (ACC), 2017,
pp. 5324-5329, doi: 10.23919/ACC.2017.7963782.
[16] S. D. Kumar and D. Subha, "Prediction of Depression from EEG Signal Using Long Short Term Memory(LSTM)," 2019 3rd International
Conference on Trends in Electronics and Informatics (ICOEI), 2019, pp. 1248-1253, doi: 10.1109/ICOEI.2019.8862560.
[17] P. Kannadaguli, "FCOS Based Seatbelt Detection System Using Thermal Imaging for Monitoring Traffic Rule Violations," 2020 4th International
Conference on Electronics, Materials Engineering & Nano-Technology (IEMENTech), 2020, pp. 1-6, doi: 10.1109/IEMENTech51367.2020.9270058.
[18] S. Chakraborty, J. Banik, S. Addhya and D. Chatterjee, "Study of Dependency on number of LSTM units for Character based Text Generation
models," 2020 International Conference on Computer Science, Engineering and Applications (ICCSEA), 2020, pp. 1-5, doi:
10.1109/ICCSEA49143.2020.9132839.
[19] P. Kannadaguli, "FCOS Based Human Detection System Using Thermal Imaging for UAV Based Surveillance Applications," 2020 IEEE Bombay
Section Signature Conference (IBSSC), 2020, pp. 79-83, doi: 10.1109/IBSSC51096.2020.9332157.
[20] M. Hajiaghayi and E. Vahedi, "Code Failure Prediction and Pattern Extraction Using LSTM Networks," 2019 IEEE Fifth International Conference
on Big Data Computing Service and Applications (BigDataService), 2019, pp. 55-62, doi: 10.1109/BigDataService.2019.00014.
[21] P. Kannadaguli, "Microscopic Blood Smear RBC Classification using PCA and SVM based Machine Learning," 2020 Third International
Conference on Multimedia Processing, Communication & Information Technology (MPCIT), 2020, pp. 82-86, doi:
10.1109/MPCIT51588.2020.9350389.

You might also like