Code Monkey home page Code Monkey logo

vesselsegmentation's Introduction

VesselSegmantation

frame

In this study, we propose multi-channel deep neural network for retina vessel segmentation. First, we apply U-net on original and thin(or thick) vessels for multi-objective optimization for purposively training thick and thin vessels. Then, we design a specific fusion mechanism for combining three kinds of prediction probability maps into final binary segmentation map. Experiments show that our method can effectively improve the segmentation performances of thin blood vessels and vascular ends. It outperforms the many current excellent vessel segmentation methods on three public datasets. In particular, it is pretty impressive that we achieve best F1-score with 0.8201 on the DRIVE dataset and 0.8239 on the STARE dataset. The findings of this study have the potential for application in automated retinal image analysis, and it may provide a new, general and high-performance computing framework for image segmentation.

Data

DRIVE https://drive.grand-challenge.org/

STARE https://cecas.clemson.edu/~ahoover/stare/

IOSTAR http://www.retinacheck.org/

Preparing data

# transform images to .hdf5 files

python prepare_datasets.py

Preparing the label of thin and thick vessels

# including extraction of vessel skeleton and separation of thin and thick vessels
python Thin_ThickLabel.py

Training

Training using labels for original, thick and thin vessels, respectively

python training.py

# using focal loss
def catergorical_focal_loss(gamma=2.0, alpha=0.25):
        """
        Formula:
            loss = -alpha*((1-p_t)^gamma)*log(p_t)
        Parameters:
            alpha -- the same as wighting factor in balanced cross entropy
            gamma -- focusing parameter for modulating factor (1-p)
        Default value:
            gamma -- 2.0 as mentioned in the paper
            alpha -- 0.25 as mentioned in the paper
        """

        def focal_loss(y_true, y_pred):

            epsilon = K.epsilon()
            y_pred = K.clip(y_pred, epsilon, 1.0 - epsilon)
            # Calculate cross entropy
            cross_entropy = -y_true * K.log(y_pred)

            # Calculate weight that consists of modulating factor and weighting factor
            weight = alpha * y_true * K.pow((1 - y_pred), gamma)
            # Calculate focal loss
            loss = weight * cross_entropy
            # Sum the losses in mini_batch
            loss = K.sum(loss, axis=1)
            return loss

        return focal_loss

Testing

Predict original, thick and thin vessels separately and save the results

# test and calculate the AUC within the mask
python predict.py

Fusion

python merge.py

def fusion2(raw_img, thick, thin):
    rowNum = len(thick)    
    colNum = len(thick[0]) 

    newImg = np.zeros((rowNum, colNum), np.uint8)

    for i in range(rowNum):
        for j in range(colNum):
            if thick[i][j] > 0.5 or thin[i][j] > 0.5 or raw_img[i][j] > 0.5:
                newImg[i][j] = 255
    return newImg

Calculate metrics

# Acc,sp,se,F1
python pixel.py

Results

Compare different loss functions

Cross-training results on DRIVE and STARE datasets

Segmentation result

Compare with others

vesselsegmentation's People

Contributors

jq-ding avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.