Malaria is a life-threatening disease that has claimed millions of lives around the world. Caused by a parasite, people with malaria often experience symptoms of chills and fever and can develop severe complications when the disease is left untreated. According to the World Health Organization, there were an estimated 219 million cases of malaria and 435,000 malaria deaths in 2017. Populations most at risk of contracting the disease include those located in poor tropical areas such as sub-Saharan Africa, South East Asia, and South America. In many of the countries affected by the disease, malaria is a leading cause of illness and death. Early detection is critical for ensuring a proper diagnosis and increasing chances of survival, but diagnosis of malaria is often difficult in these areas.

Microscopic thin and thick blood smear examinations are a commonly used and well-known method for disease diagnosis. A standard diagnosis based on a blood-smear test involves examination at 100x magnification, where up to 5,000 blood cells with parasites need to be manually counted. The process is therefore extremely time-consuming, and the diagnostic accuracy depends heavily on human expertise. Unfortunately, health personnel are often undertrained, underequipped, and underpaid. In addition, they face excessive patient loads, needing to distinguish between malaria and several other severe infectious diseases. This makes the possibility of a wrong diagnosis from human error likely.

These current issues with manual diagnosis present the case for the automation of the malaria diagnosis process via machine learning. Deep learning models, particularly convolutional neural networks (CNNs), have been proven to be very effective in a wide variety of computer vision tasks. They have previously achieved success in tasks involving image classification, image and video recognition, medical image analysis, natural language processing, and more. Automating the malaria diagnosis process can offer several benefits and allow for the delivery of quick and reliable healthcare in resource-scarce areas.

What it does

The model classifies whether a cell is parasitized or uninfected to determine the presence of malaria. This is a binary classification problem.

How we built it

The dataset chosen is from the National Library of Medicine. It consists of 27,558 segmented cell images from thin blood smear slides and their associated diagnosis (uninfected vs. parasitized). Positive samples contain the parasite Plasmodium. The dataset was balanced—there were equal instances of uninfected and parasitized cell images (13,794 each).

The desired raw input of the system is an image and the raw output is the diagnosis. The data was given in two folders, one with infected images and the other with uninfected images. Preprocessing the data involved converting the images in both folders into 64x64 NumPy arrays. Labels were given and encoded into one-hot vectors where [0,1] represents an infected cell and [1,0] represents an uninfected cell. Then, both the data and labels were shuffled and split into training, validation, and test sets. The training set contained 60% of the data (16534 images) and the validation and test sets each contained 20% of the data (5512 images).

We began by implementing 2 baseline models. A simple logistic regression model achieved 54.9% accuracy. A simple CNN model was also implemented as a second baseline. It contained 4 layers: convolutional 2D, max pooling 2D, flatten, and dense. The model used the RMSPropOptimzer and categorical cross entropy for its loss function. It achieved 80.59% accuracy on the training data and 78.52% accuracy on the test data.

The final model used is a convolutional neural network (CNN) with 20 layers. It contains 4 convolutional 2D layers, 4 max-pooling 2D layers, 4 batch normalization layers, 5 dropout layers, 2 dense layers, and 1 global average pooling layer. Each convolutional 2D layer is followed by a max-pooling 2D layer, and then batch normalization and dropout layers. The number of filters for the convolutional 2D layers were 32, 64, 128, and 128. For the dropout layers after batch normalization, the dropout ratio was 0.1. For the dropout layer after the first dense layer, the dropout ratio was 0.25. The model used binary cross-entropy for its loss function and Adam as its optimizer. In total, the model contained 376,386 total parameters with 375,682 trainable parameters.

Challenges we ran into

We ran into challenges regarding building the machine learning model and determining what kinds of layers to use and in what order. We had to experiment around with different kinds of layers, parameters, and loss functions to find a combination that worked best.

Accomplishments that we're proud of

The CNN was able to achieve an accuracy of >96%, outperforming rapid diagnostic tests (RDTs) and microscopy, two of the most commonly used ways to diagnose malaria in the present.

A confusion matrix shows that the number of true positives was 2,662, the number of false positives was 62, the number of true negatives was 2,652, and the number of false negatives was 136. The sensitivity or true positive rate was 95.14% and the specificity or true negative rate was 97.72%.

What we learned

Through this project, we learned about the issue of malaria and problems with current diagnosis methods. We also deepened our understanding of machine learning topics/concepts because the project involved using machine learning for image classification.

What's next for Detecting Malaria via CNNs

Further steps would include optimizing the model so it can perform even better and reach accuracy rates that are higher than the state-of-art. In addition, this deep learning model could be transformed into a mobile app or another usable format so it could be actually be applied in areas that need a better form of malaria diagnosis.

In conclusion, the proposed convolutional neural network (CNN) performed relatively well in diagnosing malaria from images of thin blood smear examinations and is a viable solution to the issue of inaccurate malaria diagnosis in resource-scare areas. If further developed, the CNN could probably achieve a higher accuracy and be converted into a usable format.

Built With

Share this project: