0% found this document useful (0 votes)
15 views51 pages

Deep Learning for Malaria Detection

The document discusses the use of deep learning for malaria detection, highlighting the disease's significant public health impact and the limitations of traditional diagnostic methods. It outlines a proposed framework utilizing convolutional neural networks (CNNs) for automated detection of malaria in blood images, emphasizing the need for large datasets and regulatory considerations. The document also reviews existing literature on the application of deep learning in malaria detection, showcasing various methodologies and their respective advantages and limitations.

Uploaded by

prathiksanju18
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views51 pages

Deep Learning for Malaria Detection

The document discusses the use of deep learning for malaria detection, highlighting the disease's significant public health impact and the limitations of traditional diagnostic methods. It outlines a proposed framework utilizing convolutional neural networks (CNNs) for automated detection of malaria in blood images, emphasizing the need for large datasets and regulatory considerations. The document also reviews existing literature on the application of deep learning in malaria detection, showcasing various methodologies and their respective advantages and limitations.

Uploaded by

prathiksanju18
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Detection of Malaria using Deep Learning

CHAPTER-1

INTRODUCTION

1.1Overview

In 2015, the World Health Organization (WHO) reported that around 438 thousand
people died due to malaria parasites, and 620 thousand people died in 2017, and
approximately 300-500 million people were affected by this disease yearly. South-East
Asia, the Eastern Mediterranean, the Western Pacific, and the Americas have all been
recognized as high-risk regions by the WHO. Malaria is a dangerous and deadly disease
that is triggered from the bite of female anopheles mosquitoes that host plasmodium
parasites. There are around 400 types of anopheles; among them, 30 types mainly act as
parasite carrieres. To be a parasite carrier, the female anopheles mosquito has to bite a
malaria-infected person. The life cycle of the anopheles mosquito consists of four stages:
egg, larva, pupa, and adult. To bring the eggs into the adult stage, they have to feed on
human blood. In this feeding process, malaria spreads all around. There are five
Plasmodium parasite species, including Plasmodium falciparum, P. vivax, P. ovale, P.
malariae, and P. knowlesi. Among them, P. falciparum and P. vivax are the most
dangerous. It takes 10 to 15 days or even more to remain in hibernation after a carrier
mosquito bite. After the hibernation period, it seizures the red blood cells (RBC) and
reduces the number of RBC, revealing different indications of malaria, such as fever,
chills, nausea, and vomiting. Malaria should be diagnosed as soon as possible because it
can rapidly turn into a severe stage and is life-threatening. It cannot be passed from one
person to another, however malaria can be transmitted from mother to fetus, contracted
through blood transfusions or sharing injections. This disease can be spread in hot, humid
climates near natural water sources where Anopheles mosquitoes transmit deadly
diseases.

Malaria is a critical public health challenge, particularly in tropical and subtropical


regions. It is caused by Plasmodium parasites, transmitted to humans through the bites of
infected female Anopheles mosquitoes. Early detection and treatment are vital in
controlling the disease and preventing severe complications or fatalities. Conventional
diagnostic methods include microscopic examination of stained blood smears and rapid
diagnostic tests (RDTs). However, these approaches have limitations, such as dependence
on skilled personnel, time-intensive procedures, and variability in diagnostic accuracy.

Dept. of Computer Science and Engineering Page | 1


Detection of Malaria using Deep Learning

The advent of artificial intelligence (AI), specifically deep learning, offers promising
solutions to these challenges. Deep learning, a subset of machine learning, employs
artificial neural networks to automatically learn and identify complex patterns in data.
This technology has gained significant attention for its ability to analyze medical images
and improve diagnostic precision. In the context of malaria, deep learning models can be
trained to detect infected red blood cells from microscopic images, enabling automated,
rapid, and reliable diagnosis.
Deep learning-based systems offer several advantages. They reduce the reliance on
skilled technicians, minimize human error, and enable rapid processing of large volumes
of data. Additionally, these systems can be deployed in resource-constrained
environments using mobile or cloud-based platforms, enhancing accessibility and
scalability.
Despite their potential, challenges remain in implementing deep learning for malaria
detection. These include the need for large, diverse, and annotated datasets, addressing
class imbalance in datasets, and ensuring model robustness across varied imaging
conditions. Furthermore, the integration of AI-driven tools into existing healthcare
systems requires regulatory approval, user training, and ongoing maintenance.
In conclusion, deep learning has emerged as a transformative tool in the detection of
malaria. By automating and enhancing diagnostic accuracy, it holds the promise of
improving disease management and outcomes, particularly in endemic regions. Continued
research and collaboration between AI specialists, healthcare professionals, and
policymakers will be crucial to realizing the full potential of this technology in combating
malaria.
Role of Deep Learning
Deep learning, a subset of artificial intelligence (AI), offers a powerful approach to
address these challenges. By leveraging neural networks capable of automatically
identifying patterns in complex datasets, deep learning has demonstrated remarkable
success in medical imaging tasks. Its application in malaria detection involves analyzing
microscopic images of blood smears to identify infected cells, offering a potential
solution to overcome the limitations of traditional methods.
Proposed Solution Framework

Dept. of Computer Science and Engineering Page | 2


Detection of Malaria using Deep Learning
Data Collection and Preprocessing: Large datasets of stained blood smear images, both
infected and healthy, are collected. Preprocessing techniques like normalization and
augmentation ensure the robustness and generalizability of the model.
Model Development: Deep learning models, particularly convolutional neural networks
(CNNs), are designed to automatically learn distinguishing features from the images.
These models aim to classify cells as infected or healthy with high accuracy.
Validation and Deployment: After training, the model is rigorously validated using
metrics such as sensitivity, specificity, and overall accuracy. Successful models are
integrated into diagnostic workflows or deployed as standalone tools in clinical or remote
settings.
1.2Problem Statement

Malaria remains a major public health concern, affecting millions of people annually,
particularly in tropical and subtropical regions. It is caused by Plasmodium parasites
transmitted through the bites of infected female Anopheles mosquitoes. Timely and
accurate detection of malaria is essential for effective treatment and management of the
disease.

1.3Objectives

• To implement automated detection of malaria from blood images.

• To improve the accuracy in classification using CNN model.

• To detect the infected area in blood images we are using the water-shed image
segmentation techniques.

• To reduce training time in malaria classification

1.4Scope:

• This can be a valuable tool in the fight against malaria, as it can help to rapidly
and accurately diagnose cases, allowing for timely treatment and help to prevent
the spread of the disease.

• In this project, images are good enough. The effectiveness of this framework with
low quality is excluded from the scope of this project.

Dept. of Computer Science and Engineering Page | 3


Detection of Malaria using Deep Learning

CHAPTER-2

2 LITERATURE SURVEY

A literature survey or a literature review in a project report shows the various


analyses and research made in the field of interest and the results already published,
taking into account the various parameters of the project and the extent of the project.
Literature survey is mainly carried out in order to analyze the background of the current
project which helps to find out flaws in the existing system & guides on which unsolved
problems we can work out. So, the following topics not only illustrate the background of
the project but also uncover the problems and flaws which motivated to propose solutions
and work on this project.

A literature survey is a text of a scholarly paper, which includes the current


knowledge including substantive findings, as well as theoretical and methodological
contributions to a particular topic. Literature reviews use secondary sources, and do not
report new or original experimental work. Most often associated with academic-oriented
literature, such as a thesis, dissertation or a peer-reviewed journal article, a literature
review usually precedes the methodology and results sectional though this is not always
the case. Literature reviews are also common in are search proposal or prospectus (the
document that is approved before a student formally begins a dissertation or thesis). Its
main goals are to situate the current study within the body of literature and to provide
context for the particular reader. Literature reviews are a basis for researching nearly
every academic field. demic field. A literature survey includes the following:

• Existing theories about the topic which are accepted universally.


• Books written on the topic, both generic and specific.
• Research done in the field usually in the order of oldest to latest.
• Challenges being faced and on-going work, if available.

Literature survey describes about the existing work on the given project. It deals with
the problem associated with the existing system and also gives user a clear knowledge on

Dept. of Computer Science and Engineering Page | 4


Detection of Malaria using Deep Learning
how to deal with the existing problems and how to provide solution to the existing
problems.

2.1Objectives of Literature Survey


• Learning the definitions of the concepts.
• Access to latest approaches, methods and theories.
• Discovering research topics based on the existing research
• Concentrate on your own field of expertise– Even if another field uses the same
words, they usually mean completely.
• It improves the quality of the literature survey to exclude sidetracks– Remember
to explicate what is excluded.

Before building our application, the following system is taken into consideration:

S.N TITLE,AUTHOR METHODOLOG ADVANTAGE LIMITATION


O & YEAR Y USED S

1 Title: Developing an The SEIRS model The model It will work only for
agent-based model for represented the text data it is not
simulating the spread of malaria suitable for image
dynamic spread of by simulating the data.
plasmodium vivax interaction among
malaria Anopheles
mosquitoes,
Author: N. M.
humans, and the
Gharakhanlou, M. S.
environment. In the
Mesgari, and N.
model, the
Hooshangi
probability of
Year:2019 malaria

2 Title: Wearables IOT with 2B-Healthy Our findings • It is not support


Detect Malaria Early algorithm demonstrate the for predicting
in a Controlled feasibility of on blood cell
Human-Infection wearables as a images.
Study screening tool to • It is expensive
provide early for
Author: Sidhartha
warning of implementation
Chaudhury; Chenggan

Dept. of Computer Science and Engineering Page | 5


Detection of Malaria using Deep Learning
g Yu; Ruifeng infection and
Liu; Kamal support further
Kumar; Samantha research on the use
Hornby of the 2B-Healthy
algorithm as the
Year: 2021
basis for a
wearable infection-
detection platform.

3 Title: Application of Logistic regression, The study shows • It will work


machine learning decision trees classifier, that logistic only for text
models to predict support vector machine, regression data it is not
malaria using malaria and random forest performs better, suitable for
cases and classifier to predict with 83% accuracy, image data.
environmental risk malaria 82% precision and
• It is not
factors 90% F1-score than
support for
other machine
Author: Elliot predicting on
learning classifiers
Mbunge; Richard C blood cell
when predicting
Millham; Maureen images.
malaria outbreaks
Nokuthula
using
Sibiya; Sam
environmental risk
Takavarasha
factors.
Year: 2022

4 Title: Machine neural networks (NNs), Extensive • It will work


Learning Classifiers logistic regression experiments only for text
for Symptom-Based (LR), support vector conducted show data it is not
Malaria Prediction machines (SVMs) and that the two NN suitable for
k-nearest neighbors. classifiers slightly image data.
Author: Yulianti
outperform the
Paula Bria; Chung- • It is not support
other classifiers.
Hsing Yeh; Susan for predicting
Bedingfield on blood cell
images.
Year:2022

Dept. of Computer Science and Engineering Page | 6


Detection of Malaria using Deep Learning
5 Title: Leveraging neural network model This can help to • It is not support
Neural Networks in decide where to use for predicting
Malaria Control limited resources, on blood cell
like vaccines or images.
Author: Joseph
insecticides, for the
Livesey; Dominik • It is expensive
largest possible
Wojtczak for
impact in malaria
implementation
Year: 2021 control.

6 Title: Malaria Parasite Convolution Neural The proposed CNN • Its accuracy is
Classification using Network (CNN) setup-1 with kernel less.
Deep Convolutional models size 3 x 3 and pool
• It consumes
Neural Network size of 2 x 2
more training
achieved an
Author: Abhik time.
accuracy of 96%.
Paul; Rubul Kumar
Bania

Year: 2021

7 Title: Deep Learning The customized CNN CNN model in • Accuracy is less
for Smartphone-Based discriminating than 95%.
Malaria Parasite between positive
• No
Detection in Thick (parasitic) and
recommendatio
Blood Smears negative image
n of medicine.
patches in terms of
Author: Feng
the following • It will not able
Yang; Mahdieh
performance to detect the
Poostchi; Hang
indicators: types.
Yu; Zhou
accuracy (93.46%
Zhou; Kamolrat
± 0.32%).
Silamut

Year:2020

8 Title: Deep Learning The custom deep In this paper, we • No


for Real-Time Malaria learning architecture propose a novel recommendatio
Parasite Detection and (YOLO-mp) is approach to n of medicine.
Counting Using developed based on the improve the
• It will not able
YOLO-mp design criteria of performance of
to detect the
optimizing accuracy deep learning
Author: Anand types.
and speed of detection models through
Koirala; Meena
with minimal resources consistent labelling
Jha; Srinivas
of ground truth

Dept. of Computer Science and Engineering Page | 7


Detection of Malaria using Deep Learning
Bodapati; Animesh bounding box for
Mishra; Girija Chetty the task of
pathogen detection
Year: 2021
on microscope
images of thick
blood smears

9 Title: Unsupervised Artificial neural The proposed CAD • Its accuracy is


Deep Learning CAD network followed by scheme has been less.
Scheme for the sparse stacked evaluated using
• It consumes
Detection of Malaria autoencoder. malaria blood
more training
in Blood Smear smear image data
time.
Microscopic Images set, achieving a
detection accuracy • No
Author: Priyadarshini
of 89.10%, a recommendatio
Adyasha
sensitivity of n of medicine.
Pattanaik; Mohit
93.90% and
Mittal; Mohammad • It will not able
specificity of
Zubair Khan to detect the
83.10%.
types.
Year: 2020

2.2Related Works

Several research efforts have been directed towards leveraging deep learning, particularly
Convolutional Neural Networks (CNNs), for the detection of malaria in microscopic
blood smear images. The following are significant contributions in this field:
EfficientNet-Based Detection
Research published in Scientific Reports utilized the EfficientNet deep learning
architecture for malaria detection. This approach demonstrated high accuracy in
identifying malaria-infected red blood cells while optimizing computational efficiency,
making it suitable for deployment in resource-constrained settings.
CNN for Classification of Blood Smears
A study available on arXiv explored a CNN-based model to classify microscopic images
into parasitized and uninfected categories. The research highlighted the adaptability of the
model to various devices, emphasizing its potential for use in remote and low-resource
environments.
Analysis of Deep Learning Algorithms

Dept. of Computer Science and Engineering Page | 8


Detection of Malaria using Deep Learning
An article in Sensors introduced a novel CNN architecture achieving an accuracy of
99.68% in malaria detection. This research underscored the performance advantages of
deep learning models over traditional diagnostic techniques in terms of accuracy, speed,
and scalability.
Deep Learning for Automated Malaria Diagnosis
A study from IEEE Xplore presented a deep learning model trained on microscopic
images, focusing on advanced image classification techniques to enhance diagnostic
precision. The research emphasized practical deployment challenges, including model
generalization and data variability.
Explainable AI for Malaria Detection
Research in Scientific Reports delved into the interpretability of deep learning models for
malaria detection, ensuring that decision-making processes in automated systems align
with clinical expectations and standards
Mobile-Based Malaria Diagnosis
A study in Computers in Biology and Medicine developed a CNN model optimized for mobile
devices, enabling malaria diagnosis in remote areas with minimal computational resources. The
model showed high accuracy in real-time diagnostic scenarios.
ResNet for Malaria Detection
Research from PLoS ONE explored the use of ResNet architectures for malaria detection,
highlighting their deep feature extraction capabilities and superior performance on complex
datasets.
Hybrid Deep Learning Approaches
A paper in Biomedical Signal Processing and Control combined CNNs with traditional machine
learning techniques to improve the accuracy and robustness of malaria detection models,
especially on imbalanced datasets.
Dataset Augmentation for Improved Accuracy
A study published in Applied Sciences focused on data augmentation techniques to enhance
model generalization. It demonstrated improved results on CNN-based malaria detection systems
trained on augmented blood smear datasets.
Malaria Detection Using Transfer Learning
Research in Journal of Medical Systems employed transfer learning techniques with pre-trained
models like VGG16 and InceptionV3, reducing the need for large annotated datasets while
maintaining high diagnostic accuracy.
Edge Computing for Malaria Diagnosis

Dept. of Computer Science and Engineering Page | 9


Detection of Malaria using Deep Learning
A study in IEEE Access proposed an edge-computing framework for malaria detection using
lightweight CNN models, addressing latency issues in cloud-based systems and enhancing real-
time diagnostic capabilities.
Explainable CNNs for Malaria Detection
Research published in Nature Scientific Data focused on making CNN-based malaria detection
interpretable by visualizing feature maps and decision paths, ensuring trustworthiness in clinical
settings.
Integration of AI and Telemedicine
A study in Health Informatics Journal explored integrating AI-driven malaria detection models
with telemedicine platforms to provide remote consultations, improving healthcare delivery in
endemic regions.
Multi-Class Detection Models
Research in Expert Systems with Applications developed multi-class deep learning models
capable of detecting various stages of Plasmodium parasites, enhancing the diagnostic scope
beyond binary classification.
Robustness Against Imaging Variability
A paper in Pattern Recognition Letters addressed the challenge of imaging variability caused by
different microscope types and staining techniques, proposing a domain-adaptation approach for
CNNs to maintain performance across diverse datasets.

