Batch19 Final
Batch19 Final
DEPARTMENT OF
CERTIFICATE
This is to certify that the project entitled “DETECTING ALZHEIMER’S DISEASE THROUGH
DEEP LEARNING MODELS” is being submitted by
in partial fulfillment of the requirements for the award of degree of B. Tech in Computer
Science & Engineering from Jawaharlal Nehru Technological University Kakinada is a
record of bonafide work carried out by them at Lakireddy Bali Reddy College of
Engineering.The results embodied in this Project report have not been submitted to any other
University or Institute for the award of any degree or diploma.
EXTERNAL EXAMINER
ACKNOWLEDGEMENT
We take great pleasure to express our deep sense of gratitude to our project guide
Dr. J. Nageswara Rao, Associate Professor, for his valuable guidance during the course of
our project work.
We would like to thank Dr. J. Nageswara Rao, Associate Professor & Project
Coordinator, Department of Computer Science & Engineering for his encouragement.
We would like to thank Dr. D. Veeraiah, Professor & Head of the Department of
Computer Science & Engineering for his encouragement.
We would like to express our heart-felt thanks to Dr. K. Appa Rao, Principal,
Lakireddy Bali Reddy College of Engineering for providing all the facilities for our project.
Our utmost thanks to all the Faculty members and Non-Teaching Staff of the
Department of Computer Science & Engineering for their support throughout our project
work.
Our Family Members and Friends receive our deepest gratitude and love for their
support throughout our academic year.
We are here by declaring that the project entitled “ DETECTING ALZHEIMER’S DISEASE
THROUGH DEEP LEARNING MODELS” work done by us. We certify that the work contained
in the report is original and has been done by me under the guidance of supervisor. The work has not
been submitted to any other institute in preparing for any degree or diploma. We have followed the
guidelines provided by the institute in preparing the report. We have conformed to the norms and
guidelines given in the Ethical Code of Conduct of the institute. Whenever we have used materials
(data, theoretical analysis, figures and text) from other sources, we have given due credit to them by
citing them in the text of the report and giving their details in the references. Further, we have taken
permission from the copyright’s owner of the sources, whenever necessary.
CONTENTS PAGE NO
1. INTRODUCTION 1-3
1.3 Scope 3
2.1 ExistingSystem 4
2.2 ProposedSystem 5
3. SYSTEM ANALYSIS 6 - 10
4. SYSTEM DESIGN 11 - 26
6. SYSTEM TESTING 45 - 46
7. RESULTS 47 - 48
8. CONCLUSION 49
9. REFERENCES 50
Figure 3.1: Google Colab environment 7
Figure 4.2: Splitting the dataset into training , validation and testing sets 13
1. INTRODUCTION
Department of CSE,LBRCE 1
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
The proposed project demonstrates strong economic feasibility. With Alzheimer's disease
(AD) imposing a significant burden on healthcare systems worldwide, the development of an
early detection and classification framework can lead to substantial cost savings. By facilitating
early diagnosis and intervention, the framework can potentially reduce the long-term healthcare
costs associated with AD management, including hospitalization, medication, and caregiving
expenses. Additionally, the implementation of an online program for remote AD examinations
aligns with the growing trend towards telemedicine, which can result in cost savings for both
healthcare providers and patients by minimizing the need for physical visits to medical facilities.
The project shows a high degree of technological viability. Deep learning methods,
namely convolutional neural networks (CNNs), are well-known and often used in medical image
analysis, which includes AD detection and categorization. A wealth of brain structural scans for
training and validation are made available by the Alzheimer's Disease Neuroimaging Initiative
(ADNI) dataset. Furthermore, the application of fundamental CNN architectures with 2D and 3D
convolutions and the transfer learning-assisted VGG19 model optimization show the project's
technological resilience in processing intricate medical image data.
In terms of operations, the project is very doable. The operational issues that limit routine
hospital visits are addressed by the creation of an online platform for remote AD examinations.
The program improves patient accessibility to diagnostic services, especially for those who
might find it difficult to schedule in-person sessions, by enabling remote assessment of AD
stages. Furthermore, the platform facilitates the workflow of healthcare personnel, enabling
prompt and effective assessment of AD patients, which eventually results in enhanced patient
outcomes and satisfaction. All things considered, the project's operational viability is
strengthened by its conformity to new developments in telehealth and remote medical services.
Department of CSE,LBRCE 2
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
1.3 SCOPE
The project's scope includes creating an end-to-end architecture using deep learning
methods, namely convolutional neural networks (CNNs), for the early diagnosis and
classification of Alzheimer's disease (AD). With no known treatment and no cure, AD presents a
serious healthcare concern that the project seeks to address. Early detection is key to effective
treatment. The framework will use brain structural scans from the Alzheimer's Disease
Neuroimaging Initiative (ADNI) dataset to focus on binary classification within each pair of
classes and multi-class categorization of AD stages.The project's main goals will be to
implement fundamental CNN architectures with 2D and 3D convolutions and optimize the
VGG19 model via transfer learning. Furthermore, the creation of an online platform for remote
AD assessments will allow medical practitioners to evaluate AD stages from a distance, offering
patients individualized advice and support. The evaluation of the suggested methods to gauge
their efficacy in terms of precision, computational complexity, and usability is also included in
the project's scope. The project's overall goal is to advance the diagnosis and treatment of AD,
which could enhance patient outcomes and the provision of healthcare.
Department of CSE,LBRCE 3
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
2. LITERATURE SURVEY
A variety of CNN structures and fusion algorithms are examined in other works, including those
by Khvostikov et al. and Wang et al., in an effort to maximize performance by deliberate
architectural choices and feature extraction techniques.
Additionally, Spasov et al. and Jain et al. investigate transfer learning strategies using
CNN-based models, such as VGG-16, with the goal of reducing complexity and simplifying
tasks in AD diagnosis. Wang et al. and Ge et al. provide inventive approaches for multi-modal
analyses, such as the use of voice data and the introduction of novel CNN frameworks,
exhibiting novel designs like Graph Convolutional Neural Networks (GCNN) and 3D multi-scale
CNNs. Overall, these current systems show a variety of methods for classifying and detecting
AD, utilizing multi-modal data processing and sophisticated deep learning algorithms to increase
diagnostic speed and accuracy.
Department of CSE,LBRCE 4
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
The proposed system for classifying medical imagery, specifically MRI images, utilizes a
combination of basic CNN structures designed for MRI images and transfer learning techniques
with pre-trained models like VGG19. This approach aims to enhance the accuracy and efficiency
of medical image classification, ultimately improving patient care and diagnostic capabilities.
By integrating the strengths of both methods, the system can effectively handle the complexities
of medical imagery and provide reliable results for healthcare professionals. The system's
adaptability to new data and evolving medical imaging technologies ensures it remains
up-to-date and effective in providing accurate image classification.
The use of pre-trained models like VGG19 allows the system to leverage the knowledge and
expertise gained from training on large, diverse datasets. This helps the system learn and
recognize patterns and features in medical images more effectively, reducing the need for
extensive training on specific medical datasets.
Moreover, the system's architecture and training process are designed to optimize performance
and minimize computational resources. This makes the system more efficient and scalable,
enabling it to handle large volumes of medical imagery and provide timely results for healthcare
professionals.
Overall, the system represents a significant advancement in medical image analysis, offering
improved accuracy, efficiency, and adaptability to support better patient care and diagnostic
capabilities. The integration of basic CNN structures and transfer learning techniques with
pre-trained models like VGG19 provides a powerful and effective solution for classifying
medical imagery, ultimately improving patient outcomes and healthcare delivery.
Department of CSE,LBRCE 5
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
3. SYSTEM ANALYSIS
3.1.1 MachineLearning
Machine learning (ML) is one of the applications of Artificial Intelligence (AI) that
offers machines or systems the ability to learn and improve from the experience without
being explicitly programmed. It is simply making a computer perform a task without
explicitly programming it. In today’s world every system that does well has a machine
learning algorithm at its heart. Take for example Google Search engine, Amazon Product
recommendations, LinkedIn, Facebook etc., all these systems have machine learning
algorithms embedded in their systems in one form or the other. They are efficiently utilizing
data collected from various channels which helps them get a bigger picture of what they are
doing and what they should do. It begins from a stage of pre-processing of data followed by
feature selection, classification, performance evaluation and finally results with enhanced
accuracy.
3.2.1 Python
Department of CSE,LBRCE 6
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
preferred language for teaching and learning ML (Machine Learning). Few simple reasons
are:
● It’s simple to learn. As compared to C, C++ and Java the syntax is simpler and
Python also consists of a lot of code libraries for ease o fuse.
● Though it is slower than some of the other languages, the data handling capacity is great.
● Open Source : Python along with R is gaining momentum and popularity in the Analytics
domain since both of these languages are open source.
● Capability of interacting with almost all the third party languages and platforms
Colab is a hosted Jupyter Notebook service that requires no setup to use and provides
free access to computing resources, including GPUs and TPUs. Colab is especially well
Department of CSE,LBRCE 7
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
3.2.3 Packages
pandas : pandas is a software library written for the Python programming language for data
manipulation and analysis. In particular, it offers data structures and operations for
manipulating numerical tables and time series. Pandas is mainly used for machine learning
in form of dataframes. Pandas allow importing data of various file formats such as csv, excel
etc.
sklearn : sklearn (Scikit-learn) is a free software machine learning library for the Python
programming language. It features various classification, regression and clustering
algorithms. It provides a range of supervised and unsupervised learning algorithms via a
consistent interface in python.
3.2.4 Dataset
The 6,400 brain MRI images in the dataset utilized in this study were carefully chosen to
represent different stages of Alzheimer's disease (AD). These images, which are from the
well-known dataset (Table.1) and machine learning website Kaggle, show four different stages of
the AD spectrum. The dataset is made up of brain MRI scans, each carefully labeled and grouped
into one of the four distinct phases of AD listed below:
Moderate demented 64
Department of CSE,LBRCE 8
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Each stage is represented by a subset of MRI scans, making it easier to analyze and categorize
throughout the whole range of AD progression. The dataset, which consists of 6,400 brain MRI
images, is large enough to enable accurate training and validation of the proposed model for
accurate identification and classification of different stages of Alzheimer's disease. Preprocessing
of the data obtained from Kaggle involved labeling, curation, and segmentation in order to
ensure the accuracy and integrity of the dataset for training and evaluating the proposed model
for AD detection and classification.Additionally, to enhance the robustness and generalizability
of the proposed model, various data augmentation techniques were employed during the
preprocessing phase. These techniques included rotation, flipping, scaling, and adding noise to
the MRI images, thereby increasing the diversity of the training data and reducing the risk of
overfitting. Moreover, extensive quality control measures were implemented to address any
inconsistencies or artifacts present in the dataset, ensuring the reliability of the model's
predictions. The labeled MRI scans were carefully reviewed by domain experts to confirm the
accuracy of the assigned labels and to minimize any potential bias in the dataset. Furthermore,
advanced image processing algorithms were utilized for segmentation and feature extraction,
capturing subtle patterns and abnormalities indicative of Alzheimer's disease progression.
Department of CSE,LBRCE 9
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Languages : Python
Department of CSE,LBRCE 10
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
4. SYSTEM DESIGN
This system design presents a comprehensive framework for MRI-based diagnosis and
categorization of Alzheimer's disease (AD). The first step involves obtaining data from the
Alzheimer's Disease Neuroimaging Initiative (ADNI) dataset, which consists of 300 patients' 2D
T1-weighted MRI scans divided into four groups. Class imbalance is addressed by
preconditioning techniques like resampling, which are followed by data enhancement techniques
like augmentation. After that, medical image categorization is carried out using a combination of
transfer learning methods with the VGG19 model and CNN structures customized for 2D and 3D
MRI images. Evaluation metrics are used to carefully evaluate performance. Lastly, the best
models are suggested for an online application for AD checking that will enable remote
evaluation and customized advice based on stages of AD identification.
The proposed online platform for Alzheimer's disease (AD) checking represents a pivotal
advancement in early diagnosis and personalized care. By integrating state-of-the-art MRI
analysis models, the platform empowers users to conveniently upload their scans for automated
assessment. With robust user authentication and privacy measures in place, patient data remains
secure and compliant with regulatory standards. Upon upload, the system preprocesses the scans
for consistency and employs advanced machine learning techniques to analyze and interpret the
results. Users receive comprehensive reports detailing their AD risk along with actionable
recommendations, fostering informed decision-making. Moreover, the platform facilitates remote
consultations with healthcare professionals, enabling timely interventions and support.
Continuous feedback mechanisms ensure the platform's accuracy and relevance, while
educational resources empower users with knowledge to actively manage their health. By
seamlessly integrating with existing healthcare systems, this platform holds promise in
revolutionizing AD diagnosis and care delivery, ushering in a new era of proactive health
management.
Department of CSE,LBRCE 11
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Department of CSE,LBRCE 12
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Machine learning (ML) is the scientific study of algorithms and statistical models
that computer systems use to perform a specific task without using explicit instructions,
relying on patterns and inference instead. It is seen as a subset of artificial intelligence.
Machine learning algorithms build a mathematical model based on sample data, known as
"training data", in order to make predictions or decisions without being explicitly
programmed to perform the task. Machine learning algorithms are used in a wide variety of
applications, such as email filtering and computer vision, where it is difficult or infeasible to
develop a conventional algorithm for effectively performing the task.
The MRI scans are divided into training, validation, and testing sets as part of the dataset
splitting process. For various phases of the construction and assessment of models, these sets are
crucial. The validation set helps with hyperparameter tuning and model performance
optimization, whereas the training set is used to train the models. In order to ensure that the final
model can be generalized, the testing set is finally set aside for evaluating the model's
performance on untested data. While precise information regarding the split's proportions is not
given, this procedure is essential for reliable model development and assessment in machine
learning workflows.
Figure 4.2. Splitting the dataset into training, validation and testing datasets
Department of CSE,LBRCE 13
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
4.3 METHODOLOGY
The images were pre-processed by applying image augmentation. The augmentation techniques
applied are: zooming, brightness change, horizontal flip and re-scaling. SMOTE (Synthetic
Minority Over-sampling Technique) was performed to balance the data in the minority classes. A
total of 12,800 images were obtained after the preprocessing stage. Synthetic Minority
Oversampling Technique (SMOTE) is a statistical technique for increasing the number of cases
in your dataset in a balanced way. The component works by generating new instances from
existing minority cases that you supply as input.
1. Identify Minority Class: First, identify the minority class in the dataset. This is the class that
has fewer instances compared to the majority class.
2. Select Minority Class Instances: Randomly select a sample from the minority class
instances.
3. Find Nearest Neighbors: For each of these minority class instances selected, find its k
nearest neighbors. The value of k is a parameter set by the user.
4. Generate Synthetic Samples: For each selected minority class instance, create synthetic
samples by randomly selecting one of its nearest neighbors and then creating a new instance
along the line joining the two points in the feature space. This creates new minority class
samples within the vicinity of the original samples.
Department of CSE,LBRCE 14
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
5. Repeat: Repeat steps 2-4 until the desired balance between the minority and majority classes
is achieved.
1. Purpose-built for TensorFlow: TPUs are optimized for TensorFlow, an open-source machine
learning framework developed by Google. They are particularly well-suited for training and
running deep neural networks, including convolutional neural networks (CNNs) and recurrent
neural networks (RNNs).
Department of CSE,LBRCE 15
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
2. High Performance: TPUs are designed to deliver high performance and throughput for
machine learning tasks. They can process large amounts of data quickly, making them ideal for
training complex models on large datasets.
4. Cost-efficient: TPUs offer high performance while consuming relatively less power compared
to traditional CPU or GPU-based systems. This can result in cost savings, especially for
large-scale machine learning tasks that require significant computational resources.
5. Cloud Integration: Google offers TPUs as part of its cloud computing services, allowing
users to access TPUs on-demand through platforms like Google Cloud Platform (GCP). This
enables researchers, developers, and organizations to leverage the power of TPUs without having
to invest in dedicated hardware.
6. TensorFlow Integration: Google has integrated support for TPUs directly into TensorFlow,
making it easy for users to harness the power of TPUs in their machine learning projects.
TensorFlow automatically optimizes computations to take advantage of the hardware
acceleration provided by TPUs.
4.3.3.1 Inceptionv3
Department of CSE,LBRCE 16
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
1. Inception Modules: The hallmark of InceptionV3 architecture is its Inception modules. These
modules consist of multiple parallel convolutional operations with different kernel sizes,
enabling the network to capture features at various scales and resolutions. Each Inception module
typically contains 1x1, 3x3, and 5x5 convolutions, along with max-pooling operations.
Additionally, it includes 1x1 convolutions for dimensionality reduction before and after the
larger convolutions. The outputs of these parallel operations are concatenated along the depth
dimension, allowing the network to capture diverse features from the input images efficiently.
5. Pre-trained Model: Google has released InceptionV3 as a pre-trained model trained on the
ImageNet dataset, which contains millions of labeled images across thousands of categories. This
pre-training allows users to leverage transfer learning, where the pre-trained model's weights are
fine-tuned on a specific dataset or task with relatively fewer labeled examples.
Department of CSE,LBRCE 17
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
4.3.3.2 Xception
1.Depth Wise Separable Convolutions: The key innovation in Xception is the use of depth
wise separable convolutions as the primary building block. This operation consists of two steps:
depthwise convolution and pointwise convolution. Depthwise convolution applies a single filter
to each input channel separately, resulting in a set of output channels. This step captures spatial
correlations within each channel independently.Pointwise convolution applies 1x1 filters across
all channels of the depthwise convolution output. This step enables cross-channel information
exchange and feature combination. Depthwise separable convolutions are computationally
efficient compared to traditional convolutions, as they reduce the number of parameters and
computations while preserving representational capacity.
Department of CSE,LBRCE 18
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
3. Entry and Exit Flows: Xception includes entry and exit flow modules to handle the input and
output data, respectively. The entry flow consists of a series of convolutional and pooling layers
to process the input image and extract features. The exit flow typically involves global average
pooling, fully connected layers, and softmax activation for classification.
5. Pre-trained Model: Xception is often used as a pre-trained model, trained on large datasets
like ImageNet. This pre-training allows users to leverage transfer learning, where the pre-trained
model's weights are fine-tuned on specific datasets or tasks with fewer labeled examples.
Department of CSE,LBRCE 19
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
4.3.3.3 RestNet50
ResNet50 is a convolutional neural network (CNN) architecture that belongs to the family of
Residual Networks (ResNets). ResNets were introduced by Kaiming He et al. in their seminal
paper "Deep Residual Learning for Image Recognition" in 2015. ResNet50 specifically refers to
a variant of ResNet that contains 50 layers, including convolutional layers, pooling layers, and
residual blocks. Here's an explanation of ResNet50:
1. Residual Blocks: The fundamental building block of ResNet is the residual block. It contains
two convolutional layers with Batch Normalization (BN) and Rectified Linear Unit (ReLU)
activation functions, followed by a skip connection. The skip connection, also known as a
shortcut or identity connection, bypasses the convolutional layers and directly adds the input to
the output of the convolutional layers. Mathematically, the output of a residual block is given by:
\(Y = F(X) + X\), where \(X\) is the input, \(F(X)\) is the output of the convolutional layers, and
\(Y\) is the final output of the block.
3. Identity Mapping: The key insight behind ResNet's success is the use of identity mappings
through the skip connections. By allowing the input signal to directly propagate through the
network without undergoing nonlinear transformations in the convolutional layers, the gradient
flow during backpropagation is facilitated. This helps mitigate the vanishing gradient problem,
enabling the training of very deep networks with improved performance.
Department of CSE,LBRCE 20
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
4. Batch Normalization and Activation Functions: Batch normalization and ReLU activation
functions are applied after each convolutional layer in ResNet50. Batch normalization
normalizes the activations of each layer, stabilizing the training process and accelerating
convergence. ReLU introduces non-linearity into the network, allowing it to learn complex
mappings from the input to the output.
5. Fully Connected Layers: ResNet50 typically ends with one or more fully connected layers
followed by a softmax activation function for multi-class classification tasks. These fully
connected layers map the high-level features extracted by the convolutional layers to the output
classes.
Department of CSE,LBRCE 21
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Department of CSE,LBRCE 22
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Department of CSE,LBRCE 23
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
IDENTIFYING RELATIONSHIPS:
In UML the ways that things can connect to each other wither logically or physically
are modeled as relationships. In object-oriented modeling there are three kinds of
relationships that are most important, they are
3. Association : It is a structural relationship that specifies that objects of one thing are
connected to the objects of another. The associations that connect more than two classes are
called n-array associations. Graphically it is rendered as a solid line connecting the same or
different classes.
Department of CSE,LBRCE 24
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
When the action or activity of a state completes, flow of control passes immediately
to the next action or activity state. You specify this flow by using transitions to show the
path from one action or activity state to the next action or activity state. You represent this as
a simple directed line.
Object Flow
Objects may be involved in the flow of control associated with an activity diagram.
The use of dependency relationships and objects is called an object flow because it
represents participation of an object in the flow of control.
Department of CSE,LBRCE 25
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Department of CSE,LBRCE 26
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
4.2.2 Algorithm
# Step 1: Import Dependencies and Prepare Dataset
- Import necessary libraries
- Mount Google Drive to access the dataset
- Unzip and preprocess the dataset
- Define directories and constants
# Step 2: Load and Augment Image Data
- Use ImageDataGenerator to load and augment images
- Show sample images for visualization
# Step 3: Apply SMOTE Oversampling
- Use SMOTE to balance the dataset
# Step 4: Split Dataset into Train, Test, and Validation Sets
- Split the dataset into train, test, and validation sets
# Step 5: Create and Train Models
- Define functions to create and train models
- Create base models (InceptionV3, Xception, ResNet50)
- Train the models on the training data
# Step 6: Evaluate Models
- Evaluate the trained models on the test dataset
# Step 7: Create and Train Ensemble Model
- Load trained individual models
- Create an ensemble model using the loaded models
- Train the ensemble model on the test data
# Step 8: Evaluate Ensemble Model
- Evaluate the ensemble model on the test dataset
# Step 9: Conclusion
- Print final accuracy metrics and visualization
Department of CSE,LBRCE 27
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
5. CODING IMPLEMENTATION
CODE :
drive.mount('/content/gdrive')
!unzip gdrive/MyDrive/alzheimers_data.zip
import numpy as np
import pandas as pd
import tensorflow as tf
import os
Department of CSE,LBRCE 28
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Department of CSE,LBRCE 29
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
root_dir = "./"
if os.path.exists(work_dir):
remove_tree(work_dir)
os.mkdir(work_dir)
copy_tree(train_dir, work_dir)
copy_tree(test_dir, work_dir)
WORK_DIR = './dataset/'
CLASSES = [ 'NonDemented',
'VeryMildDemented',
'MildDemented',
'ModerateDemented']
IMG_SIZE = 176
Department of CSE,LBRCE 30
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
HORZ_FLIP = True
FILL_MODE = "constant"
DATA_FORMAT = "channels_last"
batch_size=6500, shuffle=False)
def show_images(generator,y_pred=None):
"""
"""
x,y = generator.next()
plt.figure(figsize=(10, 10))
Department of CSE,LBRCE 31
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
if y_pred is None:
for i in range(9):
ax = plt.subplot(3, 3, i + 1)
plt.imshow(x[idx])
plt.axis("off")
plt.title("Class:{}".format(labels[np.argmax(y[idx])]))
else:
for i in range(9):
ax = plt.subplot(3, 3, i + 1)
plt.imshow(x[i])
plt.axis("off")
plt.title("Actual:{} \nPredicted:{}".format(labels[np.argmax(y[i])],labels[y_pred[i]]))
show_images(train_data_gen)
print(train_data.shape, train_labels.shape)
Department of CSE,LBRCE 32
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
#SMOTE
sm = SMOTE(random_state=42)
print(train_data.shape, train_labels.shape)
#Train-Test-Validation Split
0.2, random_state=42)
0.2, random_state=42)
print(train_data.shape)
print(test_data.shape)
print(val_data.shape)
class MyCallback(tf.keras.callbacks.Callback):
Department of CSE,LBRCE 33
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
self.model.stop_training = True
my_callback = MyCallback()
epochs = 25
IMG_HEIGHT = 176
IMG_WIDTH = 176
def create_model(base_model):
base_model.trainable = True
global_average_layer =
tf.keras.layers.GlobalAveragePooling2D()(base_model.output)
model = tf.keras.models.Model(inputs=base_model.input,
outputs=prediction_layer)
model.compile(optimizer=tf.keras.optimizers.Adam(lr=0.0001),
loss=tf.losses.CategoricalCrossentropy(), metrics=["accuracy"])
return model
Department of CSE,LBRCE 34
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
def fit_model(model):
history = model.fit(
train_data, train_labels,
epochs=epochs,
validation_data=(val_data, val_labels)
return history
def plot_history(history):
acc = history.history['accuracy']
val_acc = history.history['val_accuracy']
loss=history.history['loss']
val_loss=history.history['val_loss']
epochs_range = range(epochs)
plt.figure(figsize=(12, 6))
plt.subplot(1, 2, 1)
plt.legend(loc='lower right')
Department of CSE,LBRCE 35
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
plt.subplot(1, 2, 2)
plt.legend(loc='upper right')
plt.show()
weights="imagenet")
weights="imagenet")
model1 = create_model(base_model1)
model2 = create_model(base_model2)
model3 = create_model(base_model3)
weights="imagenet")
Department of CSE,LBRCE 36
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
model2 = create_model(base_model2)
history1 = fit_model(model1)
model1.save('sample_data/models/model1A.h5')
history2 = fit_model(model2)
model2.save('sample_data/models/model2B.h5')
history3 = fit_model(model3)
model3.save('sample_data/models/model3C.h5')
final_accuracy1 = history1.history["val_accuracy"][-5:]
final_accuracy2 = history2.history["val_accuracy"][-5:]
final_accuracy3 = history3.history["val_accuracy"][-5:]
plot_history(history1)
plot_history(history2)
plot_history(history3)
Department of CSE,LBRCE 37
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
def load_all_models():
all_models = []
#filename=model_name
model = tf.keras.models.load_model(filename)
all_models.append(model)
print('loaded:', filename)
return all_models
def ensemble_model(models):
layer.trainable = False
merge = tf.keras.layers.concatenate(ensemble_outputs)
Department of CSE,LBRCE 38
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
model.compile(optimizer=tf.keras.optimizers.Adam(lr=0.001),
loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True), metrics=["accuracy"])
return model
models = load_all_models()
model = ensemble_model(models)
drive.mount('/content/drive')
'''
'''
print(len(X))
#Ensemble training
epochs = 50
Department of CSE,LBRCE 39
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
epochs=epochs,
validation_data=(X_1, test_labels)
model.save('sample_data/models/ensemble_model.h5')
model = tf.keras.models.load_model('ensemble_model.h5')
final_accuracy = history.history["val_accuracy"][-5:]
plot_history(history)
test_labels[1]
rounded_labels=argmax(test_labels, axis=1)
rounded_labels[1]
# make predictions and evaluate
Department of CSE,LBRCE 40
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
len(yhat)
cm = confusion_matrix(rounded_labels, yhat)
cm
yticklabels=CLASSES)
plt.xlabel('Prediction')
plt.ylabel('Truth')
plt.show(ax)
model1 = tf.keras.models.load_model('model1A.h5')
yhat1=model1.predict(test_data)
Department of CSE,LBRCE 41
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
cm1
yticklabels=CLASSES)
plt.xlabel('Prediction')
plt.ylabel('Truth')
plt.show(ax)
Evaluation of Xception
model2 = tf.keras.models.load_model('model2B.h5')
yhat2=model2.predict(test_data)
Department of CSE,LBRCE 42
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
cm2
yticklabels=CLASSES)
plt.xlabel('Prediction')
plt.ylabel('Truth')
plt.show(ax)
model3 = tf.keras.models.load_model('model3C.h5')
yhat3=model3.predict(test_data)
cm3
Department of CSE,LBRCE 43
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
yticklabels=CLASSES)
plt.xlabel('Prediction')
plt.ylabel('Truth')
plt.show(ax)
import visualkeras
visualkeras.layered_view(model)
visualkeras.layered_view(model1)
visualkeras.layered_view(model2)
visualkeras.layered_view(model3)
Department of CSE,LBRCE 44
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
6. SYSTEM TESTING
Verify that data preprocessing steps (e.g., normalization, quality control, missing
value imputation) are executed accurately. Ensure supervised attribute clustering and
mutual information enhancement techniques are applied correctly. Verify that machine
learning models are trained and evaluated properly.
Test the interactions and interfaces between different components such as data
preprocessing modules, supervised attribute clustering algorithms, mutual information
enhancement techniques, and machine learning classifiers. Ensure seamless data flow
between these components without errors or inconsistencies.
Measure the time taken to preprocess data, cluster gene expression profiles, calculate
mutual information scores, train machine learning models, and evaluate model
performance.Assess the system's speed, scalability, and resource utilization under various
conditions.
Department of CSE,LBRCE 45
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Assess the system's ability to handle unexpected inputs, errors, or edge cases
gracefully.Introduce noise or perturbations into the input data. Simulate missing or corrupted
data .Test the system's resilience to outliers or abnormalities in gene expression profiles.
Algorithm Accuracy
InceptionV3 95.60%
Xception 91.39%
RestNet50 95.60%
Department of CSE,LBRCE 46
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
7. RESULTS
Department of CSE,LBRCE 47
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
Figure 7.3. Training and validation accuracies, losses of three models in order
Department of CSE,LBRCE 48
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
8. CONCLUSION
This research introduces the E2AD2C framework, em- ploying CNN architectures
within a deep learning setup for Alzheimer’s disease detection and the classification of
medical images. It devises binary classifications for each class pair, focusing on the distinctive
phases of AD. The approach encompasses two main strategies: first, it leverages transfer
learning using an enhanced VGG19 model for multi-class image categorization. Second, it
implements straightforward CNN architectures relying on 2D and 3D convolutions to analyze
structural brain scans sourced from the ADNI dataset. An integral part of this framework is a
web application tailored for remote Alzheimer’s disease screening. This application empowers
patients and physicians to evaluate AD stages within the spectrum and receive relevant
recommendations. The study meticulously compares nine performance metrics between the
two approaches, highlighting the effectiveness of the proposed architectures. These models
ensure efficient processing times while mitigating overfitting, reducing memory requirements,
and managing computational complexity. Impressively, the 2D and 3D CNN architectures
attain high accuracies of 93.61classifications. The pre-trained VGG19 model exhibits
outstanding performance, achieving an impressive accuracy of 97to explore the efficacy of
additional pre-trained models, such as Efficient Net B0 to B7, for multiclass AD stage
classifications. Basic techniques for data augmentation are also included in the paper, and the
DCGAN approach will be used for additional improvement. By highlighting Alzheimer’s
traits prior to AD stage classifications, MRI segmentation techniques will be used to provide a
more detailed picture of the disease’s course. This thorough method highlights the potential of
the suggested framework in improving the identification, categorization, and remote screening
of Alzheimer’s disease.
Department of CSE,LBRCE 49
DETECTING ALZHEIMER'S DISEASE THROUGH DEEP LEARNING MODELS
9. REFERENCES
[1] Singh SP, Wang L, Gupta S, Goli H, Padmanabhan P, Gulya´s B. 3D Deep learning on
medical images: a review, 2020;1–13
[2] Jo T, Nho K, Saykin AJ. Deep learning in Alzheimer’s disease: diagnos- tic classification
and prognostic prediction using neuro- imaging data,Frontiers in Aging Neuroscience. 2019;11
[3] Wen J, et al. Convolutional neural networks for classification of Alzheimer’s disease:
overview and reproducible evaluation, MedicalImage Analysis. 2020;63:101694
[4] Altinkaya E, Polat K, Barakli B. Detection of Alzheimer ’ s disease and dementia states
based on deep learning from MRI images: a comprehensive review. 2020;39–53
[5] Physicians PC. 2020 Alzheimer’s disease facts and figures. Alz- heimer’s Dement.
2020;16(3):391–460. Yang Y, Li X, Wang P, Xia Y, Ye Q. Multi-Source transfer learning via
ensemble approach for initial diagnosis of Alzhei- mer’s disease, IEEEJ Transl Eng Heal Med.
2020;1–10
[6] Adelina C. The costs of dementia: advocacy, media, and stigma. Alzheimer’s Dis Int
World Alzheimer Rep. 2019;2019:100–1.
[7] Pulido MLB, Herna´ndez JBA, Ballester MAF, Gonza´lez CMT, Mekyska J, Sme´kal Z.
Alzheimer’s disease and automatic speech analysis: a review, Expert Syst Appl.2020;150.
.[9] He Y, et al. Regional coherence changes in the early stages of Alzheimer’s disease: a
combined structural and resting-state functional MRI study. Neuroimage. 2007;35(2):488– 500
[10] https://www.kaggle.com/datasets/ninadaithal/imagesoasis
Department of CSE,LBRCE 50
Detecting Alzheimer’s Disease through Deep Learning
Models
Jayaram Behara K.Prathyusha M.Hima Vamsi Reddy
Computer Science and Engineering Computer Science and Engineering Computer Science and Engineering
Department Department Department
Lakireddy Bali Reddy College of Lakireddy Bali Reddy College of Lakireddy Bali Reddy College of
Engineering, Engineering, Engineering,
Mylavaram,India Mylavaram, India Mylavaram, India
[email protected] [email protected] [email protected]
Dr.J.Nageswara Rao
Associate Professor
Computer Science and Engineering
Department
Lakireddy Bali Reddy College of
Engineering,
Mylavaram,India
[email protected]
Abstract— An end-to-end structure for deep learning is fifty million dementia cases worldwide, and it is anticipated
presented in this work to improve Alzheimer's Disease (AD) the it would increase to 152 million by the year 2050. This
early detection and categorization. It tackles the multi-class emphasizes its need for prompt diagnosis and efficient
classification of AD stages by utilizing convolutional neural treatment. Proactive action is urgently needed to combat the
networks (CNNs), providing both general stage classification
escalating burden of AD, as evidenced by the estimated $1
and a binary categorization within each pair of classes. Two
primary methods are investigated: transfer learning using the trillion yearly cost by 2030 [7].
VGG19 model and basic CNN architectures for brain
structural imaging. The online application that the framework
culminates in for distant AD tests offers vital help during the
COVID-19 epidemic. Evaluation measures show how well the
CNN designs work, with the improved VGG19 model achieving
especially high accuracy rates. The results of the experiments
show the benefits of the CNN designs in terms of memory
requirements, computational complexity, and ease of use.
Notably, the 2D and 3D CNNs achieve remarkable accuracy
rates at 93.61% and 95.17%, accordingly, on multiple classes
of Alzheimer's disease stages classification. Furthermore, an
accuracy of 97% in multiple classes of Alzheimer's disease
stages classification is achieved by the optimized VGG19
model.
Figure.1 Percentage of the population impacted by AD
Keywords— Deep Learning, Alzheimer’s Disease, Brain
MRI, Convolutional Neural Networks, Medical Image When it comes to age demographics, the prevalence of AD
Categorization.
varies, but estimates indicate that the number of affected
people will increase significantly, especially among the
I. INTRODUCTION elderly [5]. In the country of America alone, more than five
million adults aged 65 and older had Dementia in 2020; by
Alzheimer's Dementia accounts for 60 and 80 percentage in 2050, that Figure.1 is projected to grow to thirteen million
dementia cases worldwide, making it the most prevalent [5]. Despite these alarming statistics, effective treatment
kind of dementia [1, 2]. This neurodegenerative disease methods for AD are still elusive, highlighting the need of
often begins slowly, initially manifesting as mild cognitive early detection in lessening its effects [8, 9]. Conventional
impairment (MCI), which subsequently progresses to a more methods for diagnosing AD frequently depend on manual
severe form of cognitive loss. Memory loss, cognitive feature extraction, making assumptions about anatomical or
impairments, and difficulty doing fundamental tasks are functional abnormalities in the brain [14,15]. These
only a few of the damage that AD causes to brain cells [3, techniques require technical skill, take a lot of time, and are
4]. Due to its progressive nature, mitigating its debilitating subjective. Particularly, convolutional neural networks, also
effects requires early detection and intervention methods. called CNNs, have become recognized as a viable method to
Given their increased risk of Alzheimer's Dementia, it is overcome these constraints in deep learning [17, 18]. CNNs
imperative to identify humans with moderate memory loss show potential in the diagnosis of AD since they can
[5, 6]. On the other hand, AD frequently modifies brain automatically extract features, removing the requirement for
structure long before symptoms manifest, delaying manually produced features.
diagnosis. ADI reports that there are currently greater than
This article presents a novel framework based on deep III. DATASET DESCRIPTION
learning techniques and CNNs: the Early Identification and
Categorization of Alzheimer's Disease End-to-End The 6,400 brain MRI images in the dataset utilized in this
(E2AD2C) architecture. The system aims to accurately study were carefully chosen to represent different stages of
classify four stages of AD and facilitate remote AD Alzheimer's disease (AD). These images, which are from
assessment through the use of a proposed web application. the well-known dataset (Table.1) and machine learning
With the use of CNN architectures and transfer learning, this website Kaggle, show four different stages of the AD
system seeks to revolutionize AD detection and spectrum. Several techniques may be used to correct the
categorization, offering a viable route toward precise and dataset's class imbalance. First of all, strategies like under
effective diagnosis. A review of related works, an sampling majority classes or oversampling minority classes
explanation of the problem statement, an outline of the (for example, by employing synthetic data creation
proposed solution, a discussion of materials and techniques like SMOTE) might assist in achieving a balance
methodologies, an experimental report, model evaluations, in sample distribution across classes. Furthermore, by giving
and a conclusion summarizing the study's contributions and minority classes greater weights during model training, class
implications comprise the various sections that make up this weights can lessen the effects of class imbalance. Moreover,
paper combining predictions from several classifiers trained on
II. LITERATURE SURVEY
various subsets of the data through the use of ensemble
techniques like bagging or boosting might enhance overall
performance. The dataset is made up of brain MRI scans,
Payan et al. (2019): Sparse Automatic encoders and 3D each carefully labeled and grouped into one of the four
Computational Neural Networks for AD Detection A sparse distinct phases of AD listed below:
autoencoder in combination with 3D convolutional neural
systems is used to detect AD based on brain MRI scans. Class Number of Data Samples
Even if the pre-trained convolutional layer wasn't fine-
tuned, 3D convolutions have an advantage over 2D Non-demented 3200
convolutions that suggests fine-tuning could result in Very mild demented 2240
performance benefits [20]. CNN architectures (Sarraf et al.,
[21], Hosseini et al. Adaptable a three-dimensional with Mild demented 896
Deep Supervision Pre-training evaluation was conducted Moderate demented 64
using CAD-Dementia datasets and tenfold cross-validation
VI. SUGGESTED METHODS FOR CLASSIFICATION There are three layers to it:
The typical construction of machine learning approaches An activation map with dimensions of AH × AW is created
involves three essential steps: feature extraction, feature when the Convolution Layer functions, where AH denotes
reduction, and classification. However, with typical activation height and AW denotes activation width. By
Convolutional Neural Networks (CNNs), both phases computing AH and AW using equations 1 and 2, it is
seamlessly converge, negating the need for human feature ensured that important features will be extracted while
extraction. By applying weights that they have learnt, the preserving the spatial properties of the input image. This
initial layers of CNNs function as feature extractors, method increases the model's ability to extract relevant
removing relevant patterns and representations from the information by employing convolutions, which increases the
input data. These weights are regularly refined through Convolutional Neural Network's (CNN) overall efficacy.
iterative learning, which gradually raises the model's
efficacy and flexibility. Because of their iterative learning
process, which allows them to continuously improve their
interpretation of input data, CNNs (Figure.4) are useful tools
for a range of machine learning applications.