This repository contains the code and resources for a Convolutional Neural Network (CNN) designed to detect brain tumors in MRI scans. The model is trained and evaluated on a dataset consisting of labeled brain MRI images, sourced from two Kaggle datasets (Dataset 1 and Dataset 2).
To use the model, follow these steps:
- Ensure that you have Python 3.11.2 installed.
- Install the required dependencies by running:
pip install matplotlib==3.7.1 tensorflow==2.12.0
- Put all the project files into a single folder.
- Download the datasets from the provided links and rename the zip files to "3000_dataset" and "first_dataset".
- Unpack the zip files into two separate folders for each dataset.
- Delete unnecessary folders inside the dataset folders, leaving only "yes" and "no" folders.
- Unpack the "Model 9867 Accuracy.zip" into a folder with the same name.
- Run all cells in the provided .ipynb file.
Ensure your project folder is structured as follows:
- Project Folder
- 3000_dataset
- yes
- no
- first_dataset
- yes
- no
- Model 9867 Accuracy
- (Contents of the model)
- Your.ipynb (The provided notebook file)
The model was trained on 2400 samples and tested on 853 samples, using grayscale images scaled to 64x64 pixels. The final settings achieved a high accuracy of 98%. The training process faced challenges such as finding the optimal model complexity and learning rate. Experimentation led to the removal of Dense Layers and a learning rate between 0.00007 and 0.00008 for optimal results.
The model achieved the following results on the main dataset:
- Accuracy: 98%
- AUC: 0.99
- Precision: 98%
- Recall: 99%
Results on the additional dataset from another source were comparable, demonstrating the versatility of the model. Despite its high accuracy, the model has limitations:
- Limited to analyzing brain scans from a single perspective.
- Unable to distinguish between different types of cancer.
- May struggle with very small cancerous tissue volumes due to heavy downscaling of resolution (64x64 pixels).
- matplotlib: 3.7.1
- tensorflow: 2.12.0
Feel free to explore the notebook for more details on the model architecture, training process, and evaluation metrics. For any questions or issues, please open an issue in this repository.