The fascinating world of Computer Vision: Convolutional Neural Network
For thousands of years, our eyes were the best at identifying objects from, seeing dangerous animals to bacteria under a microscope, but with the advancements, in object detection, the machine is far better at spotting certain items than any human. Computers being more adept at pattern recognition and recall make it almost unfair for our brains to try and even compete.
Knowing that no human can compete against a computer then why do people still allow Pediatricians to diagnose patients? When our eyes being reliable to a certain extent, are flawed when compared to a machine. An article by the Canadian Patient Safety Institute. They were showing an estimate that as many as 28,000 deaths per year in Canada are caused by Medical Errors. With Medical Errors being the third leading cause of death in Canada after cancer and heart disease!
What would be an applicable solution to this problem? Knowing that the medical field has automated various other aspects incorporation of Machine Learning models in patient diagnosis will be a faster and more accurate way to complete the task. Making Convolutional Neural Network (CNN) a great machine-learning algorithm to used for such a task.
Convolutional Neural Network (CNN)
So what is a Convolutional Neural Network (CNN)? Well in a simple way to describe it is, a class of neural networks or filters that break down the image by moving it in convolutions (clusters of pixels) trying to find a pattern.
To learn more: https://pythonprogramming.net/convolutional-neural-network-cnn-machine-learning-tutorial/
Looking at what CNN can do it seems like a perfect solution to our problem. As CNN has the ability to analyze histology images (image of blood under a microscope) to help identify what is in your blood, from a disease like cancer to what types of blood cells are in the image provided.
Setting Up The Neural Network
Like you can already infer a Neural Network is what helps the machine learning model break down the image, allowing the machine learning model to analyze the image’s patterns and characteristics. Which it does by moving through the Neural Networks, put into a series of Layers that help recognize different aspects of the image.
There isn’t just one kind of Neural Network, and for our Machine Learning Model, we will need only 2 types of Neural Networks or Layers. One, a Convolutional Layer and two, a Max Pooling Layer. The one we are going to take a look at is Max Pooling.
Max Pooling
In simple terminology, Max Pooling takes an image and changes its dimensionality/size allowing for the machine learning model to make assumptions about the image and give a result. A simple example would be taking a look at the image below. In the image, you see a square with numbers arranged into a grid with a blue 2 x 2 max-pooling layer going to the four sections of the grid. So what Max Pooling does is looks at the numbers in the 2 x 2 square and takes the highest number in that highlighted region. Getting rid of the other numbers forming the square on its right with the highest number or most prominent features in our case being left behind.
For more info: https://www.youtube.com/watch?v=ZjM_XQa5s6s
Why would we want to add this to our CNN? For one Max Pooling helps in reducing the computational cost by reducing the number of parameters. As we had simplified the starting image to make it easier for the machine learning model to configure a response. Another reason is that Max Pooling helps in reducing overfitting.
Labelling our Data
The CNN we are making is going to be a Machine Learning Algorithm that can identify what type of white blood cell is in your blood. To find the data to train the machine learning model to recognize white blood cells I used Kaggle’s Data of white blood cells. The dataset had 3 folders (Test, Test Simple, Train) There are 10,000 images (JPEG) that have 4 different types of white blood cells Neutrophil, Eosinophil, Monocyte, and Lymphocyte. To further classify these you can turn them into Mononuclear (Lymphocyte + Monocyte) or Polynuclear (Neutrophil + Eosinophil).
For the machine to identify what type of white blood cell is in the image we are going to use a simple binary classification method. So to represent which one is Mononuclear or Polynuclear we are going to use numbers. 1 meaning Polynuclear and 0 meaning Mononuclear.
Training
After letting the data download and be labelled, the next step which is by far the best one is training your machine learning model. So how do you train your machine learning model? Well as I explained above a Convolutional Neural Network is made of many layers that help in the machine’s prediction. The only way to teach the machine is to let the program run. Before any training had occurred the model gave an accuracy of 0.501 and after the 35 epochs, the machine scored 0.933! It is absolutely insane that just after 35 epochs there was a score jump of 0.432%. Therefore with more training, this machine learning model would be able to hit 100% accuracy.
The Future of Machine Learning
This white blood cell identifier might not be what we expect when we think of AI yet, but this is only the tip of the iceberg when thinking of the massive potential Machine Learning has to offer. AI and Machine Learning aren’t just going to revolutionize the medical industry, but all fields.