The project is a fully trained deep-learning pipeline to classify brain MRI images into one of the four categories; glioma, meningioma, pituitary tumor, and no tumor. The process starts by loading a structured set of data by having distinct training and test folders with each subfolder further subdivided into class-specific subfolders. The images distribution on the classes is discussed and visualized to make sure that the representation of each category is balanced and that the sample images of each category are shown to make sure that the data is loaded properly and that the visual distinctions between types of tumors are present. Images are then preprocessed with ImageDataGenerator where a training set is extensively augmented with rotations, zooming, shifting, shearing and flipping to artificially increase a dataset to better generalize the model. All the pictures are normalized and scaled to the dimensions of 150x150 before being introduced into the model. The test set is not augmented to preserve the integrity of evaluation. The model is a Convolutional Neural Network itself, and it has been created with the help of the Keras Sequential API. It has layers of increasingly deeper convoluting layers (32, 64, 128 filters) with MaxPooling layers to obtain hierarchical spatial features in the MRI scans. Upon the flattening, an overfitting reducing dense layer with 512 neurons and dropout is applied followed by the final softmax layer producing the four tumor classes probabilities. The model is trained using the Adam optimizer and using 50 epochs with both training and validation performance monitored. Training is followed by plotting the accuracy and the loss curve of the model to judge the learning behavior then the performance of the model is tested on the test set. Estimates of all the test images are made and a confusion matrix is drawn to show the classification performance in each of the classes. Further measures are obtained such as precision, recall, and F1-score to give a more in-depth analysis of the evaluation of the accuracy of each type of tumor. Another feature of the code is its random choice of sample test images, which then show the predictions of the model and the true labels, indicating the correct and incorrect classification. Lastly, the trained model is stored as an H5 file to be used or deployed in the future.
-
Notifications
You must be signed in to change notification settings - Fork 0
Harshith1004/Brain-tumour-classification-using-CNN
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published