Week 2 — Histopathological Cancer Detection

Tugay ÇALYAN
bbm406f19
Published in
5 min readDec 11, 2019

Hello to everyone. In this week’s article, we will review the studies on the Histopathological Cancer Detection project. We will also explain how we load the dataset we use, line by line. First of all, we should take a look at a few concepts to understand related works.

The Patchcamelyon(PCam) Dataset

Last week, we announced the dataset that we will use for histopathological cancer detection. If you want to understand the dataset, you can look here.

Transfer Learning

Simply transfer learning is the use of a previously trained model in a new problem. It provides training of deep neural networks with smaller data. Since there are generally no millions of data points for real-world problems, it makes sense to use this approach in a train.

A well-trained and successful model for the solution of a problem is the process of applying the weights of a model to the neural network that was created to solve a new problem similar to this problem. It makes sense to use the knowledge of the neural network, which is trained with a large number of data, rather than learning it from scratch with little data at hand. It may be a valid and simple example to use the weights of a well-trained neural network that was previously established for the detection of breast cancer as initial weights in the new network for the detection of metastatic cancer.

It can also be interpreted as a way of overcoming the limited process power problem in the neural network that require very high processing power. Although it is not a real machine learning technique, it is widely used in areas such as computer vision and natural language processing.

Data Augmentation

Having a large dataset is a necessary condition for the model to learn well. However, it is possible to extend the dataset by synthetic ways in the absence of millions of data points for real world problems. Image augmentation is the process of expanding dataset using by methods such as gaussian filter, flipping, cropping etc.

Some data augmentation techniques:

  • Scaling: The image size is changed.
  • Cropping: Part of the image is selected and the rest is cropped. Crop is usually made towards the center.
  • Flipping: The image is symmetrical with respect to one of the axes.
  • Padding : Add as many pixels as desired in each direction.
  • Rotation: The image is rotated by selecting a random degree.
  • Grayscale: The images is converted to “grayscale” mode.
  • Saturation: The colors of the image are separated.

Fine Tuning

Fine-tuning is a concept closely related to transfer learning. Two concepts are about using a pre-trained neural network for a new problem. In transfer learning weights of previously well-trained neural network are used as initial values, while in fine-tuning an entire network is used for the new problem.

It is a difficult challange to find out how many layers we will use and how many nodes we will use on each layer. Remember the example we use to understand transfer learning, the breast cancer dedection. If we change the output layers in a neural network for detection of breast cancer, replace the layers that detect metastasis cancer and then train the trained network again without changing the weights of the middle layers. Our network will not be a breast cancer detection network, it will be a network that will detect metastasis cancer.

Normalization

Normalization is the method used to change the range of pixel values. This is to create a dynamic range for all data. With normalization, all images will have pixel values ​​in the desired range. The normalization process can be calculated by the following formula.

Mathematical Representation

Confusion Matrix

After we train our model and get the results, how can we see what we need to develop in our model? Confusion matrix comes up when we ask this question. Confusion matrix is a measure of performance for machine learning models.

For a two-label dataset, a confusion matrix will occur as follows.

TP (True Positive): Positive was estimated. The label is Positive.

FP (False Positive): Positive was estimated. The label is negative.

FN (False Negative): Negative was estimated. The label is Positive.

TN (True Negative): Negative was estimated. The actual label is Negative.

Here recall and precision values are calculated.

recall = TP / (TP + FN)

precision = TP / (TP + FP)

f-measure = 2 * recall * precision / (recall + precision)

To compare the success of our model, we can use f-measure as a measure that incorporates recall and precision.

One Cycle Policy

Learning rate is one of the fundamental hyper parameters for deep learning. Choosing a learning rate too large will cause the model not to be well trained, and selecting too small will result in overfitting and training being too slow or even painful. Learning rate needs to be well chosen to achieve a well-trained model without suffering. In this case, it is necessary to try the learning rate. “1 cycle policy” appears as a rescue path. It is a method that works with reducing and increasing the learning rate and reducing it again.

Since we have an idea about these concepts, we can proceed to examine the successful work of Antonio de Perio who made cancer detection using the same dataset.

Antonio de Perio started working with data augmentation. center crop the images, image flipping on the vertical axis. Then he split train dataset 80/20 as train / validation. He normalized the pictures using the “mean” and “standard deviation” values. He apply transfer learning using the well-trained Resnet50 model. Trained the model with 1 cycle policy and 97.76% “accuracy” as a result of these operations.

To further improve this result, he looked at the confusion matrix and decided to use fine-tuning and use the discriminative learning rates with 1 cycle policy. He used the well-trained Resnet50 again for fine-tuning. 98.60% “accuracy” when he did this process.

By using the python we have categorized the images that’s label informations are stored in the csv file. Images belong to label zero are in the file name is “0”, label one are in the file name is “1”.

References

--

--