You are on page 1of 10

International Journal of Computer Science and Information Security (IJCSIS),

Vol. 15, No. 1, January 2017

Effective Diagnosis of Diabetes Mellitus


Using Neural Networks and its Hardware
Implementation on FPGA
A.V.Ananthalakshmi, Assistant Professor, Department of ECE, Pondicherry Engineering College,
Puducherry, India – 605 014.

Abstract:Diabetes Mellitus (DM), commonly referred to as Diabetes, is a group of metabolic diseases in which there
are high blood sugar levels over a prolonged period. Thus, the objective of this work is to predict the chances of
diabetes in a person and if a person has diabetes then the level of insulin dosage required for the patient is prescribed.
Parameters such as Fasting Blood Sugar levels (FBS), Postprandial Plasma Glucose Test (PPBS), Urea, Creatinine
and Haemoglobin factors are considered in order to detect the diabetes in a person. Using neural network feed
forward prediction model in conjunction with back propagation algorithm, and based on the given training data set,
it is predicted whether a subject has diabetes or not using Matlab. Finally, the hardware implementation of the
Diagnosis of Diabetes Mellitus based on Neural network concept is carried out in Xilinx Spartan6 FPGA XC6SLX9.
Functionality of the design is verified using Verilog HDL module.

Keywords:Diabetes Mellitus, Neural Network, Insulin Dosage Prescription, FPGA.

1. INTRODUCTION

The term Diabetes Mellitus describes a metabolic disorder with disturbances of carbohydrate, fat and
protein metabolism which results in insulin secretion, insulin action or both. This leads to dysfunction and
failure of various organs. Diabetes Mellitus is characterized with the following symptoms such as thirst,
polyuria, blurring of vision, and weight loss. If an effective treatment is not provided, ketoacidosis develops and
this leads to stupor or coma. The long–term effects of Diabetes Mellitus include progressive development of the
specific complications of retinopathy with potential blindness, nephropathy that may lead to renal failure, and/or
neuropathy with risk of foot ulcers, amputation, Charcot joints, and features of autonomic dysfunction,
including sexual dysfunction. People with diabetes are at increased risk of cardiovascular, peripheral vascular
and cerebro-vascular disease.
Diabetes Mellitus is a growing burden for all the countries in the world. The InternationalDiabetes
Federation (IDF) estimates that the number of people with diabetes will grow from 194 million in 2003 to 333
million in 2025 (Diabetes Atlas, third edition, International Diabetes Federation, 2007). An early diagnosis helps
the people to take medication accordingly. It is important to prevent any disease before its development so [1]
specifies method regarding the prediction of the disease and the clinical support system with procedure. It is
based on ant colony optimized neural network. A virtual patient is implemented on a PC host computer, which
is interconnected with the FPGA controller. This controller constitutes a step forward to develop an autonomous
artificial pancreas.FPGA implementation of a discrete-time inverse neural optimal control is proposed in [2] to
regulate glucose level for type 1 diabetes mellitus (T1DM) patients. Besides this control law minimizes a cost

519 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

functional. The neural model is obtained from an on-line neural identifier, which uses a recurrent high-order
neural network (RHONN), trained with an Extended Kalman filter (EKF).
In research work [3], inverse optimal neural control for trajectory tracking is used in glycemic control
of type 1 diabetes mellitus (T1DM) patients. The proposed control law calculates the adequate insulin delivery
rate in order to prevent hyperglycemia and hypoglycemia levels in T1DM patients. To use a better technique
with more number of parameters, [4] is used in neural network for classifying. In this study a Diabetes dataset is
analysed using Neural Network approach. To increase the efficiency of the classification process parallel
approach is also adopted in the training phase. Primarily the classification of data is done to know the disease
stage or finding disease.
In the control of diabetes and in the dosage unit prescription, i.e., the so-called “artificial pancreas,”
modularity allows for the step-wise introduction of (and regulatory approval for) algorithmic components,
starting with subsystems for assured patient safety and followed by higher layer components that serve to
modify the patient’s basal rate in real time as proposed in [5].In [6], a neural network model has been developed
to predict the level of glucose for patients with Type 1 diabetes. However, the hardware implementation has not
been carried out. A feed forward neural network model based glucose prediction has been developed in [7].
However the design was not analyzed in terms of hardware resources. In [8], Cobelli’s glucose-insulin model
has been realized for patients with Type 1 diabetes. But the design is not analyzed in terms of hardware
resource, power consumption and speed. So far no work on the hardware implementation on the effective
diagnosis of diabetes mellitus on FPGA has been reported. To overcome the above drawbacks, this work aims at
the hardware implementation of effective diagnosis of diabetes mellitus on FPGA using neural network model is
proposed.
This work is divided into two modules. To ensure the correctness of the study, Diagnosis of Diabetes
Mellitus, the insulin blood level and the insulin dosage required prescription is verified using Matlab based on
neural network. Then the second part of the work focuses on the Hardware Implementation of the Diagnosis of
Diabetes Mellitus on FPGA.
Section 2 describes the neural network implementation of the proposed work using Matlab and displays
whether the patient is diabetic or not. Section 3 explains the calculation of Insulin level in the blood and the
Insulin Dosage Prescription for diabetic patients. Section 4 describes the hardware implementation of the
proposed work on FPGA. Section 5 shows the simulation result and synthesis report. Section 6 concludes the
work.

