You can follow all the code and recreate the results of this post here.

Introduction

What would healthcare look like if you could discover your blood cell count as quickly and cheaply as your temperature? At Athelas, we are fascinated by this possibility and believe that such a future is within sight thanks to modern Deep Learning techniques.

In this post, we’ll demonstrate a simple toy example of how we can leverage deep learning techniques to classify white blood cell images.

Our example model will classify white blood cells as Polynuclear or Mononuclear with an accuracy of 98% on our reference dataset.

Polynuclear cells have nuclei that are segmented into multiple pieces while mononuclear cells have nuclei that are single pieces.

Caveats

There are a few caveats worth mentioning before going too much further into this post! Here they are:

This is not a rigorous, peer-reviewed paper that proves the accuracy of such techniques on a variety of datasets and lighting conditions. This post is simply meant to showcase how effective CNNs can be on traditional problems in pathology. The code and techniques mentioned in this post are not used by us in production. Our production code is tested and benchmarked to meet FDA standards. Moreover, in production we provide a range of metrics on the Complete Blood Count (CBC). The problem in this post represents a small subset of this overall problem space.

With that in mind, let’s take a look at why this is a fascinating problem space in the first place.

White Blood Cells and Why They’re Important

A classic blood test.

If you’ve ever had your blood drawn, chances are that you’ve had a blood test where your doctor looked up the following statistics about your blood among others:

The total number of White Blood Cells (WBCs) in your blood stream.

The number of Neutrophils, Lymphocytes, Basophils, and Eosinophils (all types of WBCs) in your cell. This is known as a differentiated blood cell count.

The density of WBCs in our blood stream provides a glimpse into the state of our immune system and any potential risks we might be facing. In particular, a dramatic change in the WBC count relative to your baseline is generally a sign that your body is currently being affected by an antigen. Moreover, a variation in a specific type of WBC generally correlates with a specific type of antigen.

Leukemia patients see far more Lymphocytes in their blood. Image Source: MedGurus.org

For instance, Leukemia patients often see a dramatically higher level of Lymphocytes in their blood stream relative due to a malfunctioning immune system. Likewise, people fighting allergies generally see an increase in their Eosinophil counts as these WBCs are key to fighting allergens.

As such, understanding the count of White Blood Cells in our blood stream can provide us a powerful quantitative picture of our health.

How We Currently Count WBCs

There are two main ways we count the different types of WBCs in your blood stream: the automated way and the manual way.

The Automated Way: Coulter Counters and Laser Flow Cytometry

The earliest automated way uses a device invented in the 1950s known as a Coulter Counter.

A Coulter Counter counts and classifies blood cells by passing them through a channel and measuring the change in impedance. Image source: Wikipedia.

At a high level, a Coulter Counter uses the fact that WBCs are poor conductors of electricity to classify and count them. In particular, the counter has two baths of a conductive solution along with a small channel through which a current runs. As the cell passes through the channel, the current through the channel decreases proportional to the shape and size of the type of cell. By measuring this change, the machine classifies the type of cell.

Laser Flow Cytometers. Image source: Wikipedia.

More recently, Laser Flow Cytometers have emerged as an improved alternative to Coulter Counters. These devices shine a laser across a channel and measure how the light from the laser is refracted as cells pass through (see the image above). Based on the refraction of light, the device aims to classify the given cell. At a high level, these devices improve on Coulter Counters by using light instead of current as the medium to measure disturbances against.

Both Coulter Counters and Laser Flow Cytometers cost in the tens of thousands of dollars. However, there’s no doubt that have played a fundamental role in improving our quantitative understanding of our health.

The Manual Way: Inspecting a Sample Under a Microscope

A pathologist examining a blood sample manually. Image source: wisegeek.com

The manual approach is just as it sounds - a sample of blood is placed under a microscope and a pathologist manually counts the number of cells in each frame. The total count is then extrapolated by assuming that the distribution is uniform across the entire blood sample and multiplying up.

The ML Way: Models That Improves with Time

The Machine Learning approach that we will be exploring through the rest of this blog post is a potentially promising advancement over such techniques due to a few reasons: