You are on page 1of 31

Pneumonia Detection from CT scan

Project report submitted in partial fulfillment of the requirements for the


award of the degree of
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE AND ENGINEERING
By
V. Eswar - 20B81A05H6
V. Mohan Sai Babu - 20B81A05H7
V. Prasanthi - 20B81A05H8
V. Ajay Vamsi - 20B81A05H9
V. Dileep - 20B81A05I0

Under the Guidance of


Dr. S. Krishna Rao, M. Tech, Ph. D.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


SIR C R REDDY COLLEGE OF ENGINEERING
Approved by AICTE & Accredited by NBA
Affiliated to Jawaharlal Nehru Technological University, Kakinada
ELURU-5340007
A.Y.2023-2024

i
SIR C R REDDY COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE
This is to certify that the project report entitled “Pneumonia Detection from CT scan”
being submitted by

V. Eswar 20B81A05H6

V. Mohan Sai Babu 20B81A05H7

V. Prasanthi 20B81A05H8

V. Ajay Vamsi 20B81A05H9

V. Dileep 20B81A05I0

in partial fulfillment for the award of the Degree of Bachelor of Technology in Computer
Science and Engineering to the Jawaharlal Nehru Technological University, Kakinada is a record
of bonafied work carried out under my guidance and supervision.

Dr. S. Krishna Rao, M. Tech, Ph.D. Dr. A. YESUBABU M. Tech, Ph.D.


Professor Head of the Department

External Examiner

ii
DECLARATION

We here by declare that the Project entitled “Pneumonia Detection from CT scan” submitted

for the B. Tech Degree is my original work and the Project has not formed the basis for the

award of any degree, associateship, fellowship or any other similar titles.

Place: ELURU PROJECT TEAM MEMBERS:

Date: V. ESWAR - 20B81A05H6

V. MOHAN SAI BABU - 20B81A05H7

V. PRASANTHI - 20B81A05H8

V. AJAY VAMSI - 20B81A05H9

V. DILEEP - 20B81A05I0

iii
ACKNOWLEDGEMENT

We express our sincere thanks to our principal Dr. K. VENKATESWARA RAO, for providing

the necessary infrastructure required for the project.

We would like to thank Dr. A. YESU BABU, Head of the Department of CSE, for providing the
necessary facilities and his guidance in efficient way for completion of the project in the
specified successfully.

We express our deep-felt gratitude to Dr. S. KRISHNA RAO, Professor, Department of CSE,
for his valuable guidance and unstinting encouragement enabled us to accomplish our project
successfully in time.

We would like to thank, Dr. N. DEEPAK, project i n t e r n a l coordinator, Department of CSE,


for his support and advices to get and complete project successfully in time.

We are extremely great full to my department staff members and friends who helped me in
successful completion of this project.

PROJECT TEAM MEMBERS:

V. ESWAR - 20B81A05H6

V. MOHAN SAI BABU - 20B81A05H7

V. PRASANTHI - 20B81A05H8

V. AJAY VAMSI - 20B81A05H9

V. DILEEP - 20B81A05I0

iv
ABSTRACT

Pneumonia, a respiratory infection that inflames the air sacs in one or both lungs, has become
increasingly prevalent, particularly in contaminated, crowded, and densely populated areas. This
condition poses significant health risks due to its potential to cause severe breathing difficulties.
Traditionally, pneumonia is diagnosed through imaging techniques such as X-rays and CT scans.

X-rays serve as a primary method for identifying pneumonia, providing basic information on the
presence of lung abnormalities. However, CT scans offer more comprehensive and detailed
imaging, enabling a more accurate detection of pneumonia while minimizing radiation exposure.

Deep learning, a subset of artificial intelligence, has emerged as a powerful tool for developing
predictive models to detect pneumonia from CT scans. Convolutional Neural Networks (CNNs)
are a class of deep learning models that excel at image analysis tasks. By leveraging transfer
learning, where pre-trained models are adapted to new tasks, CNNs can effectively extract
relevant features from CT scan images.

These models employ convolutional layers to automatically learn and identify key patterns and
features from the input CT scan images. These extracted features are then fed into dense
networks for further processing and classification.

