Predicting Tumors with Convolutional Neural Network Model

Summary

WHAT

Tumor Classification
6,689 MRIs categorized into No tumor, Glioma tumor, Meningioma tumor, and Pituitary tumor diagnoses

HOW

Convolutional Neural Network

Sequential layers including MaxPooling, Dropout, Flatten and Dense

RESULTS

95% of Accuracy predicting Tumors
Test made with testing dataset and an external MRI

TECHNOLOGIES

Google Colab

Python

Tensorflow

Keras

seaborn

Seaborn

matplotlib

Matplotlib

Introduction


Technological advancements have greatly influenced medical diagnosis. In oncology, the introduction of Magnetic Resonance Imaging (MRI) has had a significant impact on the detection of neoplasms, commonly known as tumors. Given the critical importance of the brain in internal body functions and behavior, determining the correct diagnosis from MRIs has traditionally been a task reserved for human experts. However, this study explores the potential of Deep Learning models, specifically training a Convolutional Neural Network (CNN) with MRIs and diagnoses previously determined by human oncologists. The trained model was then employed to predict diagnoses for MRIs it had not been trained with, evaluating its performance in comparison to human experts.

Methods


The dataset used comprises 6,689 MRIs categorized into No tumor, Glioma tumor, Meningioma tumor, and Pituitary tumor diagnoses. Coronal, sagittal, and axial views were included in the analysis.

No Tumor

no_tumor

Glioma

glioma

Meningioma

meningioma

Pituitary

pituitary


The dataset was split into training set (70%), validating set (10%), and testing set (20%). The validation set was utilized to validate the model at the end of each epoch and tune it with new information, checking for potential overfitting. The testing dataset was used to evaluate the final trained model's performance.

The selected model architecture is a sequence of neuron layers, including:


  • Convolutional 2D: Convolutional neural network layer, which is specialized in process images.
  • Max pooling 2D: used to reduce the dimension of the image taking by the max value of a filter.
  • Dropout: this randomly drops 25% of connections during the training process to prevent overfitting.
  • Flatten: used to reduce the dimensions up to 1, thus the Dense layer process a unidimensional input, with a better performance.
  • Dense: Fully connected basic neuron layer to process and reduce the output as the final expected result: 4 tumor classification.

ReLU activation function was used for its quick convergence and computational efficiency.

In total the model fitted 3,697,396 parameters in 20 epochs.



model_layers

The Adam (Adaptive Moment Estimation) optimizer was employed, dynamically adjusting the learning rate based on individual weights through the incorporation of the first and second moments of the gradient.

To evaluate the model at each epoch, the Loss function and Accuracy was calculated for training dataset and validation dataset.

The Loss function used is Sparce Categorical Cross Entropy, which is specific for Multiclass Classification models. This Loss function is basically the negative sum of every true value multiply by the activation function selected for the last layer, in this case is Softmax. This value quantifies the error of the model, therefore the lower the better.

The Accuracy is the percentage of perfect predicted classification. It is useful to quantify the goodness of the classification model prediction. The higher the better.

With the Loss and Accuracy calculated for each epoch and for training and validation dataset, we can compare them to see sings of overfitting or underfitting.

Finally, the Accuracy for testing dataset was quantified to see how good the model with completely new data is.

To manage the image dataset the pipeline architecture from Keras library was used. For the Convolutional Neural Network and the rest of the layers, the Layers module from Keras library was used. To plot figures and charts Matplolib and Seaborn was used.



Results


The Loss and Accuracy for training and validation datasets follow a decreasing and ascending trend, respectively, indicating a good model performance with relatively low overfitting across the epochs. The final Loss values are 0.03 and 0.16 for training and validation datasets, respectively. For Accuracy, the final values are 0.99 and 0.97 for training and validation datasets, respectively.



loss
accuracy


Testing the model with the testing dataset reveals an Accuracy of 0.95, indicating that 95% of the MRIs were correctly classified by the model.

A final test was conducted with an MRI from Radiology from St. Vincent's University Hospital, classified as Meningioma, which the model correctly predicted as Meningioma.



External Test: Meningioma

external_test


Conclusion


This study does not aim to replace human medical attention with AI algorithms but suggests that Convolutional Neural Network models can provide supportive assistance in diagnosing three types of tumors using MRIs, achieving a 95% confidence level compared to oncologists' diagnoses.

This approach could be complemented by an analysis of symptoms and other relevant exams to increase overall accuracy in diagnosing diseases like cancer. An interconnected group of models could lead to an automated diagnosis, potentially speeding up the diagnostic process and providing specialized medical services to patients who may be geographically or economically restricted.




© 2024 Bryan Morales