AI Trained to sniff cancer

In this article, I would like to tell you a bit about technology employed to aid man in the battle against cancer and recently, even COVID-19. Arguably, one of the worst things that could happen to countries impacted now is overloading of hospital systems which would cause suffering among many people not affected by COVID-19 directly. This is the reason why a medical and AI start-up, Shukun Technology, decided to help. Aided by Convolutional Neural Networks, Shukun wants to help doctors all over the world by offloading them in the diagnostics area as much as possible.

By the end of this article you will learn:

  • Basic intuition behind Convolutional Neural Networks and what advantages they provide
  • How A.I. learns to diagnose people by ‘looking’ at x-rays, CAT scan images and other image-like data
  • How you can start learning and possibly help improving these technologies

Convolutional what?

On a very basic level, every neural network is composed of multiple layers – think of them as components with inputs and outputs that perform some math operations/transformations on the data passing through them. There are many different layers available for machine learning specialists, and it’s good to know what each does if you are thinking of pursuing an ML career. For now just remember that the Convolutional layers are best suited to analyse images or other data that can be represented as arrays.

It is said that an image is worth a thousand words, and I agree – with the addition of source code which is worth about 1024 words. So below is a bit of code building a model capable of recognizing digits from 0 to 9 and 2 animations showing intuition behind convolutional layers. Conv2D is our convolutional layer.

#define cnn model
def define_model():
model = Sequential()
model.add(Conv2D(32, (3, 3), activation='relu', kernel_initializer='he_uniform', input_shape=(28, 28, 1)))
model.add(MaxPooling2D((2, 2)))
model.add(Flatten())
model.add(Dense(100, activation='relu', kernel_initializer='he_uniform'))
model.add(Dense(10, activation='softmax'))
# compile model
opt = SGD(lr=0.01, momentum=0.9)
model.compile(optimizer=opt, loss='categorical_crossentropy', metrics=['accuracy'])
return model

If you want to build this model yourself and gain some practical knowledge into the convolutional layers, I recommend you to download PyCharm and follow the instructions in this article.

Another great article on the subject can be found here.

It can see. But, how does it know what?

Hopefully, you have some intuition on what the convolutional neural network is. Now let’s briefly discuss how it learns. Basic learning/training flow usually consists of gathering some labelled sample data – it could be just some pictures and some descriptor files, even a simple csv that holds pairs of information FileName;DigitItRepresents; (and so on). Now let’s say we have about a hundred pictures and a file that tells us which file holds what digit. We then split this into 2 groups called training set and evaluation set. Keras or Tensorflow (most commonly used libraries) will have ready methods for doing this split and performing training. It’s fairly simple, and basically, what your library of choice will do is, it will start pushing images through the layers and use labels to see if it did well or badly in terms of prediction. After each reward/punishment cycle, the network adjusts neuron values (the links between nodes in each network layer). There is of course more to all this but in a nutshell, this is all you need to know to follow what comes next.

That is powerful! Can it heal the world too?

No, it cannot. Well at least not all of it and not directly. What it can do is learn to diagnose medical conditions. Think about this – given enough labelled data, sophisticated Convolutional Network should be able to find patterns that only occur for particular labels – such as ‘lung cancer’. Neural network is good at this; in fact, despite what Hollywood wants you to believe this is all they are at the moment – they are extremely good pattern finding tools. Now, this labelled data could be for instance 3D Scans of our retinas, and in fact there is already a working example of AI detecting eye diseases as accurately as a real doctor. Researchers even went a step further detecting heart diseases by looking at your eyes! All it took was adding more image descripting labels including information on any cardiovascular events patient may have had in the past.

Was this not supposed to be about COVID-19?

Correct, but some context had to be given. By now you should know that neural network, when given some images and labels, can find patterns that they can use to diagnose medical conditions. This capability is exactly what Shukun Technology was exploring. Before the pandemic, they have been working on using convolutional neural networks to diagnose heart diseases and strokes. Shukun was able to quickly adapt their models to diagnose COVID-19 patients based on their chest CT scans. Currently, Shukun’s technology is deployed in over 200 hospitals, continuously growing and expanding their training datasets, thus increasing accuracy.

Impressive! How can I be a part of this?

You are actually 2 google searches away already:

Search for: Tensorflow2 course

Search for: medical databases for machine learning

At this point, machine learning hardware can be rented by the hour in Cloud, and this is a recommended approach. Libraries like TensorFlow 2 are well documented and extremely easy to use in comparison to what we had not so long ago. So as soon as you grasp the basic flows, you should be able to start searching for patterns in all the publicly available datasets.

I hope you found this article useful, and as always, please leave any thoughts you may have in the comments box below.

Author of this blog is Patryk Borowa, Aspire Systems.

1+