2. NEURAL NETWORK IMPLEMENTATION OF THE EFFECTIVE DIAGNOSIS OF DIABETES


MELLITUS

Neural Networks (NN) are parallel computational models comprised of densely interconnected
adaptive processing units called neurons or processors or nodes. NNs have the ability to learn, generalize and
organize data. They are useful in classification, function approximation and generally in complex problems,
which do not require accurate solution. They can identify patterns in data once they are exposed to similar data
beforehand. This distinguishes neural networks from other computing programs that simply follow instructions
in a fixed sequential order.

520 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

2.1Feed Forward Neural Network


The feed forward neural network was the first and simplest type of artificial neural network devised. In
this network, the information moves in only one direction, forward, from the input nodes, through the hidden
nodes (if any) and to the output nodes. There are no cycles or loops in the network.
A feed forward neural network is a biologically inspired classification algorithm. It consists of a
(possibly large) number of simple neuron-like processing units, organized in layers. Every unit in a layer is
connected with all the units in the previous layer. These connections are not equal. Each connection may have a
different strength or weight. The weights on these connections encode the knowledge of a network. Often the
units in a neural network are also called nodes.
Data enters at the inputs and passes through the network, layer by layer, until it arrives at the outputs.
During normal operation, that is when it acts as a classifier, there is no feedback between layers. This is why
they are called feed forward neural networks.Feed forward neural networks have a fixed computation
time.Computation Speed is very high, as a result of the parallel structure.Fault tolerant, because of distributed
nature of network knowledge.Feed forward neural networks eliminate the need to develop an explicit model of a
process. If an explicit mathematical model is not required then the network can be ‘programmed’ in a fraction of
the time required for traditional development. It is well suited for the biological application such a disease
classification.

2.2 Diagnosis of diabetes mellitus using neural network


In this module, the diagnosis of Diabetes Mellitus is performed with five mandatory parameters which
influence the blood sugar level of the patient. The five parameters, namely the Fasting Blood Sugar, Post
Prandial Blood Sugar, Urea, Creatinine and Haemoglobin are taken for 280 patients, and a database is created
with all these parameters in excel sheets.A corresponding target database for evaluation of output is taken. The
neural network module is executed in MATLAB and finally diagnosis of Diabetes Mellitus is made. Figure
1shows the stages involved in the classification of Diabetes.

Figure 1. Stages of Diagnosis


The neural network required for our instant physician for diabetes is implemented using
MATLAB.MATLAB coding is written to train the neural network with the required parameters to diagnose
Diabetes Mellitus by storing target folders. In the input target folder parameters such as Fasting Blood Sugar
(FBS), Post Prandial Blood Sugar (PPBS), Urea, Creatinine and Haemoglobin factors are considered for a large
number of patients in order to detect the diabetes in a person. In the output target folder the respective patient

521 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

condition is whether diabetic or not is stored. Finally the neural network is trained to get the required output that
is, indicating whether the patient is diabetic or not.
2.3Training the neural network model
Using Multiplayer Perceptron (MLP) model in MATLAB the neural network is trained. The training
methodology is described below: The inputs are fed into the input layer and get multiplied by interconnection
weights as they are passed from the input layer to the first hidden layer. Within the first hidden layer, they get
summed then processed by a nonlinear function using the hyperbolic tangent. As the processed data leaves the
first hidden layer, again it gets multiplied by interconnection weights, then summed and processed by the second
layer. Finally the data is multiplied by interconnection weights thenprocessed one last time within the output
layertoproducethe neural network output. The MLP and many other neural networks learn using an algorithm
called back-propagation. With back-propagation, the input data is repeatedly presented to the neural network.
Witheachpresentationthe outputof the neuralnetwork is comparedto the desired output and an error is computed.
This error is then fed back (back-propagated) to the neural network and used to adjust the weights such that the
error decreases with each iteration and the neural model gets closer
to produce the desired output.Thissequence ofevents isusuallyrepeated until an acceptable error
has been reachedor until the networkno longerappearsto be learning. By doing this repeated training high level
of accuracy is obtained.

2.4Creationof Input and Target Database


