Brain Tumor Classifier

About CNN (Convolutional Neural Network) (source: medium.com)

We are using CNN (Convolutional Neural Network) model, we can predict weather a person has tumor (3 types) or not by submitting a image of CT-Scan or MRI.
But what is CNN ?
Deep learning CNN models to train and test, each input image will pass it through a series of convolution layers with filters (Kernals), Pooling, fully connected layers (FC) and apply Softmax function to classify an object with probabilistic values between 0 and 1.
In simple language, CNN image classifications takes an input image, process it and classify it under certain categories.

Layers

CNN model works on layers.
Convolution is the first layer to extract features from an input image. Convolution of an image with different filters can perform operations such as edge detection, blur and sharpen by applying filters.
ReLU stands for Rectified Linear Unit for a non-linear operation. The output is ƒ(x) = max(0,x). Why ReLU is important: ReLU's purpose is to introduce non-linearity in our ConvNet. Since, the real world data would want our ConvNet to learn would be non-negative linear values.
Pooling layers section would reduce the number of parameters when the images are too large. Spatial pooling also called subsampling or downsampling which reduces the dimensionality of each map but retains important information. Spatial pooling can be of different types:


Then comes Fully Connected Layer, we flattened our matrix into vector and feed it into a fully connected layer like a neural network.

What are we doing ?

First we import all the required decrepancies, model and dataset.
Dataset is then prepared into batches (in this case 32 images per batch) of size 256x256. Any image of other size is rescaled & resized to 256x256 so that model doesn't read any wrong patterns.
Training data is split into training, validation and testing data. We used standard convention and split data in ratio 8:1:1 (That means 80% data is given to the model for training and looking for patterns in all the layers, 10% for validation and 10% for evaluation of the model).
Then we fit the data to the model in the batch size of 32 images.
Then we use different hyperparameters and Layers to increase the accuracy of the model.
Model is then evaluated on the testing dataset.

Our Model Accuracy - 96.18611931800842 %