MRI Image Segmentation with U-Net

Aug 11, 2024

Deep Learning with TensorFlow: MRI Image Segmentation Lecture Notes

Introduction

  • Part of the Deep Learning with TensorFlow playlist.
  • Focus on logic and implementation of deep learning algorithms using TensorFlow.
  • Expectation that audience is familiar with deep learning algorithms.
  • Code files provided in the description for re-implementation.

MRI Image Segmentation with U-Net

  • Task: Segment brain images to identify tumor regions using MRI images.
  • MRI Images: 3D images represented as volumes (voxels).

Segmentation Basics

  • Segmentation: Classifying each pixel in the image; more complex than standard classification (which gives a single output).
  • Segmentation outputs a separate label for each pixel.

MRI Image Specifications

  • Dimensions: Height, Width, Channels.
    • Black and white images: 1 channel (2D).
    • Color images: 3 channels (Red, Green, Blue).
  • MRI images contain 3D volume (X, Y, Z) with voxel information.
  • The fourth dimension contains different sequences (e.g., FLAIR, T1-weighted, T2-weighted).

Output Labels

  • For each voxel, output could be:
    • 0: Background
    • 1: Edema
    • 2: Non-enhancing tumor
    • 3: Enhancing tumor
  • Each voxel visualized with color representation (RGB).

Visualization

  • Visualization of 3D MRI images involves different planes:
    • Sagittal Plane
    • Coronal Plane
    • Transverse Plane

Generating Sub-Volumes

  • Instead of using complete MRI images (computationally expensive), use random sub-volumes for training.
  • Standardize data by making mean zero and standard deviation one.
  • U-Net architecture will be utilized for segmentation.

U-Net Architecture

  • The model consists of encoding (downsampling) and decoding (upsampling) layers.
  • Key processes include convolution, ReLU activation, and max pooling.
  • Information is shared between corresponding levels during upsampling.

Error Metrics

  • Dice Similarity Coefficient: Measures similarity between predicted and actual values.
    • Calculation involves intersection of predicted and actual values.
    • Soft Dice Similarity Coefficient is used when outputs are probabilities.
  • Sensitivity and Specificity: Important evaluation metrics for classification.
    • Sensitivity = True Positive / (True Positive + False Negative)
    • Specificity = True Negative / (True Negative + False Positive)

Implementation Steps

  1. Import necessary libraries and dataset.
  2. Explore dataset to understand shapes and labels.
  3. Normalize data, create labeled images for different planes.
  4. Standardize the input image data.
  5. Define the U-Net model architecture and compile it.
  6. Fit the model with training and validation datasets.
  7. Evaluate model performance using sensitivity and specificity metrics.

Conclusion

  • Lecture covers the segmentation of MRI images to identify tumors using U-Net architecture and TensorFlow.
  • Coding and implementation details will be shown in a notebook demonstration.
  • Future content will include more detailed lectures and live coding sessions.