Skip to content

xy2119/Brain_MRI_Image_Segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brain MRI Image Segmentation

🏆 Winner Of The 2021 Imperial College Data Science Challenge

In the 2021 Data Science Institute Computer Vision Challenge, we applied semantic image segmentation techniques on magnetic resonance imaging (MRI) to aid the diagnosis of brain tumors. Prof. Yike Guo, the co-director of the Data Science Institute (DSI), and the DSI judging panel awarded this work as the winner of "Best Computer Vision Project". Since our model achieved the highest dice score (78%) in the testing tasks, which uses U-Net architecture with pre-trained VGG16, and was trained on 90% of the available data.

📝 About The Project

To provide solutions for real-world applications, I further developed it into a Tumor Segmentation API that could be accessed by doctors and clinicians for effective screening and diagnosis.

image

Dataset

The datasets contain brain MRIs from glioma patients, MRI images (left) and matching masks (right) that have been annotated by the doctor, can be downloaded via URL.

image

Prerequisites

made-with-python

The following are the major open source packages utilised in this project:

  • Numpy
  • Pandas
  • OpenCV
  • Matplotlib
  • Scikit-Learn
  • Pytorch
  • TensorFlow
  • Keras
  • Flask

Folder Structure

code
.
├── images                                  # path to store images in tiff png gif
├── notebooks                               
│   ├── TumorSeg_Winner_U_Net_VGG16.ipynb   # notebook to train VGG16 U-Net      
│   ├── TumorSeg_API_U_Net_VGG19.ipynb      # notebook to train VGG19 U-Net 
│   └── README.md    
│
├── static                  
│   ├── css         
│   ├── img                         # path to store uploaded images
│   ├── js          
│   └── Pred.png 
│
├── templates                       # tempaltes for webapp development
│  
│
├── api.py                          # API depolyment using Flask
├── test.py
├── requirements.txt
└── README.md

🎯 RoadMap

Model Training

  1. Upload Dataset to Google Drive, dataset can be found here.

  1. (Optional) Create an account on Weights & Biases platform (The training is tracked by wandb, this is a tool for tracking and visualising machine learning experiments in real time. If you have an account on Weights & Biases, get started by copying the profile API key and pasting it later in the notebook as requested)

  1. Open notebook in Google Colab to train U-Net model

API Development

  1. Clone this repository, open a terminal and navigate to the directory to write the command
    git clone https://github.com/xy2119/Brain_MRI_Image_Segmentation.git
    
    cd Brain_MRI_Image_Segmentation

  1. Create and set up the environment tumorseg
   conda create --name tumorseg --file requirements.txt

  1. Activate tumorseg environment
    conda activate tumorseg

  1. Move the trained model to the current directory.

    You are welcomed to deploy your own model, or download mine :) unet_vgg19.h5 <- testset dice score ~ 81% trained from here


  1. Run api.py script and visit the web address to try out the segmenting functions!
    python api.py

Future Work

Exploring more advanced segmentation models, like SEP and FCBFormer refer to the paperwithcode leaderboard.

Contributing

If you have any questions or suggestions towards this repository, feel free to contact me at xy2119@ic.ac.uk.

Any kind of enhancement or contribution is welcomed!

About

Tumor Segmentation U-Net and API development at Imperial DSI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages