Brain Tumor MRI

Brain Tumor Detection & Segmentation Using CNNs on MRI Scans

Author: Arhaan Keshwani

Overview

This project uses convolutional neural networks (CNNs) to detect and segment brain tumors. It aims to detect and segment brain tumors in MRI (Magnetic Resonance Imaging) scans using state-of-the-art deep learning techniques. It employs a two-stage approach: first, a classification model detects the presence of tumors, and then a segmentation model outlines the tumor regions in positive cases.
Key Features
  • Automated brain tumor detection in MRI scans
  • Precise tumor segmentation for positive cases
  • Custom data generator for efficient processing of medical imaging data
  • Implementation of specialized loss functions for handling imbalanced datasets
  • Integration of classification and segmentation models for comprehensive analysis
Technical Details
  • Programming Language: Python
  • Deep Learning Framework: TensorFlow and Keras
  • Image Processing Libraries: OpenCV and scikit-image
  • Data Manipulation: NumPy and Pandas
  • Data Visualization: Matplotlib and Seaborn
Project Structure
brain-tumor-cnn/
│
├── data/
│   ├── data.csv          
│   └── data_mask.csv     
│
├── models/
│   ├── ResUNet-MRI.json
│   ├── ResUNet-model.json
│   └── resnet-50-MRI.json
│
├── notebooks/
│   └── test.ipynb        
│
├── src/
│   └── utilities.py      
│
├── .gitignore            
├── LICENSE               
├── README.md             
│
└── __pycache__/
Data Preparation
  • The project uses a custom DataGenerator class to efficiently load and preprocess MRI images
  • Data augmentation techniques are applied to increase the diversity of the training set
  • Images are resized to 256x256 pixels and normalized
Model Architecture
  • Classification Model: ResNet-50
  • ResNet-50 is a specific architecture of Residual Networks (ResNet), which are deep convolutional neural networks designed to address the vanishing gradient problem in very deep networks.

    Key features of ResNet-50 include:

    i. Depth: ResNet-50 has 49 layers, including 36 convolutional layers and 13 residual blocks.

    ii. Residual Connections: ResNet-50 uses residual connections to help the network learn more complex features and avoid the vanishing gradient problem.

    iii. Pre-trained on ImageNet: ResNet-50 was pre-trained on the ImageNet dataset, which contains over 14 million images and 1000 categories.

    iv. Fine-tuning: ResNet-50 can be fine-tuned for specific tasks, such as tumor detection in medical images.

    Pre-trained on ImageNet and fine-tuned for tumor detection.

    The goal was to categorize medical images including MRI scans and X-rays into one of two cases:

    i. The tumor is present

    ii. The tumor is absent (normal)

  • Segmentation Model: ResUNet
  • ResUNet is a combination of ResNet and U-Net architectures, designed for image segmentation tasks.

    Key features of ResUNet include:

    i. Combines residual learning from ResNet with the U-shaped architecture of U-Net.

    ii. Encoder-decoder structure with skip connections

    iii. Particularly effective for medical image segmentation

    iv. Maintains high-resolution features throughout the network

    In this project, ResUNet is used for the segmentation task (outlining tumor regions)

ResUNet Architecture
Training the model
  • The models were trained using a two-stage approach:
  • i. The classification model is trained to detect the presence of tumors.

    ii. The segmentation model is trained on positive cases to outline tumor regions.

  • Custom loss functions (Tversky and Focal Tversky) are implemented to handle class imbalance in segmentation tasks.
Evaluation

    i. Classification performance is evaluated using accuracy, precision, recall, and F1-score.

    ii. Segmentation performance is assessed using Dice coefficient and Intersection over Union (IoU).

    iii. A comprehensive evaluation pipeline combines both models to provide end-to-end tumor detection and segmentation.

Plans for the future

    i. Implement 3D convolutions to better utilize volumetric MRI data.

    ii. Explore ensemble methods for improved classification accuracy.

    iii. Investigate attention mechanisms for enhanced segmentation performance.

    iv. Develop a user-friendly web interface for easy model deployment.

Results

Scroll image 1
Scroll image 2
Scroll image 3
Scroll image 4
Scroll image 5
Scroll image 6
Scroll image 7
Scroll image 8
Scroll image 9
Scroll image 10
Scroll image 11
Scroll image 12
Scroll image 13
Scroll image 14
Scroll image 15
Scroll image 16
Scroll image 17
Scroll image 18
Scroll image 19
Scroll image 20
Scroll image 21
Scroll image 22
Scroll image 23
Scroll image 24
Scroll image 25
Scroll image 26
Scroll image 27
Scroll image 28
Scroll image 29
Scroll image 30
Scroll image 31
Scroll image 32
Scroll image 33
Scroll image 34
Scroll image 35
Scroll image 36
Scroll image 37
Scroll image 38
Scroll image 39
Scroll image 40
Scroll image 41
Scroll image 42
Scroll image 43
Scroll image 44
Scroll image 45
Scroll image 46
Scroll image 47
Scroll image 48
Scroll image 49
Scroll image 50
Scroll image 51
Scroll image 52
Scroll image 53
Scroll image 54
Scroll image 55
Scroll image 56
Scroll image 57
Scroll image 58
Scroll image 59
Scroll image 60
Scroll image 61
Scroll image 62
Scroll image 63
Scroll image 64