CHAPTER-3

Dept. of Computer Science and Engineering Page | 10


Detection of Malaria using Deep Learning

ANALYSIS AND REQUIREMENT

3.1 Existing System

Malaria, as a life-threatening disease, has attracted the curiosity of researchers all


around the world. Malaria was formerly mainly diagnosed in the laboratory, demanding a
massive lot of human knowledge. Automatic systems based on ML, DL have been
utilized by most researchers to detect malaria from RBC images nowadays. In this
section, some of these recent and well-known studies have been described.

3.1.1 Drawbacks

• Rajaraman et al. developed a customized deep CNN model to extract features


from parasitized and uninfected cells images. They have utilized various transfer
learning (TL) algorithms, for instance, AlexNet , VGG-16, ResNet50, Xception,
etc., for the detection of malaria and achieved a high accuracy of 0.959 using
VGG-16.

• Masud et al. proposed leveraging deep CNN for real-time detection of malaria
from RBC images. They developed a custom CNN using cyclical stochastic
gradient descent (SGD) as an optimizer and achieved an accuracy of 97.30%.

• Rosado et al. have used SVM to look at how to identify malaria parasites and
white blood cells using smartphones.

3.2 Proposed system

This project introduces a new architecture of diagnosing malaria parasites. Kaggle


has provided the RBC images. For pre-processing of the cell images, this project used
recognized image processing techniques such as morphological processing and other
processes, Once pre-processing has been done, a lightweight CNN has been designed to
detect of type of malaria.

3.2.1Advantages

• This system helps to detect types of malaria.


• It helps to recommend the treatment for the detected disease

3.3 Requirement Specification

Dept. of Computer Science and Engineering Page | 11


Detection of Malaria using Deep Learning
System Requirement Specification (SRS) is a central report, which frames the
establishment of the product advancement process. It records the necessities of a
framework as well as has a depiction of its significant highlight. An SRS is essentially an
association's seeing (in composing) of a client or potential customer's frame work
necessities and conditions at a specific point in time (generally) before any genuine
configuration or improvement work. It's a two-way protection approach that guarantees
that both the customer and the association comprehend alternate's necessities from that
viewpoint at a given point in time.

The SRS talks about the item however not the venture that created it, consequently
the SRS serves as a premise for later improvement of the completed item. The SRS may
need to be changed, however it does give an establishment to proceed with creation
assessment. In straightforward words, programming necessity determination is the
beginning stage of the product improvement action.

The SRS means deciphering the thoughts in the brains of the customers – the
information, into a formal archive – the yield of the prerequisite stage. Subsequently the
yield of the stage is a situated of formally determined necessities, which ideally are
finished and steady, while the data has none of these properties.

3.3.1 Functional Requirements

This section describes the functional requirements of the system for those
requirements which are expressed in the natural language style.

1. Create a desktop application using tkinter framework which contains user.

2. User should select the dataset.

3. System will read and preprocess the extract features and train the model using
CNN.

4. User should upload input image

5. System will read and preprocess the extract features and predict the type of
malaria using CNN

6. System will recommend the medicine as per the predicted malaria disease.

Dept. of Computer Science and Engineering Page | 12


Detection of Malaria using Deep Learning

3.3.2 Non-Functional Requirements

These are requirements that are not functional in nature, that is, these are constraints
within which the system must work.

 The program must be self-contained so that it can easily be moved from one
Computer to another. It is assumed that network connection will be available on
the computer on which the program resides.

 Capacity, scalability and availability.

The system shall achieve 100 per cent availability at all [Link] system shall be
scalable to support additional clients and volunteers.

 Maintainability.

The system should be optimized for supportability, or ease of maintenance as far as


possible. This may be achieved through the use documentation of coding standards,
naming conventions, class libraries and abstraction.

 Randomness, verifiability and load balancing.

The system should be optimized for supportability, or ease of maintenance as far as


possible. This may be achieved through the use documentation of coding standards,
naming conventions, class libraries and abstraction. It should have randomness to check
the nodes and should be load balanced.

3.3.3 Hardware Requirements

• Processor Type : Intel CoreTM– i5/Ryzen 3

• Speed : 2.4 GHZ

• RAM :8 GB RAM

• Hard disk : 80 GB HDD

Dept. of Computer Science and Engineering Page | 13


Detection of Malaria using Deep Learning

INTEL CORE i5

Intel Core is a brand name that Intel uses for various mid-range to high-end
consumer and business microprocessors. As of 2015 the current line up of Core
processors included the Intel Core i7, Intel Core i5, and Intel Core i3. 5th generation
Intel® Core™ i5 processors empower new innovations like Intel® Real Sense™
technology—bringing you features such as gesture control, 3D capture and edit, and
innovative photo and video capabilities to your devices. Enjoy stunning visuals, built-in
security, and an automatic burst of speed when you need it with Intel® Turbo Boost
Technology 2.0.

[Link] RAM

Fig 3.2 RAM 8 GB

When you load up an application on to your computer it loads into your available
RAM memory. It is very quick type of memory. The more programs you load up, the
more RAM is taken up. At the point where you have loaded up enough apps to take up all
your free available physical RAM, your OS will create a swap-file on your hard drive.
This file is used as a reserve for all additional apps you run.

The trouble with that is that hard drives are a lot slower to read and write from
than RAM memory is. Therefore, your computer will perform much slower at that point.
Although new generation of SSD hard drives are much faster than your traditional
spinning drive, it is still best to have enough RAM available. If you are using Windows
and want to want to know how much RAM you are using up, you can right click on task
bar, then select start "Task Manager" and on the "performance" tab you will see a green
bar indicating "Memory".

Dept. of Computer Science and Engineering Page | 14


Detection of Malaria using Deep Learning

[Link] HARD DISK

Fig 4.3 Hard Disk Drive

A hard disk drive (HDD), hard disk, hard drive or fixed disk is a data storage
device used for storing and retrieving digital information using one or more rigid ("hard")
rapidly rotating disks (platters) coated with magnetic material. The platters are paired
with magnetic heads arranged on a moving actuator arm, which read and write data to the
platter surfaces. Data is accessed in a random-access manner, meaning that individual
blocks of data can be stored or retrieved in any order rather than sequentially.

3.3.4 Software Requirements

• Operating System : Windows 64-bit

• Technology : Python

• IDE : PythonIDLE

• Tools : Anaconda

• Python Version : Python 3.6

[Link] Python:

Python is an interpreted, high-level, general-purpose programming language.


Created by Guido van Rossum and first released in 1991, Python has a design philosophy

Dept. of Computer Science and Engineering Page | 15


Detection of Malaria using Deep Learning
that emphasizes code readability, notably using significant whitespace. It provides
constructs that enable clear programming on both small and large scales. Van Rossum led
the language community until stepping down as leader in July 2018.

Python features a dynamic type system and automatic memory management. It


supports multiple programming paradigms, including object-oriented, imperative,
functional and procedural, and has a large and comprehensive standard library.

Python interpreters are available for many operating systems. CPython, the
reference implementation of Python, is open source software[30] and has a community-
based development model, as do nearly all of Python's other implementations. Python and
CPython are managed by the non-profit Python Software Foundation.

History

