In this project we implemented a U-Net convolutional neural network in Tensorflow 2.0
and keras
, inspired by U-Net: Convolutional Networks for Biomedical Image Segmentation. Our implementation is based on zhixuhao/unet. Our implementation is contained within the LiverSegmentationReport Jupyter Notebook.
A fully automatic technique for segmenting the liver and localizing its unhealthy tissues is essential in many clinical applications, such as pathological diagnosis, surgical planning, and postoperative assessment. However, it is still a very challenging task due to the complex background, fuzzy boundary, and various appearance of both liver and liver lesions.
In this project we will develop automatic algorithms to segment liver and liver lesions in abdominal CT scans. To achieve this goal we'll utilize the power of deep learning algorithms.
The project consists of the following tasks:
- Liver segmentation
- Lesions segmentation
The training data set consists of 11 CT scans:
Data
directory contains CT images converted topng
formatSegmentation
directory contains segmentation masks:- Pixels with value 127 indicate liver
- Pixels with value 255 indicate liver lesion
The data can be downloaded from the following link: data link.
The following metrics will be used to evaluate the segmentation accuracy:
-
Dice similarity coeffcient (Dice):
TP, FP, and FN denote the number of true positive, false positive, and false negative pixels respectively. Dice computes a normalized overlap value between the produced and ground truth segmentation.
-
Precision (positive predictive rate):
Precision expresses the proportion between the true segmented pixels and all pixels the model associates with liver / lesions.
-
Recall (sensitivity):
Recall expresses the proportion between the true segmented pixels and all liver / lesions pixels.
The LiverSegmentationReport.ipynb is completely self contained when run on Google Colab notebook for printing the results.
We use of TensorFlow 2.0
API on Google Colab notebook set on GPU runtime (GPU: 1xTesla K80 , having 2496 CUDA cores, compute 3.7, 12GB (11.439GB Usable) GDDR5 VRAM).
We load TF2.0
as follows:
pip install -q tensorflow-gpu==2.0.0-alpha0
Note that you should make sure to use the GPU runtime, you can check it by running the following command inside the notebook:
print('Running on GPU' if tf.test.is_gpu_available() else 'Please change runtime type to GPU on Google Colab under Runtime') # Make sure we are set to GPU (under Runtime->Change runtime type)
Open the notebook in google colab and run all cells. The notebook presents our experiments results. The training and validation images are placed in data\train and data\val directories. In addition, we add the test data in data\test. In order to test the code with different images, please replace the images inside data\test with your own images.
To use the notebook with costume configurations, please run all cells until the Results section. Then, you may add new code cells and use the functions as follows: