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.
DRIVE https://drive.grand-challenge.org/
STARE https://cecas.clemson.edu/~ahoover/stare/
IOSTAR http://www.retinacheck.org/
# transform images to .hdf5 files
python prepare_datasets.py
# including extraction of vessel skeleton and separation of thin and thick vessels
python Thin_ThickLabel.py
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
Predict original, thick and thin vessels separately and save the results
# test and calculate the AUC within the mask
python predict.py
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
# Acc,sp,se,F1
python pixel.py