This repository contains a comprehensive set of tools and notebooks for processing MRI brain scans, classifying strokes, and segmenting tumors using computer vision and deep learning techniques.
This project aims to:
- Process raw MRI brain scan images
- Segment tumors from preprocessed MRI brain scan images using computer vision techniques
- Classify whether a stroke is present or not
- If a stroke is detected, classify it as ischemic or hemorrhagic
We utilize OpenCV for image processing and FastAI for deep learning-based classification.
The dataset used in this project consists of MRI brain scan images. It is organized into several folders containing raw and processed images, as well as patient details.
For detailed information about the dataset structure and download instructions, please refer to the Dataset README.
This repository contains the following Jupyter notebooks:
-
1_MRI_images_Brain_preprocessing.ipynb- Processes raw MRI images
- Removes patient details from the MRI scans
- Highlights relevant features
-
2_Haemorrhagic_Segmentation.ipynb- Uses computer vision techniques to detect hemorrhagic tumors
- Implements Canny edge detection, Gaussian blur, and contrast enhancement
-
3_Ischemic_Segmentation.ipynb- Uses computer vision techniques to detect ischemic tumors
- Implements Median Filter and erosion
-
Ischemic_&_Haemorrhagic_Classification.ipynb- Uses FastAI to train and compare models for classifying ischemic and hemorrhagic strokes
- Models compared: ResNet, DenseNet, SqueezeNet, AlexNet
-
Stroke_NoStroke_Classification.ipynb- Uses FastAI to train and compare models for classifying the presence or absence of strokes
- Models compared: ResNet, DenseNet, EfficientNet, VGG16
-
Clone this repository:
git clone https://github.com/your-username/mri-stroke-classification.git cd mri-stroke-classification -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` -
Install the required packages:
pip install -r requirements.txt -
Download the dataset following the instructions in the Dataset README.
-
Start by running the preprocessing notebook:
jupyter notebook 1_MRI_images_Brain_preprocessing.ipynb -
After preprocessing, you can run the classification notebooks:
jupyter notebook Stroke_NoStroke_Classification.ipynb jupyter notebook Ischemic_&_Haemorrhagic_Classification.ipynb -
For tumor segmentation, use the respective notebooks:
jupyter notebook 2_Haemorrhagic_Segmentation.ipynb jupyter notebook 3_Ischemic_Segmentation.ipynb
Follow the instructions within each notebook for detailed usage.
Contributions to this project are welcome! Please follow these steps:
- Fork the repository
- Create a new branch:
git checkout -b feature-branch-name - Make your changes and commit them:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature-branch-name - Create a pull request
For any questions or issues, please open an issue in this repository.