The dataset used was from kaggle https://www.kaggle.com/navoneel/brain-mri-images-for-brain-tumor-detection
- Creating a function for augmenting the dataset
- Rotating range 10
- Width shift range of 0.1
- Height shift range of 0.1
- Shear range 0.1
- Brightness range 0.3 and 1.0
- Horizontal flip
- Vertical flip
- Reading the data
- Applying augmentation and then storing the data
- Read the data
- Print the length of the data
- Print count plot for the classes
- Convert image to gray scale
- Splitting the dataset
- Convert the train and test to numpy array
- Plotting some of the images with lable
- Reshape the train and test and then normalize the dataset
- Printing the shape
- Making a CNN model
- Convolutional layer with 32 neurons and 5,5 filter
- Leaky relu as activation
- Maxpooling with filter 2,2
- Convolutional layer with 128 neurons and 5,5 filter
- Leaky relu as activation
- Convolutional layer with 64 neurons and 5,5 filter
- Leaky relu as activation
- Convolutional layer with 32 neurons and 5,5 filter
- Leaky relu as activation
- Maxpooling with filter 2,2
- Flatten Layer
- Dense layer with 1000 neurons
- Leaky relu as activation
- Dropout of 0.5
- Dense layer with 500 neurons
- Leaky relu as activation
- Dropout of 0.5
- Dense layer with 250 neurons
- Leaky relu as activation
- Dense layer with 1 neuron and sigmoid activation
- Print model summary
- Compile model
- Fit model for 100 epoch
- Get the testing accuracy and loss
- Plot the training and validation accuracy and loss
- Print classification report
- Print confusion matric
- Plot the incorrect and correct predictions with correct labels
- Send positive images to matlab
- Preprocess the input image
- Apply thresholding
- Apply morphological operations
- Display image with red border around the tumor