Skip to content

Semantic segmentation of Nucleus to advance medical discovery using U-Net++.

License

Notifications You must be signed in to change notification settings

Sandeep2017/Nucleus-Segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nuclei Cell Segmentaion


forthebadge forthebadge

A semantic segmentation model for nucleus cell segmentation using U-Net++

Overview


Contributors:


This project is created by the joint efforts of

Introduction:


  • Cell segmentation is a task of splitting a microscopic image domain into segments,which represent individual instances of cells.It is a fundamental step in many biomedical studies, and it is regarded as cornerstone of image-based cellular research.Cellular morphology is an indicator of a physiological state of the cell, and a well-segmented image can capture biologically relevant morphological information.

  • We have tried to create a deep learning algorithm to automate the nucleus detection,the cells’ nuclei is the starting point for most analyses because most of the human body’s 30 trillion cells contain a nucleus full of DNA, the genetic code that programs each cell. Identifying nuclei allows researchers to identify each individual cell in a sample, and by measuring how cells react to various treatments, the researcher can understand the underlying biological processes at work.

Dataset Used:


The dataset that we have used here is kaggle 2018 Data Science Bowl contest dataset,which contains 670 images of cells along with its masks. Each image in the dataset is assigned with an average of 20 images that adds up to become the mask of that single image and there are such 670 images in the dataset.Thus,joining the fragmented images into a single mask each time we run the notebook was a hectic task indeed. As a solution, for our own ease we have saved the created masked files into a separate folder along with the image. Such that we can save the computation time required to join those masks into a single mask eachtime we run the notebook. The link to that folder structure which contains the dataset for training along with separate image for testing is provided here.

Some sample images along with its masks is present here:

Masks:

Augmentation and Preprocessing:


The training data was augmented on the fly using the Albumentations library. A strong combination of different types of image augmentations were applied with varied probabilities. They were:

  • CLAHE.
  • Rotate.
  • Flip.
  • GaussNoise.
  • HorizontalFlip.
  • VerticalFlip.
  • HueSaturationValue.
  • Random Gamma.
  • Random Brightness & contrast.

Along with the above mentioned augmentations, every image in the training and testing sets underwent a Histogram Equalization preprocessing step, i.e, CLAHE (Contrast Limited Adaptive Histogram Equalization).

Augmented Training Images:

Augmented Masks:

Back to top

Network Architecture:


When it comes to medical imaging, the margin of error is almost negligible. One small mistake can lead to even fatal outcomes. Thus, algorithms designed for medical imaging must achive high performannce and accuracy even if the total no. of training samples upon which the data is trained is not enough or satisfactory,to solve this issue ,UNet was introduced in the world of AI based medical imaging world, and it gave unexpetedly good results.The model architecture that we have used here is known as UNet++.The UNet++ architecture has three additions in comparison to the classic UNet:

  • Redesigned skip pathways - These are added to bridge the semantic gap between the encoder and the decoder subpaths.As a result, the optimiser can optimise it more easily.

  • Dense skip connections - The Dense blocks used here is adopted from the DenseNet with the purpose to improve the segmentation accuracy and improves the gradient flow.

  • Deep supervision - The soul purpose of the deep supervison is to maintain the balance between the speed(inference) and perpormance of the model as per our requirements. There are mainly two modes that deep supervison has:

  • Accurate Mode-__ In this case the output from all the segmentation branches are averaged.

  • Fast Mode -__ In this mode the final segmentation map is selected on the basis of prediction metric from one of the segmentation block.

Loss Function and Optimizer:


The loss function and the optimizer that we have used here are BCE DICE LOSE and ADAM AND BEYOND respectively.

Loss Function-

The loss function that we have used here is a combination of both Binary Cross Entropy loss function and Dice loss function.

def dice_loss(y_true, y_pred):
    smooth = 1.
    y_true = K.flatten(y_true)
    y_pred = K.flatten(y_pred)
    intersection = y_true * y_pred
    score = (2. * K.sum(intersection) + smooth) / (K.sum(y_true) + K.sum(y_pred) + smooth)
    return 1. - score

def bce_dice_loss(y_true, y_pred):
    return binary_crossentropy(y_true, y_pred) + dice_loss(y_true, y_pred)
    

Back to top

Optimizer:-

The optimizer that we have used here to optimize our model is ADAM and Beyond. Which uses a new exponential moving average AMSGRAD. The AMSGRAD uses a smaller learning rate in comparison to ADAM. In case of ADAM the decrement or decay of learning rate is not guaranteed where as AMSGRAD uses smaller learning rates , it maintains the maximum of all the learning rates until the present time step and uses that maximum value for normalizing the running average of the gradient instead of learning rate in ADAM or RMSPROP. Thus, it converges better than ADAM or RMSPROP

Learning Rate:


The learning rate we have used here is not constant throughout the training of the data, instead we have used a learning rate schedular, which increases/decreases the learning rate gradually after every fixed set of epochs such that we can attain the optimum convergence by the end of our training of the data.

Training setup:


  • GPU: Nvidia P100 16GB
  • CPU: Intel Xeon
  • RAM: 12GB DDR4

The network was trained using the above mentioned setup for epochs with a batch size of 10 and input image size 256 x 256 x 3. Total time taken for training is 15 mins.

Training VS Validation Accuracy Curve:


Training VS Validation Loss Curve:


Back to top

Evaluation Metric:

F1-Score was used along with IOU and AUC for the evaluation of the results.


Back to top

Results:

The following table shows the results that we have achieved:

F1-Score AUC IoU
89.0 93.0 81.0
Images:

Masks:


Predicted Masks:


Keep Coding! :)

About

Semantic segmentation of Nucleus to advance medical discovery using U-Net++.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published