Ultimately, the output of these deep learning models is a classification decision indicating
whether the given CT scan exhibits signs of pneumonia or not. By leveraging advanced machine
learning techniques, healthcare professionals can improve the accuracy and efficiency of
pneumonia diagnosis, leading to better patient outcomes and more effective management of this
widespread respiratory illness.

v
TABLE OF CONTENTS

S. NO CHAPTER NAME PAGE.NO

1. INTRODUCTION 1

2. LITERATURE SURVEY 2-3

3. EXISTING SYSTEM 4-5

4. PROPOSED SYSTEM 6-8

5. REQUIREMENT ANALYSIS 9-10

6. DESIGN AND METHODOLOGY 11-14

7. IMPLEMENTATION 15-17

8. TESTING 18-20

9. RESULTS AND DISCUSSION 21

10. CONCLUSION 22

11. REFERENCES 23

vi
LIST OF FIGURES

FIG. NO FIGURE NAME PAGE. NO

3.1 Architecture of pneumonia detection from X-rays 04

4.1 Architecture of pneumonia detection from CT scan 06

4.2 Architecture of custom model 08

6.1 Use case diagram 11

6.2 Sequence diagram 12

6.3 Activity diagram 13

6.4 Class diagram 13

7.1 Data preprocessing 15

7.2 Gray scale conversion and image resizing 16

7.3.1 Class distribution diagram before Oversampling 16

and Down sampling

7.3.2 Class distribution diagram after Oversampling 16

and Down sampling

8.1 Accuracy and loss of training and validation of Resnet50V2 18

8.2 Accuracy and loss of training and validation of EfficientNetV2B1 18

8.3 Accuracy and loss of training and validation of custom model 18

8.4 Confusion matrix of custom model 20

8.5 Confusion matrix of Resnet50V2 20

8.6 Confusion matrix of EfficientNetV2B1 20

9.1 Final output of the model 21

vii
LIST OF TABLES

TABLE. NO TABLE NAME PAGE. NO

7.1 Keras application models 17

8.1 Training and validation accuracy of various CNN models 18

viii
CHAPTER-1
INTRODUCTION

Pneumonia, a prevalent respiratory infection, poses a significant threat to public health,


particularly in densely populated and contaminated areas. Characterized by inflammation and
congestion in the lungs, pneumonia obstructs normal breathing patterns, often leading to severe
respiratory distress. In contemporary healthcare, the diagnosis of pneumonia typically relies on
imaging techniques such as X-rays and CT scans. While X-rays offer a conventional means of
detection, providing fundamental insights into pneumonia, CT scans deliver more intricate and
detailed assessments, enhancing diagnostic accuracy despite limited radiation exposure.

In recent years, the advent of Deep Learning has revolutionized medical diagnostics,
particularly in the realm of pneumonia detection. Leveraging Convolutional Neural Networks
(CNNs) and transfer learning techniques, researchers have developed robust predictive models
capable of analyzing CT scans with unprecedented efficiency. These models operate by
extracting salient features from CT images through convolutional layers, subsequently
employing dense networks for classification. The primary objective of these models is to
discern whether a given CT scan indicates the presence of pneumonia or not, thereby
facilitating prompt and accurate diagnosis.

In this context, this paper aims to explore the application of Deep Learning methodologies in
pneumonia detection from CT scans. Through the utilization of CNNs and transfer learning,
we endeavour to construct predictive models that exhibit superior performance in
distinguishing pneumonia-affected CT scans from healthy ones. By harnessing the power of
advanced computational techniques, we aspire to contribute to the advancement of medical
diagnostics, ultimately improving patient outcomes and mitigating the burden of pneumonia
on global healthcare systems.

1
CHAPTER-2

LITERATURE SURVEY

Pneumonia detection using chest X-ray images has been a subject of extensive research in
recent years, driven by the need for accurate and efficient diagnostic tools to combat this
prevalent respiratory infection. The literature survey on this topic encompasses various studies
focusing on different aspects of pneumonia detection, including image analysis techniques,
deep learning models, and ensemble methods. Some of key findings and approaches in the
existing literature are:

2.1. Key findings:

2.1.1. Image Analysis Techniques:

• Traditional image processing techniques have been utilized for pneumonia detection in
chest X-ray images, including thresholding, edge detection, and texture analysis.
However, these methods often lack robustness and may struggle to handle the
complexities and variations present in medical images.

2.1.2. Deep Learning Models:

• Deep learning models, particularly convolutional neural networks (CNNs), have


emerged as powerful tools for pneumonia detection. Studies have demonstrated the
effectiveness of CNNs in automatically extracting relevant features from chest X-ray
images and accurately classifying pneumonia cases.
• Popular CNN architectures such as GoogLeNet, ResNet, and DenseNet have been
widely used in pneumonia detection tasks. These models offer strong performance and
scalability, making them suitable for real-world applications.

2.1.3. Transfer Learning:

• Transfer learning has been extensively employed to address the challenge of limited
training data in medical image analysis tasks. Pre-trained CNN models trained on large-

2
scale image datasets (e.g., ImageNet) are fine-tuned on pneumonia-specific datasets to
leverage learned features and improve model generalization.

2.1.4. Ensemble Methods:

• Ensemble methods combine predictions from multiple base models to achieve superior
performance compared to individual models. Studies have explored various ensemble
techniques, including simple averaging, weighted averaging, and stacking, to enhance
pneumonia detection accuracy.
• Weighted averaging, where the weights assigned to base models are determined based
on their performance, has shown promise in improving ensemble performance and
robustness.

2.1.5. Evaluation Metrics:

• Evaluation metrics commonly used in pneumonia detection studies include accuracy,


precision, recall (sensitivity). These metrics provide comprehensive assessments of
model performance, considering both true positive and false positive rates.

Overall, the literature survey highlights the advancements in pneumonia detection using chest
X-ray images, with deep learning and ensemble techniques emerging as prominent approaches.
The proposed method by Rohit KunduI, Ritacheta DasI, Zong Woo GeemI, Gi-Tae HanI, Ram Sarkar
contributes to this body of research by introducing a novel ensemble approach with improved
performance and robustness, as demonstrated through extensive experimentation and
evaluation on publicly available datasets.

3
CHAPTER-3

EXISTING SYSTEM
(Pneumonia Detection from X-rays)

In this system, they developed a computer-aided diagnosis system for automatic pneumonia
detection using chest X-ray images. They employed deep transfer learning to handle the
scarcity of available data and designed an ensemble of three convolutional neural network
models: GoogLeNet, ResNet-18, and DenseNet-121. A weighted average ensemble technique
was adopted, where in the weights assigned to the base learners were determined using a novel
approach.

The scores of four standard evaluation metrics, precision, recall, f1-score, and the area under
the curve, are fused to form the weight vector, which in studies in the literature was frequently
set experimentally, a method that is prone to error. The existing approach was evaluated on two
publicly available pneumonia X-ray datasets, provided by Kermany et al. and the Radiological
Society of North America (RSNA), respectively, using a five-fold cross-validation scheme. The
existing system achieved accuracy rates of 98.81% and 86.85% and sensitivity rates of 98.80%
and 87.02% on the Kermany and RSNA datasets, respectively.

Fig. 3.1 Architecture of pneumonia detection from X-rays

4
3.1. Advantages:

• Availability of Dataset: X-ray datasets are more widely available compared to datasets
obtained from other imaging modalities such as CT scans or MRI. This availability
stems from the routine use of X-rays in clinical practice for diagnosing various thoracic
conditions, including pneumonia Monitoring Progress: X-rays can be used to monitor
the progression of pneumonia and assess the effectiveness of treatment over time.
• Limited Radiation Exposure: X-rays involve lower radiation exposure compared to
other imaging techniques like CT scans. This reduced radiation makes X-rays safer,
especially for vulnerable populations such as children and pregnant women. Since
pneumonia is a condition that may require frequent monitoring and follow-up imaging,
using X-rays mitigates concerns regarding cumulative radiation exposure over multiple
scans.
• Cost-effectiveness: X-ray imaging is generally more cost-effective compared to other
modalities such as CT scans or MRI. This affordability makes X-rays accessible in
various healthcare settings, including resource-constrained environments where
advanced imaging modalities may not be readily available.

3.2. Disadvantages:

• Limited Sensitivity and Specificity: While X-rays can detect structural abnormalities
in the lungs, they may lack sensitivity and specificity in distinguishing between
different types of pulmonary conditions. This can lead to false positives or false
negatives in pneumonia diagnosis, potentially resulting in misdiagnosis or delayed
treatment.
• Radiation Exposure: X-ray imaging involves exposure to ionizing radiation, albeit at
relatively low levels. While the risk of radiation-induced harm from a single X-ray is
minimal, repeated exposure over time may increase the cumulative risk, particularly in
vulnerable populations such as children and pregnant women.
• False Positives and Negatives: Like any diagnostic tool, chest X-rays are not infallible.
False positives (indicating pneumonia when it is not present) and false negatives
(missing pneumonia when it is present) can occur. This highlights the importance of
considering clinical symptoms and other diagnostic information.

5
CHAPTER-4

PROPOSED SYSTEM
(Pneumonia Detection from CT scan)

4.1. Problem Statement:

Building a web application that takes CT scan images of lungs as input and predicts whether
pneumonia is present or not.

4.2. Objective:
To overcome the limitations of the existing system, in this study, we developed a computer-
aided diagnosis system for automatic pneumonia detection using CT scan images, we employed
deep transfer learning to handle the scarcity of available data and designed an ensemble of
three convolutional neural network models: EfficientNetV2B1, InceptionV3, VGG16,
DenseNet121, ResNet50V2, MobileNetV2, Custom Model.

Fig. 4.1 Architecture of pneumonia detection from CT scan

The proposed model has taken the three CNN models that have higher accuracy than the
remaining CNN models and applied bagging technique for those three CNN models.
The proposed approach was evaluated on publicly available pneumonia CT scan dataset,
provided by Kaggle, because the availability of datasets is limited as the medical data of the
patients are not disclosed due to security reasons.

4.3. Models:

4.3.1 EfficientNetV2B1:
• EfficientNetV2 is an extension of the EfficientNet architecture, designed to achieve
improved performance with fewer parameters and computational resources.

6
• It introduces a compound scaling method that uniformly scales network width, depth,
and resolution with a set of fixed scaling coefficients.

4.3.2. InceptionV3:

• InceptionV3 is a deep convolutional neural network architecture developed by Google.

• It is known for its Inception modules, which consist of multiple parallel convolutional
branches with different filter sizes.

• InceptionV3 utilizes deep convolutional neural networks with inception modules to


efficiently extract features from images for tasks such as image classification and object
detection.

4.3.3. VGG16:

• VGG16 is a convolutional neural network architecture developed by the Visual


Geometry Group (VGG) at the University of Oxford.
• It consists of 16 layers with a simple and uniform architecture, comprising multiple
convolutional layers followed by max-pooling layers and fully connected layers.

4.3.4. DenseNet121:

• DenseNet (Densely Connected Convolutional Networks) is a neural network


architecture proposed by researchers at Facebook AI Research.
• DenseNet121 is a specific variant with 121 layers, characterized by dense connectivity
patterns between layers.
• In DenseNet, each layer receives feature maps from all preceding layers as input,
promoting feature reuse and alleviating the vanishing gradient problem.

4.3.5. ResNet50V2:

• ResNet (Residual Neural Network) is a deep learning architecture introduced by


Microsoft Research.
• ResNet50V2 is a variant with 50 layers, incorporating residual connections that enable
the training of very deep neural networks.
• Residual connections facilitate the flow of gradients during training, mitigating the
degradation problem associated with training deep networks.

7
4.3.6. MobileNetV2:

• MobileNetV2 is a convolutional neural network architecture optimized for mobile and


embedded devices, utilizing depth wise separable convolutions and inverted residuals
to achieve high efficiency and accuracy in image classification tasks.
• It employs depth wise separable convolutions and linear bottlenecks to reduce the
computational cost while maintaining accuracy.

4.3.7. Custom Model:

This custom model is a convolutional neural network


(CNN) designed for binary image classification. Here's a
brief summary of its architecture:

• Input Rescaling: The input images are rescaled


so that the pixel values range from 0 to 1.
• Convolutional Layers: The model consists of
three convolutional layers, each followed by a
rectified linear unit (ReLU) activation function.
These layers use a 3x3 kernel to extract features
from the input images.
• Max Pooling Layers: After each convolutional
layer, a max-pooling layer is applied to reduce the
spatial dimensions of the feature maps and
capture the most important information.
Fig. 4.2. Architecture of custom model
• Flatten Layer: The flattened layer is used to convert the 2D feature maps into a 1D
vector, which can be fed into a fully connected neural network.
• Fully Connected Layers: There are two dense (fully connected) layers in the model.
The first dense layer consists of 128 neurons with ReLU activation, allowing the model
to learn complex patterns from the flattened feature maps. The second dense layer has
a single neuron with a sigmoid activation function, which produces the final binary
classification output.
• Compilation: The model is compiled using the Adam optimizer and binary cross-
entropy loss function. It is optimized to classify binary labels, and accuracy is used as
the evaluation metric.

8
CHAPTER-5

REQUIREMENT ANALYSIS

5.1. FUNCTIONAL REQUIREMENTS:

• Input Data Compatibility: The system should be capable of accepting CT scan images
in standard formats such as DICOM (Digital Imaging and Communications in
Medicine) or other common image formats.

• Preprocessing: Preprocessing steps such as resizing, normalization, and data


augmentation should be applied to the input CT scan images to prepare them for feature
extraction.

• Feature Extraction: The system should employ convolutional neural network (CNN)
models for feature extraction from CT scan images. Transfer learning techniques should
be used to leverage pre-trained models for better performance.

• Classification: Extracted features should be fed into dense neural networks for
classification, distinguishing between pneumonia-affected and unaffected CT scans.

• Model Evaluation: The system should evaluate the performance of trained CNN
models using appropriate metrics such as accuracy, precision, recall, and F1 score to
assess their effectiveness in pneumonia detection.

• Real-time Processing: The system should be capable of processing CT scan images in


real-time to provide timely diagnosis and treatment recommendations.

• Scalability: The system should be scalable to accommodate a large volume of CT scan


images and support concurrent processing to meet the demands of healthcare facilities.

9
5.2. NON-FUNCTIONAL REQUIREMENTS:

• Accuracy: The system should achieve a high level of accuracy in pneumonia detection
to minimize false positives and false negatives, ensuring reliable diagnosis.

• Performance: The system should be efficient in terms of computational resources and


processing time, providing timely results to healthcare professionals.

• Security: The system should adhere to strict security standards to protect patient data
and ensure confidentiality, integrity, and availability.

• Usability: The system should have an intuitive user interface that is easy to navigate,
facilitating seamless interaction for healthcare professionals.

• Robustness: The system should be resilient to variations in input data quality, noise,
and artifacts commonly encountered in medical imaging.

• Compliance: The system should comply with relevant regulations and standards for
medical devices and software, ensuring legal and ethical compliance in healthcare
settings.

• Interoperability: The system should be compatible with existing healthcare


information systems and interoperable with other medical imaging tools and devices.

• Maintainability: The system should be designed with modularity and extensibility in


mind, allowing for easy maintenance, updates, and integration of new features or
improvements.

10
CHAPTER-6

DESIGN AND METHODOLOGY

6.1. UML DIAGRAMS:

Unified Modeling Language (UML):

• UML diagrams are visual representations used to design and model software systems.
• They are standardized diagrams used in software engineering to communicate design
decisions and system architecture.
• UML diagrams can help developers, stakeholders, and team members understand the
structure and behaviour of a system before it is implemented.

6.1.1 Use case diagram:

Use case diagrams to illustrate the interactions between users (actors) and a system to
accomplish specific tasks or goals. They help to identify and define the functional requirements
of a system from the user's perspective.

Fig. 6.1. Use case diagram

11
6.1.2. Sequence diagram:

Sequence diagrams visualize the interactions between objects in a particular scenario or use
case. They show the sequence of messages exchanged between objects over time, helping to
understand the dynamic behaviour of the system.

