/Brain-tumor-detection

Implementation of medical image segmentation and deep learning framework with CNN and U-net

Primary LanguageJupyter NotebookMIT LicenseMIT

Brain-tumor-detection

overview

Data

The original dataset is from Kaggle: Br35H::Brain Tumor Detection 2020, and I've downloaded it and making PNG annotations from JSON annotation, and done the pre-processing.

Since the original dataset has 500 images for training and this number is small, I collected more data from different sources and generated more data using Flimimg.py. You can find it in /ImageSegmentation/MakeMoreData/ and use this dataset to train your custom model.

You can by using this site: Makesense annotate your data and use the JsonAnnotation_to_PNGAnnotation.py to make the PNG annotations. You can find it in /ImageSegmentation/AnnotationMaker/ .

This Dataset has been used to train these models.

Model

Unet Architecture

Model.jpg This deep neural network is implemented with Keras functional API.

Training

U-net

The U-net model is used to segment tumors in MRI images of the brain. After 10 epochs of training, the calculated accuracy is about 98%. Loss function for the training is basically just a binary crossentropy You can download my trained model from U-net

CNN

The CNN model is used to detect whether a tumor is there or not. After 15 epochs of training, the calculated accuracy is about 99.6%. Loss function for the training is basically just a binary crossentropy You can download my trained model from CNN


How to use

Run detectBT.py

Or follow notebook and codes


Results

Use the trained model to do segmentation on test images. The result is satisfactory. /results.png