Malaria and Machine Learning… How? Lets see🤔

Megha Shah
Nov 5 · 4 min read

So first thing i’ll write about Malaria is:

*KARDE MUSHKIL JEENA MALARIA KAMINA*

Now you must be thinking how can someone write this but lets talk about Malaria in India. Malaria has been problem in India for a longtime. According to the World Malaria Report of 2014, 22% of India’s population lives in high transmission area. India is malaria endemic and has been ranked 4th in number of malaria cases in the world according to latest Lancet Commission Report. For more info on malaria visit.

I won’t just talk about how bad it is in India but also some positive things about how India is marching towards elimination of malaria by 2027 (three years ahead of global agenda✌ )which has been thoroughly explained in Blog BugBitten by Dr. Vas Dev about all the challenges and the reasons for hope of malaria elimination from India visit for more information.

They cannot succeed

Machine Learning has been remarkably used in Medical and Healthcare field. To be able to apply Machine learning algorithms to ease the work of this healthcare associates with greater accuracy has made it more special. It has been used in detection of Cancer and we are going to use it for detection of Malaria infected cells by applying CNN model using Tensorflow and keras.

Now you must be thinking why Convolutional Neural Network its because CNN has the ability to automatically extract features and learn filters. Utilizing CNN will greatly speed up prediction time while mirroring (or even exceeding) the accuracy of clinicians.


Diagnosis

Diagnosis of malaria is by detection of malaria parasite in patients blood cells. Usually light microscopy of thick and thin blood smear stained by Romanovsky’s stain remains the standard method for diagnosis. Before reporting negative result, atleast 200 oil immersion visual fields at a magnification of 1000 x should be examined on both thick and thin smears, which has sensitivity of 90%.

How different Plasmodium species looks under microscope

Dataset

Dataset used for this project contains images of Blood cells both Uninfected and Parasitized by malaria. Dataset by Arunava can be downloaded from here. The dataset here is great because its labelled and has preprocessed images to train and evaluate the model. It contains 27,558 images with equal number of parasitized and Uninfected cells.

Steps

  1. Examine and understand the data by visualizing the parasitized and uninfected cell images
  2. Build a data containing both parasitized and uninfected cells and split it into images and labels format
  3. Build the data pipeline to the model
  4. Compose the model
  5. Train the model
  6. Model evaluation

Where is the code??……

I have posted code on GitHub. You can download the code to the project here to follow along or create your own.

Let us first see the sample images of parasitized cells and uninfected cells:

Cell infected with malaria parasite
Uninfected cells

As you must have noticed from plotting these sample images, we can see that the images are not equal in size and this needs fixing before feeding onto the model. We can also notice the infected cell images have the purple dense color in cells, which indicates the malaria infection. We would load those data into the memory numpy array.

So, now we have images and labels in array format:

Working with numpy array for such large data can be time consuming depending on the computer system so I have also used another method ImageDataGenerator class to feed the training image to the model.

Training the Model

We define our CNN model with Keras and TensorFlow . I have used 2 CNN models 1st model gives accuracy of 96.47% and with 2nd model giving minute greater accuracy then the 1st model which is 96.59%.

Done???

Already!!…

well yes, so now its your turn to make a project and build your own model. I’ll have to say this is my 1st article on Medium and i am pretty thrilled and excited about it.

Excitement level:

Thank you!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade