Week 3 — Histopathological Cancer Detection

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

Hello everyone, We are Tugay Calyan, Anil Aydingun and Denizcan Bagdatlioglu. In our blog last week, we explained how to load the dataset of our Histopathological Cancer Detection project. In this blog, we will explain the layers and CNN in the model where we will use the dataset we loaded.

To look at our previous blogs:

Convolutional Neural Network (CNN)

Convolutional neural network (CNN or ConvNet) is the most commonly applied class of deep neural networks to analyze and process images. It has applications in the fields of image and video recognition, suggestion systems, image classification, medical image analysis and natural language processing. In order to distinguish the given images, Cnn use unique features that make a shape or object again that shape. Cnn processes the image with various layers. Pass a more detailed overview of the CNN’s acquisition of the image, a series of convolution layers, nonlinear, pooling, Flattening Layer, and fully connected layers and get an output.

Convolutional Layer

This layer is the main building block of CNN. It is responsible for detecting the properties of the image. This layer applies some filters to the image to remove the low and high level features in the image. These filters are usually multi-dimensional and contain pixel values. First, the filter is positioned in the upper left corner of the image. Here, the indices between the two matrices (image and filter) are multiplied with each other and all the results are summed, then the result is stored in the output matrix. Then, move this filter to the right number of strides and repeat the process. After the first line is finished, the second line is passed and the operations are repeated. After all operations are finished, the output matrix is ​​created. This matrix is ​​often called Feature Map. Indicates the location of the image in the property represented by the filter. In short, the properties of the image are determined using the matrix multiplication by moving the filter over the image.

Generally, more than one filter is used to detect multiple properties, that is, a Cnn network has more than one convolutional layer

Stride

This value indicates that the filter, which is the weight matrix for the convolution process, will shift the image in increments of one pixel or more in steps. This is a parameter that directly affects the output size.

Padding

After convolution, it is a calculation that we have to manage the size difference between the input pixels and the output pixels. This is achieved by adding extra pixels to the input matrix.

Non-linearity

After all Convolutional layers, the Non-Linearity layer usually comes up. The reason is that since all layers can be a linear function, the Neural Network acts as a single perceptron, so the result can be calculated as a linear combination of outputs.

This layer is called the Activation Layer because one of the activation functions is used. These are non-linear functions such as sigmoid, tanh and ReLu. ReLu is used because the Rectifier (ReLu) function gives the best results in the speed of Neural Network training.

ReLu Function f (x) = max (0, x)

Applying the ReLu function to the Feature Map produces a result as follows.

The black values in the Feature Map are negative. After the Relu function is executed, the black values are removed and replaced with 0.

Pooling Layer

This layer is a layer that is frequently added between consecutive convolutional layers in CovNet. The task of this layer is to reduce the offset size of the representation and the number of parameters and calculations within the network. In this way, the mismatch in the network is checked. There are many pooling processes, but the most popular is max pooling. There are also average pooling and L2-norm pooling algorithms.

Max Pooling

As you can see in the picture, the filter takes the largest number in the area it covers. In this way, it uses smaller outputs that contain enough information for the neural network to make the right decision.

Flattening Layer

The task of this layer is simply to prepare the data in the input of the last and most important layer, Fully Connected Layer. In general, neural networks receive input data from a one-dimensional array. The data in this neural network is the one-dimensional array of matrices from the Convolutional and Pooling layers.

Flatting

Fully-Connected Layer

This layer is the last and most important layer of ConvNet. It takes the data from the Flattening process and performs the learning process through the Neural network. The fully connected layer (FC) operates on an input to which each input is connected to all neurons. FC layers, if present, are usually located towards the end of the CNN architecture and can be used to optimize targets such as class scores.

Fully-Connected Layers

References

See you next week!!!

--

--