MRI Segmentation and Tumor Detection Pipeline

Mansour Alawi
3 Jun 2022

Hi guys, Mansour here.  Currently I’m working on a pipeline for head tissues and brain tumor segmentation.

If you are excited about some brain stuff, keep reading…..else keep reading… :D

The pipeline consist of two major parts:1- The tissues segmentation model2- the tumor segmentation model

In this pipeline, U-net architecture is used for semantic segmentation of the tissues and the tumor

The datasets used are:1- first stage: self-made dataset using SPM12 for tissue masks2- second stage: Brain Tumor Segmentation (BraTS) Challenge 2017

The first stage is used to extract binary masks for the brain regions, the ROI for the tumor model, the current result achieved for brain extraction model is at mIOU = 95.6%:

For the second stage The BraTS 2017 dataset contains 3 stages for brain tumor:

  1. Edema
  2. Non-enhancing tumor
  3. Enhancing tumor


In the beginning, due to the small size of the tumor regions in comparison to the background, the model generalized all predictions as background.

For a fix, I have changed the loss function form Dice loss + categorical cross-entropy to:

  1. Generalised dice loss: which uses classes weights inversely proportional to the label area
  2. and, Weighted cross-entropy: which allows to manually set the classes weights

Here some of the obtained results:

These results can be considered promising, yet further fine-tuning is required to segment more tissues classes in the brain tissues model, and to increase the accuracy for the different tumor classes in the tumor model.

Hope this sharing excites you, give me some comments below if you have any question, suggestion or idea on how to further improve this work.