Python was conceived in the late 1980s by Guido van Rossum at Centrum
Wiskunde&Informatica (CWI) in the Netherlands as a successor to the ABC language
(itself inspired by SETL, capable of exception handling and interfacing with the Amoeba
operating system. Its implementation began in December 1989. Van Rossum's long
influence on Python is reflected in the title given to him by the Python community:
Benevolent Dictator For Life (BDFL) – a post from which he gave himself permanent
vacation on July 12, 2018.

Python 2.0 was released on 16 October 2000 with many major new features,
including a cycle-detecting garbage collector and support for Unicode.

Python 3.0 was released on 3 December 2008. It was a major revision of the
language that is not completely backward-compatible. Many of its major features were
backported to Python 2.6.x[37] and 2.7.x version series. Releases of Python 3 include the
2to3 utility, which automates (at least partially) the translation of Python 2 code to Python
3. Python 2.7's end-of-life date was initially set at 2015 then postponed to 2020 out of
concern that a large body of existing code could not easily be forward-ported to Python 3.
In January 2017, Google announced work on a Python 2.7 to Go transcompiler to
improve performance under concurrent workloads.

Features and philosophy

Python is a multi-paradigm programming language. Object-oriented programming


and structured programming are fully supported, and many of its features support

Dept. of Computer Science and Engineering Page | 16


Detection of Malaria using Deep Learning
functional programming and aspect-oriented programming (including by meta
programming and metaobjects (magic methods)). Many other paradigms are supported
via extensions, including design by contract and logic programming.

Python uses dynamic typing, and a combination of reference counting and a cycle-
detecting garbage collector for memory management. It also features dynamic name
resolution (late binding), which binds method and variable names during program
execution.

Python's design offers some support for functional programming in the Lisp
tradition. It has filter(), map(), and reduce() functions; list comprehensions, dictionaries,
and sets; and generator expressions. The standard library has two modules (itertools and
functools) that implement functional tools borrowed from Haskell and Standard ML.

The language's core philosophy is summarized in the document The Zen of


Python (PEP 20), which includes aphorisms such as:

Beautiful is better than ugly

Explicit is better than implicit

Simple is better than complex

Complex is better than complicated

Readability counts

Rather than having all of its functionality built into its core, Python was designed
to be highly extensible. This compact modularity has made it particularly popular as a
means of adding programmable interfaces to existing applications. Van Rossum's vision
of a small core language with a large standard library and easily extensible interpreter
stemmed from his frustrations with ABC, which espoused the opposite approach.

While offering choice in coding methodology, the Python philosophy rejects


exuberant syntax (such as that of Perl) in favor of a simpler, less-cluttered grammar. As
Alex Martelli put it: "To describe something as 'clever' is not considered a compliment in
the Python culture." Python's philosophy rejects the Perl "there is more than one way to
do it" approach to language design in favor of "there should be one—and preferably only
one—obvious way to do it".

Dept. of Computer Science and Engineering Page | 17


Detection of Malaria using Deep Learning
Python's developers strive to avoid premature optimization, and reject patches to
non-critical parts of the CPython reference implementation that would offer marginal
increases in speed at the cost of clarity. When speed is important, a Python programmer
can move time-critical functions to extension modules written in languages such as C, or
use PyPy, a just-in-time compiler. Cython is also available, which translates a Python
script into C and makes direct C-level API calls into the Python interpreter.

An important goal of Python's developers is keeping it fun to use. This is reflected


in the language's name—a tribute to the British comedy group Monty Python—and in
occasionally playful approaches to tutorials and reference materials, such as examples
that refer to spam and eggs (from a famous Monty Python sketch) instead of the standard
foo and bar.

A common neologism in the Python community is pythonic, which can have a


wide range of meanings related to program style. To say that code is pythonic is to say
that it uses Python idioms well, that it is natural or shows fluency in the language, that it
conforms with Python's minimalist philosophy and emphasis on readability. In contrast,
code that is difficult to understand or reads like a rough transcription from another
programming language is called unpythonic. Users and admirers of Python, especially
those considered knowledgeable or experienced, are often referred to as Pythonists,
Pythonistas, and Pythoneers.

Syntax and semantics

Python is meant to be an easily readable language. Its formatting is visually


uncluttered, and it often uses English keywords where other languages use punctuation.
Unlike many other languages, it does not use curly brackets to delimit blocks, and
semicolons after statements are optional. It has fewer syntactic exceptions and special
cases than C or Pascal.

Indentation

Python uses whitespace indentation, rather than curly brackets or keywords, to


delimit blocks. An increase in indentation comes after certain statements; a decrease in
indentation signifies the end of the current block. Thus, the program's visual structure
accurately represents the program's semantic structure. This feature is also sometimes
termed the off-side rule.

Dept. of Computer Science and Engineering Page | 18


Detection of Malaria using Deep Learning

Statements and control flow

The assignment statement (token '=', the equals sign). This operates differently
than in traditional imperative programming languages, and this fundamental mechanism
(including the nature of Python's version of variables) illuminates many other features of
the language. Assignment in C, e.g., x = 2, translates to "typed variable name x receives a
copy of numeric value 2". The (right-hand) value is copied into an allocated storage
location for which the (left-hand) variable name is the symbolic address. The memory
allocated to the variable is large enough (potentially quite large) for the declared type. In
the simplest case of Python assignment, using the same example, x = 2, translates to
"(generic) name x receives a reference to a separate, dynamically allocated object of
numeric (int) type of value 2." This is termed binding the name to the object. Since the
name's storage location doesn't contain the indicated value, it is improper to call it a
variable. Names may be subsequently rebound at any time to objects of greatly varying
types, including strings, procedures, complex objects with data and methods, etc.
Successive assignments of a common value to multiple names, e.g., x = 2; y = 2; z = 2
result in allocating storage to (at most) three names and one numeric object, to which all
three names are bound. Since a name is a generic reference holder it is unreasonable to
associate a fixed data type with it. However at a given time a name will be bound to some
object, which will have a type; thus there is dynamic typing.

The if statement, which conditionally executes a block of code, along with else
and elif (a contraction of else-if).

The for statement, which iterates over an iterable object, capturing each element to
a local variable for use by the attached block. The while statement, which executes a
block of code as long as its condition is true. The try statement, which allows exceptions
raised in its attached code block to be caught and handled by except clauses; it also
ensures that clean-up code in a finally block will always be run regardless of how the
block exits.

The raise statement, used to raise a specified exception or re-raise a caught


exception. The class statement, which executes a block of code and attaches its local
namespace to a class, for use in object-oriented programming.

Dept. of Computer Science and Engineering Page | 19


Detection of Malaria using Deep Learning
The def statement, which defines a function or method.

The with statement, from Python 2.5 released on September 2006,[59] which
encloses a code block within a context manager (for example, acquiring a lock before the
block of code is run and releasing the lock afterwards, or opening a file and then closing
it), allowing Resource Acquisition Is Initialization (RAII)-like behavior and replaces a
common try/finally idiom.

The pass statement, which serves as a NOP. It is syntactically needed to create an


empty code block. The assert statement, used during debugging to check for conditions
that ought to [Link] yield statement, which returns a value from a generator function.
From Python 2.5, yield is also an operator. This form is used to implement coroutines.

The import statement, which is used to import modules whose functions or


variables can be used in the current program. There are three ways of using import:
import <module name> [as <alias>] or from <module name> import * or from <module
name> import <definition 1> [as <alias 1>], <definition 2> [as <alias 2>], ....

The print statement was changed to the print() function in Python 3.

Python does not support tail call optimization or first-class continuations, and,
according to Guido van Rossum, it never will. However, better support for coroutine-like
functionality is provided in 2.5, by extending Python's generators. Before 2.5, generators
were lazy iterators; information was passed unidirectionally out of the generator. From
Python 2.5, it is possible to pass information back into a generator function, and from
Python 3.3, the information can be passed through multiple stack levels.

Expressions

Some Python expressions are similar to languages such as C and Java, while some
are not:

Addition, subtraction, and multiplication are the same, but the behavior of division
differs. There are two types of divisions in Python. They are floor division and integer
division. Python also added the ** operator for exponentiation.

From Python 3.5, the new @ infix operator was introduced. It is intended to be used by
libraries such as NumPy for matrix multiplication.

Dept. of Computer Science and Engineering Page | 20


Detection of Malaria using Deep Learning
In Python, == compares by value, versus Java, which compares numerics by value
and objects by reference. (Value comparisons in Java on objects can be performed with
the equals() method.) Python's is operator may be used to compare object identities
(comparison by reference). In Python, comparisons may be chained, for example a <= b
<= c.

Python uses the words and, or, not for its boolean operators rather than the
symbolic &&, ||, ! used in Java and [Link] has a type of expression termed a list
comprehension. Python 2.4 extended list comprehensions into a more general expression
termed a generator [Link] functions are implemented using lambda
expressions; however, these are limited in that the body can only be one expression.

Conditional expressions in Python are written as x if c else y (different in order of


operands from the c ? x : y operator common to many other languages).

Python makes a distinction between lists and tuples. Lists are written as [1, 2, 3],
are mutable, and cannot be used as the keys of dictionaries (dictionary keys must be
immutable in Python). Tuples are written as (1, 2, 3), are immutable and thus can be used
as the keys of dictionaries, provided all elements of the tuple are immutable. The +
operator can be used to concatenate two tuples, which does not directly modify their
contents, but rather produces a new tuple containing the elements of both provided tuples.
Thus, given the variable t initially equal to (1, 2, 3), executing t = t + (4, 5) first evaluates
t + (4, 5), which yields (1, 2, 3, 4, 5), which is then assigned back to t, thereby effectively
"modifying the contents" of t, while conforming to the immutable nature of tuple objects.
Parentheses are optional for tuples in unambiguous contexts.

Python features sequence unpacking where multiple expressions, each evaluating


to anything that can be assigned to (a variable, a writable property, etc.), are associated in
the identical manner to that forming tuple literals and, as a whole, are put on the left hand
side of the equal sign in an assignment statement. The statement expects an iterable object
on the right hand side of the equal sign that produces the same number of values as the
provided writable expressions when iterated through, and will iterate through it, assigning
each of the produced values to the corresponding expression on the left.

Python has a "string format" operator %. This functions analogous to printf format
strings in C, e.g. "spam=%s eggs=%d" % ("blah", 2) evaluates to "spam=blah eggs=2". In
Python 3 and 2.6+, this was supplemented by the format() method of the str class, e.g.

Dept. of Computer Science and Engineering Page | 21


Detection of Malaria using Deep Learning
"spam={0} eggs={1}".format("blah", 2). Python 3.6 added "f-strings": blah = "blah";
eggs = 2; f'spam={blah} eggs={eggs}'.

Python has various kinds of string literals:

Strings delimited by single or double quote marks. Unlike in Unix shells, Perl and
Perl-influenced languages, single quote marks and double quote marks function
identically. Both kinds of string use the backslash (\) as an escape character. String
interpolation became available in Python 3.6 as "formatted string literals".

Triple-quoted strings, which begin and end with a series of three single or double
quote marks. They may span multiple lines and function like here documents in shells,
Perl and Ruby.

Raw string varieties, denoted by prefixing the string literal with an r. Escape
sequences are not interpreted; hence raw strings are useful where literal backslashes are
common, such as regular expressions and Windows-style paths. Compare "@-quoting" in
C#.

Python has array index and array slicing expressions on lists, denoted as a[key],
a[start:stop] or a[start:stop:step]. Indexes are zero-based, and negative indexes are relative
to the end. Slices take elements from the start index up to, but not including, the stop
index. The third slice parameter, called step or stride, allows elements to be skipped and
reversed. Slice indexes may be omitted, for example a[:] returns a copy of the entire list.
Each element of a slice is a shallow copy.

In Python, a distinction between expressions and statements is rigidly enforced, in


contrast to languages such as Common Lisp, Scheme, or Ruby. This leads to duplicating
some functionality.

List comprehensions vs. for-loops

Conditional expressions vs. if blocks

The eval() vs. exec() built-in functions (in Python 2, exec is a statement); the
former is for expressions, the latter is for statements.

Dept. of Computer Science and Engineering Page | 22


Detection of Malaria using Deep Learning
Statements cannot be a part of an expression, so list and other comprehensions or
lambda expressions, all being expressions, cannot contain statements. A particular case of
this is that an assignment statement such as a = 1 cannot form part of the conditional
expression of a conditional statement. This has the advantage of avoiding a classic C error
of mistaking an assignment operator = for an equality operator == in conditions: if (c = 1)
{ ... } is syntactically valid (but probably unintended) C code but if c = 1: ... causes a
syntax error in Python.

Methods

Methods on objects are functions attached to the object's class; the syntax
[Link](argument) is, for normal methods and functions, syntactic sugar for
[Link](instance, argument). Python methods have an explicit self parameter to
access instance data, in contrast to the implicit self (or this) in some other object-oriented
programming languages (e.g., C++, Java, Objective-C, or Ruby).

Typing

Python uses duck typing and has typed objects but untyped variable names. Type
constraints are not checked at compile time; rather, operations on an object may fail,
signifying that the given object is not of a suitable type. Despite being dynamically typed,
Python is strongly typed, forbidding operations that are not well-defined (for example,
adding a number to a string) rather than silently attempting to make sense of them.

Python allows programmers to define their own types using classes, which are
most often used for object-oriented programming. New instances of classes are
constructed by calling the class (for example, SpamClass() or EggsClass()), and the
classes are instances of the metaclass type (itself an instance of itself), allowing
metaprogramming and reflection.

Before version 3.0, Python had two kinds of classes: old-style and new-style. The
syntax of both styles is the same, the difference being whether the class object is inherited
from, directly or indirectly (all new-style classes inherit from object and are instances of
type). In versions of Python 2 from Python 2.2 onwards, both kinds of classes can be
used. Old-style classes were eliminated in Python 3.0.

The long term plan is to support gradual typing and from Python 3.5, the syntax of
the language allows specifying static types but they are not checked in the default

Dept. of Computer Science and Engineering Page | 23


Detection of Malaria using Deep Learning
implementation, CPython. An experimental optional static type checker named mypy
supports compile-time type checking.

Mathematics

Python has the usual C language arithmetic operators (+, -, *, /, %). It also has **
for exponentiation, e.g. 5**3 == 125 and 9**0.5 == 3.0, and a new matrix multiply @
operator is included in version 3.5.[80] Additionally, it has a unary operator (~), which
essentially inverts all the bits of its one argument. For integers, this means ~x=-x-1. Other
operators include bitwise shift operators x << y, which shifts x to the left y places, the
same as x*(2**y) , and x >> y, which shifts x to the right y places, the same as x//(2**y) .

The behavior of division has changed significantly over time:

Python 2.1 and earlier use the C division behavior. The / operator is integer
division if both operands are integers, and floating-point division otherwise. Integer
division rounds towards 0, e.g. 7/3 == 2 and -7/3 == -2.

Python 2.2 changes integer division to round towards negative infinity, e.g. 7/3 ==
2 and -7/3 == -3. The floor division // operator is introduced. So 7//3 == 2, -7//3 == -3,
7.5//3 == 2.0 and -7.5//3 == -3.0. Adding from __future__ import division causes a
module to use Python 3.0 rules for division (see next).

Python 3.0 changes / to be always floating-point division. In Python terms, the


pre-3.0 / is classic division, the version-3.0 / is real division, and // is floor division.
Rounding towards negative infinity, though different from most languages, adds
consistency. For instance, it means that the equation (a + b)//b == a//b + 1 is always true.
It also means that the equation b*(a//b) + a%b == a is valid for both positive and negative
values of a. However, maintaining the validity of this equation means that while the result
of a%b is, as expected, in the half-open interval [0, b), where b is a positive integer, it has
to lie in the interval (b, 0] when b is negative.

Python provides a round function for rounding a float to the nearest integer. For
tie-breaking, versions before 3 use round-away-from-zero: round(0.5) is 1.0, round(-0.5)
is −1.0. Python 3 uses round to even: round(1.5) is 2, round(2.5) is 2. Python allows
boolean expressions with multiple equality relations in a manner that is consistent with

Dept. of Computer Science and Engineering Page | 24


Detection of Malaria using Deep Learning
general use in mathematics. For example, the expression a < b < c tests whether a is less
than b and b is less than c. C-derived languages interpret this expression differently: in C,
the expression would first evaluate a < b, resulting in 0 or 1, and that result would then be
compared with c.

Python has extensive built-in support for arbitrary precision arithmetic. Integers
are transparently switched from the machine-supported maximum fixed-precision
(usually 32 or 64 bits), belonging to the python type int, to arbitrary precision, belonging
to the Python type long, where needed. The latter have an "L" suffix in their textual
representation. (In Python 3, the distinction between the int and long types was
eliminated; this behavior is now entirely contained by the int class.) The Decimal
type/class in module decimal (since version 2.4) provides decimal floating point numbers
to arbitrary precision and several rounding modes. The Fraction type in module fractions
(since version 2.6) provides arbitrary precision for rational numbers.

Due to Python's extensive mathematics library, and the third-party library NumPy
that further extends the native capabilities, it is frequently used as a scientific scripting
language to aid in problems such as numerical data processing and manipulation.

Libraries

Python's large standard library, commonly cited as one of its greatest strengths,
provides tools suited to many tasks. For Internet-facing applications, many standard
formats and protocols such as MIME and HTTP are supported. It includes modules for
creating graphical user interfaces, connecting to relational databases, generating
pseudorandom numbers, arithmetic with arbitrary precision decimals, manipulating
regular expressions, and unit testing.

Some parts of the standard library are covered by specifications (for example, the
Web Server Gateway Interface (WSGI) implementation wsgiref follows PEP 333), but
most modules are not. They are specified by their code, internal documentation, and test
suites (if supplied). However, because most of the standard library is cross-platform
Python code, only a few modules need altering or rewriting for variant implementations.

As of March 2018, the Python Package Index (PyPI), the official repository for
third-party Python software, contains over 130,000 packages with a wide range of
functionality, including:

Dept. of Computer Science and Engineering Page | 25


Detection of Malaria using Deep Learning

Graphical user interfaces

• Web frameworks
• Multimedia
• Databases
• Networking
• Test frameworks
• Automation
• Web scraping
• Image processing

Development environments

Most Python implementations (including CPython) include a read–eval–print loop


(REPL), permitting them to function as a command line interpreter for which the user
enters statements sequentially and receives results immediately. Other shells, including
IDLE and IPython, add further abilities such as auto-completion, session state retention
and syntax highlighting.

As well as standard desktop integrated development environments, there are Web


browser-based IDEs; SageMath (intended for developing science and math-related Python
programs); PythonAnywhere, a browser-based IDE and hosting environment; and Canopy
IDE, a commercial Python IDE emphasizing scientific computing.

Implementations

CPython is the reference implementation of Python. It is written in C, meeting the


C89 standard with several select C99 features. It compiles Python programs into an
intermediate bytecode which is then executed by its virtual machine. CPython is
distributed with a large standard library written in a mixture of C and native Python. It is
available for many platforms, including Windows and most modern Unix-like systems.
Platform portability was one of its earliest priorities.

Dept. of Computer Science and Engineering Page | 26


Detection of Malaria using Deep Learning

CHAPTER-4

SYSTEM DESIGN
The system “design” is defined as the process of applying various requirements and
permits it physical realization. Various design features are followed to develop the system
the design specification describes the features of the system, the opponent or elements of
the system and their appearance to the end-users.

4.1 System Architecture

This image depicts a process flow diagram for identifying malarial parasites using image
processing and a Convolutional Neural Network (CNN). Let's break down each step :
Dataset: This is the starting point. It refers to the collection of images used for training
and testing the model. These images likely consist of microscopic images of blood
samples, some containing malarial parasites and others not. A robust and diverse dataset
is crucial for the model's accuracy and generalization ability.
Data Pre-processing: This stage prepares the images for further processing. It often
involves several steps:

Dept. of Computer Science and Engineering Page | 27


Detection of Malaria using Deep Learning
Image Resizing: Images might be resized to a consistent size to be compatible with the
CNN architecture.
Color Correction/Normalization: Adjustments might be made to the color balance or
intensity of the images to account for variations in lighting or staining during the image
acquisition process.
Other Enhancements: Other techniques like contrast enhancement or noise reduction
might also be employed.
Apply Gaussian Filter to remove the noise: A Gaussian filter is a type of image
smoothing filter that uses a Gaussian function to reduce noise and blur fine details in the
images. This step is crucial for improving the quality of the images and making it easier
for the model to identify relevant features.
Preprocessed Image: This represents the output of the pre-processing stage. The images
are now cleaner, more consistent, and ready for feature extraction.
Feature Extraction: This step aims to extract relevant features from the preprocessed
images that can help distinguish between images containing parasites and those that do
not. In traditional image processing, this might involve techniques like edge detection,
texture analysis, or shape analysis. However, since a CNN is used, this step is largely
handled implicitly by the convolutional layers of the network. The CNN learns to extract
relevant features automatically during training.
CNN Model Training: A Convolutional Neural Network (CNN) is a type of deep
learning model specifically designed for processing images. The training process involves
feeding the preprocessed images (along with their corresponding labels indicating the
presence or absence of parasites) to the CNN. The network learns to adjust its internal
parameters (weights and biases) to accurately classify the images. This is typically done
using an optimization algorithm like stochastic gradient descent.
Malarial Parasitic Identification: Once the CNN is trained, it can be used to identify
malarial parasites in new, unseen images. The image is passed through the trained CNN,
and the network outputs a prediction (e.g., a probability score) indicating the likelihood of
the presence of parasites.
Computation of Performance Metrics: After the model is trained and tested on a
separate test dataset, various metrics are calculated to evaluate its performance. Common
metrics include:
 Accuracy: The overall percentage of correctly classified images.

Dept. of Computer Science and Engineering Page | 28


Detection of Malaria using Deep Learning
 Precision: The proportion of true positives (correctly identified parasite images)
among all images predicted to contain parasites.
 Recall: The proportion of true positives among all actual parasite images.

4.2 Data flow diagram (Level 0)

0.1
Blood Cell Efficient Result
Dataset Detection of
malaria
using

Level 0 Describes the overall process of this project. we are passing Blood cell dataset as
a input the system will efficiently detects malaria using the customized CNN model.

4.3 Detailed Design

4.3.1 DFD Level 1

Dept. of Computer Science and Engineering Page | 29


Detection of Malaria using Deep Learning

1.1 1.2

Preprocess Extract Features


Dataset

encod

Clean Features

features

Level 1 Describes the first stage process of this project. we are passing website dataset as
a input the system will perform the preprocess and extract the important features.

Level-2:

Dept. of Computer Science and Engineering Page | 30


Detection of Malaria using Deep Learning

Features 2.1

Read the features 2.2

CNN Model

2.1
Trained Data
Read data 2.3

Classificati
Re-
on
No Train

Yes

Result

Level 2 Describes the final stage process of this project. we are passing extracted features
from level 1and trained data as a input the system will detect malaria using CNN model
from the given blood cell images.

4.3.2 Use case diagram

Dept. of Computer Science and Engineering Page | 31


Detection of Malaria using Deep Learning

This diagram is a use case diagram illustrating the interaction between a user and
a system designed for malaria prediction and medicine recommendation. The diagram
shows two actors: the "User" and the "System." The ovals represent use cases, which are
specific functionalities the system provides. The arrows indicate the relationships between
the actors and the use cases, showing which actor initiates or participates in which use
case.
The process begins with the "User" initiating the "Load Image" use case. This implies the
user uploads or selects an image, presumably a microscopic image of a blood sample, to
be analyzed by the system. The "System" then performs the "Read Image" use case,
which involves reading and interpreting the image data. Following this, the "System"
carries out "Preprocess," where the image is prepared for analysis through techniques like
noise reduction, color correction, or resizing. Next, the "System" executes "Feature
Extraction," where relevant features are extracted from the preprocessed image. These
features are then fed into the "Apply ELM Model" use case. ELM stands for Extreme
Learning Machine, a type of machine learning algorithm. The ELM model, trained
beforehand, analyzes the extracted features to "Predict Malaria," outputting a prediction
of whether malaria is present in the sample. Finally, based on the prediction, the "System"
performs the "Recommended Medicine" use case, suggesting appropriate medication if
malaria is detected. The arrow pointing from "Recommended Medicine" back to the
"User" indicates that the system provides this recommendation to the user.

Dept. of Computer Science and Engineering Page | 32


Detection of Malaria using Deep Learning
In essence, this use case diagram describes a workflow where a user provides an image,
the system processes it using an ELM model to predict malaria, and then provides a
medicine recommendation based on the prediction. It highlights the interaction between
the user and the system in achieving the goal of malaria diagnosis and treatment guidance
4.3.3 Class Diagram

This class diagram models a system for malaria prediction using image processing and an
Extreme Learning Machine (ELM) model. It outlines the interactions between key
components of the system. A User provides one or more input images to the System. The
System receives these images and utilizes methods like readInputdata() and readdataset()
to handle them. The System then passes the image to the preprocessor, which performs
preprocessing operations using the preprocessing() method, generating one or more
preprocessed images. These preprocessed images are then passed to the feature Extract
class, which extracts relevant features using the ExtractedFeature() method. The extracted
features, along with trained data, are then fed into the ELM Model. The ELM Model has
methods for building a Convolutional Neural Network (CNN) using Build CNN and
training the model using Train(). The trained data from the ELM Model, along with the
extracted features, is used by the Prediction class to make a prediction using the predict()
method. Finally, both the ELM Model's trained data and the predictions are used by the
Performance analysis class to evaluate the model's performance using metrics like
precision and a performance matrix, calculated by the Test() method. The diagram

Dept. of Computer Science and Engineering Page | 33


Detection of Malaria using Deep Learning
emphasizes the flow of data from the User's input image through preprocessing, feature
extraction, model training and prediction, and finally, performance evaluation. The
relationships between the classes, denoted by their multiplicities, highlight how data is
passed between these components, creating a structured representation of the malaria
prediction system.

4.3.4 Activity Diagram

This activity diagram illustrates the process of malaria detection using blood image
analysis and an Extreme Learning Machine (ELM) model. The process begins with the
simultaneous handling of "Training Blood Image Data" and "Test Blood Image Data,"
indicating these datasets are processed concurrently. Once both datasets are ready, the
flow merges, and the "Preprocess" activity takes place, preparing the images for further
analysis through techniques like noise reduction and color correction. Following
preprocessing, "Extract Image Features" extracts relevant characteristics from the images,
converting them into numerical representations. These extracted features from the training
data are then used in the "Train using ELM Model" activity, where the ELM model is
trained to recognize patterns associated with malaria. Subsequently, the "Performance

Dept. of Computer Science and Engineering Page | 34


Detection of Malaria using Deep Learning
Analysis" activity evaluates the trained model's effectiveness using the extracted features
from the test data, calculating relevant performance metrics. Finally, based on the trained
model and its performance, the system proceeds to "Detect Malaria Types," identifying
and potentially classifying different types of malaria. The process concludes at the final
node. The diagram effectively visualizes the parallel processing of data and the sequential
steps involved in training, testing, and ultimately detecting malaria.

4.3.5 Sequence Diagram

This sequence diagram meticulously details the interaction between a User and a System
designed for malaria prediction, offering a granular view of the process. The interaction
commences when the User initiates the process by sending a "Load Dataset" message to
the System. This action signifies the user uploading or selecting a dataset of blood smear
images for analysis. Upon receiving this message, the System's lifeline becomes active,
initiating a series of operations.
The first operation is "Read," during which the System reads and loads the image data
from the provided dataset into its memory. This step involves accessing the image files,
decoding them, and preparing them for subsequent processing. Following the "Read"
operation, the System proceeds with "Pre-process." This stage is crucial for enhancing the
quality of the images and preparing them for feature extraction. Preprocessing techniques

Dept. of Computer Science and Engineering Page | 35


Detection of Malaria using Deep Learning
might include noise reduction using filters (like Gaussian blur), color correction to
standardize the images, image resizing to ensure consistency, and potentially contrast
enhancement to improve visibility of relevant features.
After preprocessing, the System undertakes the "Train" operation. This is where a
machine learning model, likely a Convolutional Neural Network (CNN) or an Extreme
Learning Machine (ELM) as suggested in related diagrams, is trained. The preprocessed
images from the training portion of the dataset are fed into the model, and the model
learns to identify patterns and features associated with malaria parasites. This training
phase is computationally intensive and involves adjusting the model's internal parameters
to achieve optimal performance.
With a trained model in place, the System then executes "Predict Malaria class." This
operation involves using the trained model to analyze new, unseen images (from the
testing portion of the dataset or newly uploaded images). The model processes these
images, extracts features, and then classifies them as either containing malaria parasites or
not, and potentially further classifying the specific type of malaria.
Before presenting the results to the user, the system performs a "Performance
comparison" internally. This step evaluates the model's performance using various metrics
such as accuracy, precision, recall, and F1-score. This step is crucial for assessing the
reliability and effectiveness of the model's predictions.
Finally, the System sends a "Medicine" message back to the User. This message contains
the results of the prediction, indicating whether malaria was detected. If malaria is
detected, the message may also include information about the specific type of malaria and
potentially suggest appropriate medication or treatment protocols based on the diagnosis.
This completes the interaction cycle, providing the user with valuable diagnostic
information. The sequence diagram effectively illustrates the precise order of these
operations and the flow of information between the User and the System.
.

Dept. of Computer Science and Engineering Page | 36


Detection of Malaria using Deep Learning

CHAPTER- 5

IMPLEMENTATION

5.1 Modules Description

Following modules are involved in this project

[Link] Collection

2. Data Preprocessing

3. Feature Extraction Using morphological function

4. Training and prediction of malaria disease Using CNN.

5.2 Module wise Algorithms and Code snippets

5.2.1 DESCRIPTION OF DATASET

The malaria dataset has been collected from the Kaggle. It contains 27,558
images of RBC. The dataset contain equal amount of malaria infected and uninfected
samples hence it is a balance dataset.

5.2.3 PRE-PROCESSING

Image pre-processing is a crucial step for this type of study because model outcome
highly depends on pre-processing techniques applied. It makes the learning process
smooth.

Procedure Preprocess()

Input: RBC cell image

Output: Preprocessed RBC cell image

1) Define a 4 × 4 rectangular kernel

2) img : Read the RBC cell image

3) img_erode : Perform erosion 15 times