Fig. 6.2. Sequence diagram

6.1.3. Activity diagram:

Activity diagrams represent the flow of control within a system, showing the sequence of
activities and decision points. They are useful for modeling business processes, workflow, and
the logic of complex operations.

12
Fig. 6.3. Activity diagram

6.1.4. Class diagram:

Class diagrams depict the static structure of a system by showing classes, their attributes,
methods, and relationships between classes. They provide a blueprint for the implementation
of the system's objects and their interactions.

Fig. 6.4. Class diagram

13
6.2. Methodology:

• Data Collection: Gather a dataset of CT scans containing both pneumonia-positive and


pneumonia-negative cases.

• Data Preprocessing: Preprocess the CT scan images, including resizing,


normalization, and augmentation techniques to improve model generalization.

• Transfer Learning: Utilize pre-trained CNN models such as MobileNetV2 or


ResNet50 as feature extractors. Fine-tune these models on the pneumonia dataset to
adapt them to the specific task.

• Model Architecture: Design the CNN architecture, comprising convolutional layers


for feature extraction and dense layers for classification. Incorporate techniques such
as dropout and batch normalization to prevent overfitting.

• Training: Train the CNN models on the preprocessed CT scan dataset using supervised
learning. Use techniques like cross-validation and hyperparameter tuning to optimize
model performance.

• Evaluation: Evaluate the trained models using metrics such as accuracy, precision,
recall, and F1-score on a separate test set. Perform error analysis to identify areas for
improvement.

• Deployment: Deploy the trained models in a clinical setting for pneumonia detection
from CT scans. Ensure seamless integration with existing healthcare systems and
compliance with regulatory standards.

• Monitoring and Maintenance: Continuously monitor the performance of deployed


models and update them as needed based on new data and advancements in deep
learning techniques.

14
CHAPTER-7

IMPLEMENTATION

7.1. DATA PREPROCESSING:

Fig. 7.1. Data preprocessing

7.1.1. Data Collection and Cleaning:


• The CT Scan dataset is collected from the Kaggle.
src: https://www.kaggle.com/datasets/anaselmasry/covid19normalpneumonia-ct-
images?select=COVID2_CT
• The dataset has around 8 thousand images belong to 3 classes.
• Then we cleaned the data by removing images with unnecessary labels.

7.1.2. Gray Scale Conversion and Image resizing:

• Then the 3-channel RGB images are converted to Gray Scale using cv2.
• After, the images are resized to 160,160 for transfer learning models.
• Original Images are in 512,512 and resized the images to 180,180 for custom model.

15
• (180,180,1) for
custom model
(512, 512, 3) to
• (160, 160, 1) for
transfer learning
models

Fig 7.2. Gray scale conversion and image resizing

7.1.3. Balancing:
As the data set is biased, we balanced the dataset by performing data augmentation on lower
samples class (Normal CT’s) and under sampling techniques on higher samples class
(Pneumonic CT’s)

Fig. 7.3.1 Class distribution diagram Fig. 7.3.2 Class distribution diagram
Before Oversampling and Down sampling After Oversampling and Down sampling

7.1.4. Label Encoding and Normalization:

• The images are labelled as Normal_CT and Penumonia_CT.


• These values are converted to 0 and 1 using sklearn label encoder.
• Normalization rescales the images to from 0-255 to 0 to 1 for better computational
efficiency.

7.1.5. Splitting of Dataset:

• The dataset is split to 4:1 ratio 80% data for training and 20% for validation.

16
• The test set is stored in separate directory with around 10% of train set.

7.2. Training the models:

Out of the all keras transfer learning models we have selected the 6 models with best accuracy
and reasonable no of parameters.

Out of all the 27 models we have selected:

1. ResNet50v2
2. EfficientNetV2B1
3. VGG16
4. Densenet121
5. MobileNetv2
6. Inception V3

Table. 7.1. Keras Transfer Learning models

17
CHAPTER-8

TESTING

8.1. Evaluation on validation sets:

While training the model we have used 20% data from training set as validation to check the
model’s performance on unseen data.

Out of the seven modes Custom Model, ResNet50V2, EfficientNetV2B1 performed with
better accuracy.

Table 8.1. Training and validation accuracy of various CNN methods

8.1.1. Resnet50V2:

On model training the performance of the model on training (96%) and validation sets (98%).

Fig.8.1. Accuracy and loss of training and validation of Resnet50V2

18
8.1.2. EfficientNetV2B1:

the performance of EfficientNet model on training (97.41%) and on validation set (99%).

Fig.8.2. Accuracy and loss of training and validation of EfficientNetV2B1

8.1.3. Custom model:

The custom model gave top performance with 99.3% training accuracy and 99.4% on
validation set.

Fig.8.3. Accuracy and loss of training and validation of Custom model

19
8.2. Model evaluation:

8.2.1 Custom model:

Accuracy : 100.0
Precision : 100.0
Recall : 100.0

Fig.8.4. Confusion matrix of custom model

8.2.2. ResNet50V2:

Accuracy : 98.89
Precision : 97.5
Recall : 100.0

Fig.8.5. Confusion matrix of Resnet50V2

8.2.3. EfficientNetV2B1:

Accuracy : 94.44
Precision : 100.0
Recall : 87.18

Fig.8.6. Confusion matrix of EfficientNetV2B1

20
CHAPTER-9

RESULTS AND DISCUSSION

The user is provided with Interface to upload the CT Scan image of the lung to see the results.
The Interface is built using the Streamlit a popular python library used to build the web apps
for machine learning and deep learning applications. After the image of scan being uploaded
by the user the image will be passed to the three models Resnet, EfficientNet and Custom
model. The outputs generated by each of the models will be averaged for more robust prediction
of the disease.

Fig. 9.1. Final output of the model

21
CHAPTER-10

CONCLUSION

Early detection of pneumonia is crucial for determining the appropriate treatment of the disease
and preventing it from threatening the patient’s life. Chest CT scans are becoming the most
widely used tool for diagnosing pneumonia; however, they are subject to inter-class variability
and the diagnosis depends on the clinicians’ expertise in detecting early pneumonia traces. To
assist medical practitioners, an automated CAD system was developed in this study, which uses
deep transfer learning-based classification to classify CT scan images into two classes
“Pneumonia” and “Normal.” An ensemble framework was developed that considers the
decision scores obtained from seven CNN models, EfficientNetV2B1, InceptionV3, VGG16,
DenseNet121, ResNet50V2, MobileNetV2, Custom Model, to form a weighted average
ensemble. The weights assigned to the classifiers were calculated using a novel strategy
wherein four evaluation metrics, precision, recall, f1-score, and AUC, were fused using the
hyperbolic tangent function. The framework, evaluated on publicly available pneumonia CT
scan dataset, obtained an accuracy rate of 98.81%, a sensitivity rate of 98.80%, a precision rate
of 98.82%. Furthermore, the proposed ensemble model is domain-independent and thus can be
applied to a large variety of computer vision tasks.

However, as previously mentioned, in some instances the ensemble framework failed to


produce correct predictions. In the future, we may investigate techniques such as contrast
enhancement of the images or other pre-processing steps to improve the image quality. We may
also consider using segmentation of the lung image before classification to enable the CNN
models to achieve improved feature extraction. Furthermore, because three CNN models are
required to train the proposed ensemble, the computation cost is higher than that of the CNN
baselines developed in studies in the literature. In the future, we may attempt to reduce the
computational requirements by employing methods such as snapshot ensembling.

22
CHAPTER-11

REFERENCES

• Rohit Kundu, Ritacheta Das, Zong Woo Geem, Gi-Tae Han, Ram Sarkar. “Pneumonia
detection in chest X-ray images using an ensemble of deep learning models”, PLOS
ONE, September 7, 2021.
• Daniel Joseph Alapat, Malavika Venu Menon, Sharmila Ashok. “Detection of
Pneumonia in Chest X-ray Images Using Neural Networks”, National center for
biometric information, December 1,2022.
• Shagun Sharma, Kalpna Guleria. “A Deep Learning based model for the Detection of
Pneumonia form Chest X-Ray Images using VGG-16 and Neural Networks”, Science
Direct, January 31, 2023.

23

You might also like