Updated: Aug 30, 2021
Breast cancer is when there is a lump in the breast and the cells are growing at an abnormal rate. This destroys the connective tissues in the breast and can spread up lymph nodes under the arm that are vital for our bodies immunity. An AI service that can read images and predict whether the image is of healthy or cancerous cells in the breast can help detect breast cancer at early stages.
Breast cancer is when there is a lump in the breast and the cells are growing at an abnormal rate. This destroys the connective tissues in the breast and can spread up lymph nodes under the arm. That is why breast cancer needs to be detected in its early stages, but that doesn’t happen all the time. However, advances in computer science can help with early detection of breast cancer. AI or Artificial intelligence is something I used to help solve this problem.
How do you Build An AI?
To build an AI service that can read images and predict whether the image is of healthy or cancerous cells in the breast, you need to collect lots of example images of healthy and malignant or cancerous histopathology images. Fortunately, there are resources that provide you with such images. I found a resource on Kaggle. This dataset consists of 277,524 images of which 78,786 out of the 277,524 where cancerous and the remaining 198,738 images were healthy.
Once you have lots of histopathology images of cancerous and benign images, the next step is to train the AI for image classification. The residual neural network is a very popular image classification algorithm. It is known to have a high performance. I used it in Navigator (it’s a free tool available at this website) to train this image classifier. Navigator provides you with a REST API that will accept any image as an input and provide you with a prediction. The cool thing about this is that all you need is an internet connection and an image you want to predict. You can use it anywhere! If you would like to try out the AI I build using Navigator on a web interface, you can do that here.
Improving and Evaluating the AI
The next step is to evaluate how well the AI you built is doing. Fortunately, Navigator reports the accuracy and in my case, I got accuracies that ranged from 75%-90%. However, in cases like cancer, just having a high accuracy is not enough. There are two errors that can happen in the classification of cancer. You may detect a healthy person as having cancer or you may detect a sick person as not having cancer. It is always better to misdiagnose a healthy person than to misdiagnose a sick person.
One reason for this was the benign and malignant images were difficult to tell apart. This made it a little difficult since there were only slight differences as you can see in the diagram below. Once I analyzed the results, I saw that finding the pattern was a little difficult for the AI. To fix this I worked on it by adding more images to further improve the service along with tuning several hyper-parameters of the deep neural network to tune it for high performance.
In parallel to tuning the AI, I took a look at the confusion matrix of the classifier and found that there were many cases in which the AI misdiagnosed sick person as healthy. A confusion matrix has
True positives are cases in which the AI predicted the image is cancerous and it was a cancerous histopathology image
True negatives are cases that the AI predicted the image as healthy, and the image is cancerous.
False positives are cases in which the image was predicted as cancerous, but it wasn’t cancerous
False negatives are cases that were predicted as healthy, but they actually do have the disease.
The goal is to reduce the false negatives and true negatives because you don’t want to miss even a single person having cancer. In addition, to using the confidence values output by the AI service, I also plotted something called the ROC curve-which is a very popular and highly used metric for analyzing this kind of binary classification.
The process of calculating a ROC curve involves mathematical operations on the confidence outcome of the algorithm which I did use python. The code for this is linked here. I learned that the most accurate AI service is not always the best! The ROC curve is one piece of evidence along with the confusion matrix.
As I continued analyzing the data and working on it for several weeks, I learned that it is very hard to tune a deep neural network, especially when the two categories are hard to tell apart. So to fix it I would like to make this service available to the public for feedback and make it available to some physicians, to get their feedback. I would also like to spend more time collecting more images and tuning my service for better accuracy and performance.