Dept. of Computer Science and Engineering Page | 37


Detection of Malaria using Deep Learning
4) img_resized : Resize the image into 32 × 32

5) img_norm : Convert the pixel values between 0 to 1

def segment(path,status):

im0 = [Link](path)

gray1 = [Link](im0,cv.COLOR_BGR2GRAY)

#[Link]('image1',gray1)

#Using Otsu's thresholding after gaussian filtering

blur = [Link](gray1,(5,5),0)

ret, thresh =
[Link](blur,0,255,cv.THRESH_BINARY_INV+cv.THRESH_OTSU)

#noise removal using grayscale morphology

kernel = [Link]((3,3),np.uint8)

closing = [Link](thresh,cv.MORPH_CLOSE,kernel,iterations = 5)

#[Link]('image',closing)

opening = [Link](closing,cv.MORPH_OPEN,kernel,iterations = 3)

#[Link]('image2',opening)

#sure background area

sure_bg = [Link](opening,kernel,iterations = 2)

#[Link]('image5',sure_bg)

#Finding sure foreground area

dist_transform = [Link](opening,cv.DIST_L2,5)

ret, sure_fg = [Link](dist_transform,0.5*dist_transform.max(),255,0)

#[Link]('image3',dist_transform)

#Finding unknown region

sure_fg = np.uint8(sure_fg)

Dept. of Computer Science and Engineering Page | 38


Detection of Malaria using Deep Learning
unknown = [Link](sure_bg,sure_fg)

#[Link]('image4',unknown)

#Marker labelling

ret, markers = [Link](sure_fg)

#[Link]('image6',sure_fg)

# Add one to all labels so that sure bacground is not 0, but 1

markers = markers+1

# Now, mark the region of unknown with zero

markers[unknown==255] = 0

#[Link]('image7',unknown)

markers = [Link](im0,markers)

im0[markers == -1] = [255,0,0]

#[Link]('image8',im0)

gray2 = [Link](im0,cv.COLOR_BGR2GRAY)

im_color = [Link](gray2, cv.COLORMAP_JET)

5.2.3 Feature Selection:

In this module we are applying image morphological function to extract image features.

Code snippet

def extract_features(image_path, vector_size=32):

image = imread(image_path)

try:

# Using KAZE, cause SIFT, ORB and other was moved to additional module

# which is adding addtional pain during install

alg = cv2.KAZE_create()

Dept. of Computer Science and Engineering Page | 39


Detection of Malaria using Deep Learning
# Dinding image keypoints

kps = [Link](image)

# Getting first 32 of them.

# Number of keypoints is varies depend on image size and color pallet

# Sorting them based on keypoint response value(bigger is better)

