Breast Cancer Detection using AI

Updated: Mar 15

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.

Student builds AI that detects breast cancer
Breast Cancer Detection using AI

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