The different parameters essential for the diagnosis of Diabetes Mellitus are referred from the doctor’s
insight. Then, 280 Diabetes patients’ records were collected with the required parameters like Fasting Blood
Sugar (FBS), Post Prandial Blood Sugar (PPBS), Urea, Creatinine and Haemoglobin. The database with all
these parameters is created in excel sheet and stored as input target folder in the bin as shown in Figure2. The
corresponding output target folder is also created in excel sheet and stored in the bin as shown in Figure 4.
These folders are called in the program and by using standard library functions the network is trained to display
the precise output.

Figure2.Input database
In the above figure row1 indicates Fasting Blood Sugar (FBS), row2 represents Post Prandial Blood Sugar
(PPBS), row3 indicates Urea, row4 representsCreatinine and row5 indicates Haemoglobin. Figure 3 represents
the target database.

522 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

Figure 3.Target database


The code for diagnosis of Diabetes Mellitus in neural network is executed in MATLAB. After
compilation, the input parameters are given and the output is displayed on the screen whether the patient is
‘Diabetic’ or ‘Non Diabetic’ as shown in figure 4.

Figure 4. Output of Diagnosis of Diabetes Mellitus

3 INSULIN LEVEL CALCULATION AND DOSAGE PRESCRIPTION


The human body has a remarkable ability to maintain tight glucose control when someone does not
have diabetes. This tight control is possible because the pancreas and the liver work as a team to make sure that
the right balance of glucose and insulin is in the body at all times. When diabetes develops, the body is unable
to maintain this balance.
In the proposed work, once if the patient is detected as diabetic then the insulin level in the blood is
calculated and insulin dosage required is prescribed.To achieve this, two parameters namely the human body
weight, ICR and ISF are considered in creating the database in the neural network.
The human body weight is considered at the input hidden layer database. The output target layer
corresponds to the ISF and ICR values of the patients and the insulin dosage is prescribed at the output.

3.1 Insulin Sensitivity Factor (ISF):


The number of points (or mg/dL) 1 unit of insulin lowers the BG level. An ISF indicates how sensitive
the body is to insulin.

3.2 Insulin to Carbohydrate Ratio (ICR):


An ICR indicates the number of grams of carb that are covered by 1 unit ofinsulin.Rough estimation of
insulin requirement is shown in figure 5.

523 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

Figure 5. Insulin Estimation


The input database includes the weight ratio of the person with diabetes as shown in figure 6. The
corresponding ISF and ICR values are mapped in the target folder as shown in figure7. The output displays the
amount of insulin dosage units required for the patient with Diabetes Mellitus to normalize the blood glucose
level as shown in figure 8.

Figure 6. Input database for insulin dosage estimation

Figure 7. Target database for insulin dosage estimation

Figure 8. Insulin dosage required to normalize the blood glucose level

524 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

4 VLSI IMPLEMENTATION OF THE PROPOSED WORK


Hardware implementation of the Diagnosis of Diabetes Mellitusis carried out in Xilinx Spartan 6
FPGA XC6SLX9. Figure 9 shows the stages involved in hardware implementation.

Figure 9. Hardware Implementation of the Diagnosis of Diabetes Mellitus


The hardware implementation of Diabetes Mellitus is coded in the Verilog HDL module in the Xilinx
environment.
The neural network is generally implemented by assigning the weights to the inputs, adding them and
finally obtaining a specific value. This weight value is compared with all the nodes in the hidden layer and the
target value and finally the diagnosis of Diabetes Mellitus is made.
The hardware Spartan 6 FPGA kit is configured for this implementation. The 16 switches are
configured as inputs with the first 8 switches for Fasting Blood Sugar binary value and the last 8 switches for
Post Prandial Blood Sugar binary value and 1 LED is configured as output which displays whether the patient
has diabetic or not.
In the VLSI implementation of Neural Networks, the inputs of Fasting Blood Sugar and Post Prandial
Blood Sugar are given in binary to the hardware Spartan 6 kit. The inputs are assigned weights and the
individual weights are added to obtain a specific weight value of 16 bits. This weight is compared with all the
values in the look up table and based on the target values assigned, the diagnosis of Diabetes Mellitus is made.
4.1 FunctionalVerification usingIsim Simulator
The neural network is coded in Verilog HDL and its functionality is verified using iSim Simulator.
Figure 10 shows the simulation result of the proposed VLSI implementation of diagnosis of diabetes mellitus.
Here, ‘a’ and ‘b’ are the binary inputs of Fasting Blood Sugar and Post Prandial Blood Sugar
respectively which are assigned weights, added to form a specific weight value ‘pd’. This value is compared
with the values in the look up table and the output ‘z’ is observed.If the output ‘z’ is zero, then ‘ No diabetes’ is
displayed and if the output ‘z’ is one, ‘diabetes’ is displayed.

525 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

Figure 10.Simulation result of the hardware implementation of the diagnosis of diabetes mellitus
4.2 Hardware Implementation of Neural Networks
The I/O pins of the Spartan 6 kit is configured for the input switches for both the inputs, Fasting Blood
Sugar and Post Prandial Blood Sugar and for the output LED, LED1.Pin assignments are shown in figure 11.

Figure 11. Pin Assignments


After pin assignment, the hardware Spartan 6 kit is configured with the neural network coded in
Verilog module. Figure 12 shows the configuration on Spartan6 FPGA.

Figure 12. Configuration of the device

526 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

4.3Output Display
On feeding the binary inputs to the switches, the output LED glows.If the patient is diabetic, LED is
ON, else, if the patient is non-diabetic, LED is in OFF state. Figures 13 and 14 show the implementation result
on Spartan6 FPGA.

Figure 13.Display of LED1 for Diabetic Patient

Figure 14.Non-Display of LED1 for Non-Diabetic patient


Figure 15 shows the power consumption of the proposed work.

Figure 15. Power Consumption of the Hardware Implementation of the effective diagnosis of Diabetes Mellitus using Neural Network
From the figure it is inferred that the total amount of power dissipated is 0.03359W which is less than 1W. This
shows the merit of the proposed hardware implementation.
5. CONCLUSION
The effective diagnosis of Diabetes Mellitus and Insulin dosage is observed in MATLAB and its
hardware implementation is observed in Spartan 6 FPGA kit coded in Verilog module.In the future, this
effective diagnosis technique and its module can be incorporated in glucose meters like AccuChek, One Touch
.etc. The conventional glucose meter takes the drops of blood in the diabetes test strip, process them and display
the Blood Sugar Value. If this neural network module is incorporated, the diagnosis of whether the patient is
suffering from diabetes mellitus and the Insulin Dosage Level Prescription can be made to display on the screen.
This combination takes the medicine world to the next level in the cost effective diagnosis of diseases and its
early prevention.

527 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 1, January 2017

References
1. Manoj Kumar, Anubha Sharma and SonaliAgarwal, “Clinical Decision Support System
for Diabetes Disease Diagnosis Using Optimized Neural Network”, in Conf, May 2014,
Students Conference on Engineering and Systems (SCES), pp. 1 – 6.
2. Jorge C. Romero-Aragon, Edgar N. Sanchez and Alma Y. Alanis, “Glucose level
regulation for diabetes mellitus type 1 patients using fpga neural inverse optimal control”,
IEEE Symposium on Computational Intelligence in Control and Automation (CICA),
December 2014.
3. B. S. Leon, A. Y. Alanis, E. N. Sanchez, F. Ornelas-Tellez, and E. Ruiz, “Inverse
optimal neural control of blood glucose level for type 1 diabetes mellitus
patients”,Journal of the Franklin Institute, 2012, 349, pp.1851–1870.
4. M. A. Gonzalez-Olvera, A. G. Gallardo-Hernandez, Y. Tang, M. C.Revilla-Monsalve,
and S. Islas-Andrade, “ A discrete-time recurrent neuro-fuzzy network for black-box
modeling of insulin dynamics”, International Journal of Neural Systems, 2010,
Vol.20,No.2, pp.149–158.
5. G. De Nicolao, S. Del Favero, M. Breton, C.D. Man, E. Renard,H. Zisser, F.J. Doyle,
C. Cobelli, and B.P. Kovatchev, “Modular Closed Loop control of Diabetes”,IEEE
Transactions on Biomedical Engineering,Nov 2012, Vol.59,No.5, pp.2986–2999.
6. S. M. Pappada, B. D. Cameron and P. M. Rosman, “Development of a Neural Network
for Prediction of Glucose Concentration in Type 1 Diabetes Patients”,Journal of
Diabetes Science & Technology, Sep 2008, Vol. 2, No. 5, pp.792 – 801.
7. S. M. Pappada, B. D. Cameron, P. M. Rosman, R. E. Bourey, T. J. Papadimos, W.
Olorunto and M. J. Borst, “Neural network-based real-time prediction of glucose in
patients with insulin-dependent diabetes”,Diabetes Technology Therapeutics, Feb 2011,
Vol.13, No. 2, pp. 135-141.
8. P. Li, L. Yu, Q. Fang and S. Lee, “A simplification of Cobelli’s glucose–insulin model
for type 1 diabetes mellitus and its FPGA implementation”,Medical & Biological
Engineering & Computing, Oct 2016, Vol. 54, No. 10, pp. 1563 – 1577.

528 https://sites.google.com/site/ijcsis/
ISSN 1947-5500

You might also like