top of page

Breast Cancer Detection using AI

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.

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

  • 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.

16 Comments


luck 8 dạo này mình thấy mấy đứa bạn nói hoài nên cũng ghé thử cho biết. Mình không có đăng ký hay chơi gì đâu, chỉ mở lên lướt xem giao diện sắp xếp kiểu gì thôi. Cảm giác đầu tiên là trang nhìn khá sáng sủa, bố cục chia khối rõ nên kéo xuống không bị loạn mắt. Cái thanh menu để khá dễ thấy, bấm qua lại mấy mục cũng nhanh, không phải mò lâu mới ra chỗ cần xem. Mình thích kiểu họ trình bày thông tin theo dạng ô cột gọn gàng, nhìn một cái là nắm được ý chính chứ không nhồi chữ tùm lum. Nói chung ai chỉ muốn xem cấu trúc trang…

Like

https://docbaovem.net/ mình lướt thử vì thấy bạn bè share, chủ yếu xem trang họ trình bày ra sao chứ không định đọc kỹ. Vừa vào đã thấy tiêu đề kiểu “JW88” đặt khá nổi, bên dưới có đoạn giới thiệu thông tin chung về thương hiệu giải trí nên nhìn qua là nắm được họ đang nói về gì. Mình không bấm sâu, chỉ kéo xuống xem bố cục: nội dung chia từng khối tách bạch, có heading rõ nên mắt không bị mỏi. Chữ không dồn một cục, đoạn nào ra đoạn đó, đọc lướt vẫn bắt được ý chính. Kiểu trang này hợp cho ai muốn xem nhanh thông tin tổng quan, vì các tiêu đề và khung…

Like

https://taihitclub.cn.com/ hôm trước mình thấy bạn share nên bấm thử cho biết, kiểu vào xem giao diện ra sao thôi chứ mình không tạo tài khoản hay chơi gì. Cảm giác đầu tiên là trang nhìn khá thoáng, chia nội dung thành từng mảng nên lướt nhanh vẫn nắm được ý chính. Mình có để ý họ nhắc mốc ra mắt từ 2019, đọc qua thấy cũng hợp lý vì sao nhiều người biết đến vậy. Chữ với tiêu đề được tách rõ ràng, không bị nhồi một cục nên kéo xuống không mỏi mắt. Thanh menu đặt ngay chỗ dễ nhìn, bấm qua lại mấy mục cũng mượt, và các heading kiểu “giới thiệu” với “lợi thế” được gom…

Like

bj38 mình thấy dạo này nhiều người nhắc nên cũng ghé thử cho biết, chủ yếu xem giao diện với cách họ sắp xếp thông tin thôi. Vừa vào cái là thấy trang tải nhanh, chuyển qua lại vài mục không bị khựng, dùng trên điện thoại cũng khá mượt. Mình để ý họ trình bày kiểu chia khối rõ ràng nên nhìn phát biết đang ở phần nào, không phải mò menu hay kéo lên kéo xuống nhiều. Có mấy đoạn giới thiệu đặt ngay đầu trang, chữ dễ đọc, không bị nhét quá dày nên lướt nhẹ nhàng. Nói chung cảm giác là họ làm giao diện khá “gọn” và ưu tiên trải nghiệm, nhất là cái cách…

Like

open 88 mình lướt thử cho biết vì thấy mọi người nhắc hoài, kiểu vào xem giao diện có dễ dùng không thôi. Ấn tượng đầu là trang chia nội dung thành từng khối nhìn khá thoáng, kéo xuống không bị ngợp chữ. Mình có dừng lại đọc đoạn giới thiệu nói họ được OKVIP bảo trợ với nhấn mạnh trải nghiệm minh bạch, đọc nhanh là hiểu họ muốn xây niềm tin kiểu đó. Phần mình thích là mấy mục liên quan pháp lý bảo mật đặt khá nổi, không phải mò sâu mới thấy. Font với khoảng cách dòng cũng ổn nên đọc trên điện thoại đỡ mỏi mắt. Nói chung lướt vài phút là nắm được ý…

Like
bottom of page