kps = sorted(kps, key=lambda x: -[Link])[:vector_size]

# computing descriptors vector

kps, dsc = [Link](image, kps)

# Flatten all of them in one big vector - our feature vector

dsc = [Link]()

# Making descriptor of same size

# Descriptor vector size is 64

needed_size = (vector_size * 64)

if [Link] < needed_size:

# if we have less the 32 descriptors then just adding zeros at the

# end of our feature vector

dsc = [Link]([dsc, [Link](needed_size - [Link])])

5.2.4 Training and Prediction of malaria:

To reduce the training time complexity caused by the repeated model parameter tuning
process. The CNN architecture is simple and does not have iterative parameter tuning
that makes the training process faster and achieves adequate performance in disease
classification.

def build_model(input):

model = Sequential()

[Link](Dense(128,input_shape=(input[1],input[2])))

Dept. of Computer Science and Engineering Page | 40


Detection of Malaria using Deep Learning
[Link](Conv1D(filters = 112, kernel_size= 1,padding='valid', activation='relu',
kernel_initializer="uniform"))

[Link](MaxPooling1D(pool_size=2, padding='valid'))

[Link](Conv1D(filters = 64,kernel_size = 1,padding='valid', activation='relu',


kernel_initializer="uniform"))

[Link](MaxPooling1D(pool_size=1, padding='valid'))

[Link](Dropout(0.2))

[Link](Flatten())

[Link](Dense(100, activation="relu", kernel_initializer="uniform"))

#[Link](Dropout(0.2))

[Link](Dense(4, activation="relu", kernel_initializer="uniform"))

