Home AI Segmenting Brain MRI Images using Python, TensorFlow, and Keras

Segmenting Brain MRI Images using Python, TensorFlow, and Keras

0
Segmenting Brain MRI Images using Python, TensorFlow, and Keras

In this article, we’ll explore different architectures popular for performing brain tumor segmentation from MRI images. It is crucial to detect brain tumors early for proper treatment and saving lives.

The business problem revolves around brain tumor image segmentation, where each pixel of an image is assigned a class label (such as tumor or non-tumor). The dataset used for this task is obtained from Kaggle. It consists of brain MRI images along with manual FLAIR abnormality segmentation masks.

Before we can perform segmentation, we need to perform exploratory analysis and pre-processing steps. The dataset contains a total of 2556 non-tumorous images and 1373 tumorous images. One common issue with MRI images is low contrast, so we enhance the contrast using Histogram Equalization and Contrast Limited Adaptive Histogram Equalization (CLAHE). After comparing the results, we find that CLAHE produces better results.

Next, we proceed to crop the images. The steps involved in cropping an image are as follows:
1) Load the image.
2) Apply CLAHE to enhance contrast.
3) Detect edges in the image.
4) Apply dilation to remove small regions of noise.
5) Find contours in the image and crop based on extreme points.

To automate the pre-processing step for all images in the dataset, we provide a code snippet. It applies CLAHE, detects edges, finds contours, and crops the images accordingly.

Evaluation metrics for image segmentation include Intersection Over Union (IOU) and Dice Coefficient. IOU measures the overlap between predicted and ground truth segmentation, while Dice Coefficient calculates the overlap adjusted for the total number of pixels. We can use either IOU or Dice Coefficient as a metric for evaluation.

If you want to learn more about IOU and Dice Coefficient, you might want to continue reading the article.