[Link](loss='mse',optimizer='adam',metrics=['accuracy'])

return model

Prediction:

model = load_model('results/CNN.h5')

df = pd.read_csv("[Link]")

x = [Link][ : , :-1].values

label_encoder = [Link]()

y = [Link][:, -1:].values

y=label_encoder.fit_transform(y)

print("y==",y)

#Splitting the data into test and training sets

X_train,X_test, y_train, y_test = train_test_split(x,y, test_size=0.2)

[Link](X_train, y_train)

prediction1 =[Link](X_test)

Dept. of Computer Science and Engineering Page | 41


Detection of Malaria using Deep Learning
print("Prediction==",prediction1)

System Testing

The purpose of testing is to discover errors. Testing is the process of trying to


discover every conceivable fault or weakness in a work product. It provides a way to
check the functionality of components, sub assemblies, assemblies and/or a finished
product It is the process of exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific
testing requirement.

7.1 Tests Conducted

7.1.1Unit testing

Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program inputs produce valid outputs. All decision
branches and internal code flow should be validated. It is the testing of individual
software units of the application .it is done after the completion of an individual unit
before integration. This is a structural testing, that relies on knowledge of its construction
and is invasive. Unit tests perform basic tests at component level and test a specific
business process, application, and/or system configuration. Unit tests ensure that each
unique path of a business process performs accurately to the documented specifications
and contains clearly defined inputs and expected results.

7.1.2 Integration testing

Integration tests are designed to test integrated software components to determine


if they actually run as one program. Testing is event driven and is more concerned with
the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically
aimed at exposing the problems that arise from the combination of components.

7.1.3Functional test

Dept. of Computer Science and Engineering Page | 42


Detection of Malaria using Deep Learning
Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and user
manuals.

Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Input : identified classes of invalid input must be rejected.

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised.

Systems/Procedures: interfacing systems or procedures must be invoked.

Organization and preparation of functional tests is focused on requirements, key


functions, or special test cases. In addition, systematic coverage pertaining to identify
Business process flows; data fields, predefined processes, and successive processes must
be considered for testing. Before functional testing is complete, additional tests are
identified and the effective value of current tests is determined.

Test Cases

Test Case# TC01

Test Name User input format

Test Description To test user input values as blood cell image

Input Image selected

Expected Output The system should be read path and display the path

Actual Output The path of image is read and display

Test Result Success

Test Case# UTC02

Test Name User input format

Test Description To test user input values image

Dept. of Computer Science and Engineering Page | 43


Detection of Malaria using Deep Learning

Input image, as null

Expected Output It Should show the alert Message select input image

Actual Output Shown alert message

Test Result Success

Test Case# UTC03

Test Name Preprocess

Test Description To test whether image noise is removed or not

Input Blood cell image

Expected Output It Should remove the noise by Gaussian filter

Actual Output Noise removed by system

Test Result Success

Test Case# UTC04

Test Name Test case to extract image features

Test Description To test whether extraction of image features

Input A preprocessed image

Expected Output The algorithm should extract the image important features

Actual Output The extracted important features.

Test Result Success

Test Case# TC05

Test Name Test case to predict disease

Test Description To test whether prediction of types of malaria

Input Extracted image features

Dept. of Computer Science and Engineering Page | 44


Detection of Malaria using Deep Learning

Expected Output The algorithm should predict the Disease name as per
historical data collected and recommend treatment

Actual Output The predicted value by algorithm is closer to the specified


value and recommend medicine in the historical data.

Test Result Success

Test Case# TC06

Test Name Test case for importing valid python libraries

Test Description To test whether an algorithm to implement congestion nodes


works without sklearn and keras models

Input Import all valid libraries sklearn, tensorflow and keras libraries

Expected Output An error should be thrown specifying “error importing libraries


sklearn, tensorflow and keras libraries”

Actual Output An error is thrown

Test Result Success

Test Case# ITC07

Test Name Dataset Creation integration

Test Description To test whether dataset creation integration with GUI

Input Dataset path and button command

Expected Output Integrating button and functionality by command()

Actual Output Integration Sucess.

Test Result Success

Dept. of Computer Science and Engineering Page | 45


Detection of Malaria using Deep Learning

Test Case# ITC08

Test Name Train integration

Test Description To test whether algorithm integration with GUI

Input Dataset path and button command

Expected Output Integrating button and functionality by command()

Actual Output Integration Success.

Test Result Success

Test Case# ITC09

Test Name Predict integration

Test Description To test whether algorithm integration with GUI

Input Image path and button command

Expected Output Integrating button and functionality by command()

Actual Output Integration Success.

Test Result Success

Dept. of Computer Science and Engineering Page | 46


Detection of Malaria using Deep Learning

CONCLUSION AND Future Enhancement:

Conclusion:
In this project a novel CNN has been presented for the automated diagnosis of
malaria from tiny blood samples. The result shows that the detection accuracy improves
when falsely labeled images are removed. Due to several morphological techniques, the
malaria parasites are highlighted. A lightweight watershed model has been trained on
preprocessed cell images for extracting the most informative features. Eventually, CNN
successfully differentiate between infected and uninfected samples from these features.
The proposed parasitic inflator, watershed capability to extract features, and CNN ability
to generalize make the proposed approach more effective. The efficacy of the proposed
framework is clear from its magnificent outcomes; whereas, the CNN has obtained
97.79% accuracy and 97.88% recall for the original dataset. Also, it has acquired a
promising score of 99.66% accuracy and 99.55% recall for the updated dataset.

Future Enhancement:
We have a plan to work on the object detection models with CNN feature
extractor and to increase the accuracy of malaria detection.

Dept. of Computer Science and Engineering Page | 47


Detection of Malaria using Deep Learning

REFERENCES:
[1] W. H. Organization, Malaria microscopy quality assurance manual-version 2. World
Health Organization, 2016.

[2] W. R. Taylor, J. Hanson, G. D. Turner, N. J. White, and A. M. Dondorp, “Respiratory


manifestations of malaria,” Chest, vol. 142, no. 2, pp. 492– 505, 2012.

[3] L. M. Barat, N. Palmer, S. Basu, E. Worrall, K. Hanson, and A. Mills, “Do malaria
control interventions reach the poor? a view through the equity lens,” American Journal
of Tropical Medicine and Hygiene, vol. 71, no. 2, pp. 174–178, 2004.

[4] N. M. Gharakhanlou, M. S. Mesgari, and N. Hooshangi, “Developing an agent-based


model for simulating the dynamic spread of plasmodium vivax malaria: A case study of
sarbaz, iran,” Ecological informatics, vol. 54, p. 101006, 2019.

[5] M. P. Singh, K. B. Saha, S. K. Chand, and L. L. Sabin, “The economic cost of malaria
at the household level in high and low transmission areas of central india,” Acta tropica,
vol. 190, pp. 344–349, 2019.

[6] M. O. F. Goni, F. M. S. Hasnain, M. A. I. Siddique, O. Jyoti, and M. H. Rahaman,


“Breast cancer detection using deep neural network,” in 2020 23rd International
Conference on Computer and Information Technology (ICCIT), 2020, pp. 1–5.

[7] M. Goni, O. Faruq, A. Matin, T. Hasan, M. Sarker, and R. Islam, “Performance


analysis of classifier for chronic kidney disease prediction using svm, dnn and knn,” in
Proceedings of the International Conference on Big Data, IoT, and Machine Learning.
Springer, 2022, pp. 3–13.

[8] M. Nahiduzzaman, M. J. Nayeem, M. T. Ahmed, and M. S. U. Zaman, “Prediction of


heart disease using multi-layer perceptron neural network and support vector machine,” in
2019 4th International conference on electrical information and communication
technology (EICT). IEEE, 2019, pp. 1–6.

[9] S. Rajaraman, S. K. Antani, M. Poostchi, K. Silamut, M. A. Hossain, R. J. Maude, S.


Jaeger, and G. R. Thoma, “Pre-trained convolutional neural networks as feature extractors

Dept. of Computer Science and Engineering Page | 48


Detection of Malaria using Deep Learning
toward improved malaria parasite detection in thin blood smear images,” PeerJ, vol. 6, p.
e4568, 2018.

[10] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenet classification with deep


convolutional neural networks,” Advances in neural information processing systems, vol.
25, pp. 1097–1105, 2012.

Dept. of Computer Science and Engineering Page | 49


Detection of Malaria using Deep Learning

Dept. of Computer Science and Engineering Page | 50


Detection of Malaria using Deep Learning

Dept. of Computer Science and Engineering Page | 51

You might also like