Giter Club home page Giter Club logo

retina-vesselnet's Introduction

[NOTE] Since this project has upgraded to Tensorflow 2.3 on 18th March 2021, you can find old branches which have stopped maintenance from:

VesselNet

A Simple U-net model for Retinal Blood Vessel Segmentation with DRIVE dataset

TestResult

Project Structure

We provide 2 version of projects: jupyter notebook and .py file. The implementation of these two versions is completely consistent. Choose one version and enjoy it!

First to run

For the first time, I recommand to use the version of jupyter notebook, it will give you an intuitive presentation. Different notebooks are made for different purpose:

  • EntireBookForColab.ipynb contains complete part of projects such as process, train, test. Furthermore, it can be run on Google Colab
  • PreprocessIllustartion.ipynb shows some preprocess methods for retinal images.
  • TestAndEvaluation.ipynb is the part for evaluating and testing the model.
  • Training.ipynb is the part for defining and training the model.

Remenber to modify the dataset path according to your setting.

Pretrained Model

  • Dataset can be found here. For Chinese, you can download here.
  • Pretrained model is coming soon...

Train/Test your own image

If you want to test your own image, put your image to the the relevant dir and adjust the patch_size,stride according to your image size.

Citation

This project has been used in:

@inproceedings{2020Eye3DVas,
  title={Eye3DVas: three-dimensional reconstruction of retinal vascular structures by integrating fundus image features},
  author={ Yao Z. and  He K. and Zhou H. and Zhang Z. and Xing C. and Zhou F.},
  booktitle={Frontiers in Optics},
  year={2020},
}

Reference

This project is based on the following 2 papers:

U-Net: Convolutional Networks for Biomedical Image Segmentation

Densely Connected Convolutional Networks

retina-vesselnet's People

Contributors

deeptrial avatar dependabot[bot] avatar kant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

retina-vesselnet's Issues

Error while running main_test.py

I'm getting the following error when i'm running main_test.py

tempfile.tif: Cannot read TIFF header.
Traceback (most recent call last):
File "main_test.py", line 41, in
main_test()
File "main_test.py", line 29, in main_test
infer.predict()
File "C:\Users\Venkat M\Downloads\Retina-VesselNet-master\Retina-VesselNet-master\perception\infers\segmention_infer.py", line 33, in predict
orgImg=[orgImg_temp[:,:,1]*0.75]+[orgImg_temp[:,:,0]*0.25]
IndexError: too many indices for array

关于 metric

AUC = np.round(np.sum((TPR[1:] + TPR[:-1]) * (FPR[:-1] - FPR[1:])) / 2., 4)这里为什么要这样计算啊

Program perfectly runs on CPU but gives value error when tested on GPU

Hi!
I tried to test this code on GPU but it gives value error.
The program runs perfectly fine on CPU but takes a lot of time(as it is expected).
I am adding the screenshot of the error
I am using tensorflow 1.12 and keras 2.2.4
Also please see this link for a potential guidence.

Also , i request you to mention which version of tensorflow and keras did you use.

screenshot from 2019-01-19 12-11-45
screenshot from 2019-01-19 12-12-01
screenshot from 2019-01-19 12-12-14

Thank you.

Question about image data format

I was looking at your dense_unet model, the input shape is (patch_width, patch_height, 1), so it is channel-last ordering, but then the batch normalization is done on axis=1, which corresponds to channel-first ordering. Is this a bug or did I miss something?

Test err

Traceback (most recent call last):
File "main_test.py", line 40, in
main_test()
File "main_test.py", line 34, in main_test
drawCurve(gtlist,[problist],modelName,'DRIVE',config.checkpoint)
File "/home/mir/project/Retina-VesselNet/perception/metric/segmention_metric.py", line 209, in drawCurve
(FPR, TPR, AUC), (Precision, Recall, MAP),IoU = process.statistics()
File "/home/mir/project/Retina-VesselNet/perception/metric/segmention_metric.py", line 38, in statistics
assert(len(self.groundtruth)==len(self.probgraph))
AssertionError

could anyone tell me why would this happen and how to solve it? thx a lot!

关于训练和测试

就是我下载你的代码和数据集,没有改动任何地方,训练准确率仅达到88%左右,然后跑的测试程序,预测结果没有出来与(VesselNet)/test/result一样的效果,可以说非常差,大神能看看是什么问题吗

Resnet or DenseNet?

DenseNet是对之前的feature map并置concatenate
捕获
ResNet是相加。但代码里用的是Merge.add()
难道不是应该用merge.concatenate?

训练自己的数据集时出现了以下问题,想请教一下。

您好,我看了你的项目,觉得非常有意思,现在想用你的模型训练自己的数据,但是在读取图片的时候出现了以下提示,想请教一下。
standerd_loader.py
imgs[index,:,:,0]=np.asarray(orgImg[:,:,1]*0.75+orgImg[:,:,0]*0.25)

IndexError: too many indices for array

想请教一下 imgs[index,:,:,0]=np.asarray(orgImg[:,:,1]*0.75+orgImg[:,:,0]*0.25) 这段代码的目的是什么呢?

ROC is not more than 0.5857 and PR is not more than 0.1196

I am having an issue with the ROC curve and PR graph. Their values are not very good. I tried predefined models as well as trained myself using the data you provided. And more the output images are not good.

Help me if I am doing anything wrong.
I am working on Colab using GPU.
Help me how can I achieve more accuracy.

Calculating Metrics within FOV

Hi, I noticed in your algorithm you didn't calculate the metrics within the FOV of the masks provided by the DRIVE dataset. Do you know what your results will be if you used them?

FileNotFoundError: [Errno 2] No such file or directory: './master/VesselNet/dataset/train/groundtruth/origin\\42_manual1.tif'

Hello there.

Sorry for bothering you but I ran into this error which stated that it cannot find the image file directory but for some reason after the "ground truth" it added an extra directory "origin" which I find odd because it should not be as so.

Is there a way to fix this problem? because I already revised all the pathing it should be correct. Thank you in advance.

time

老哥你是**人吧,直接中文了,我想问这么多层的网络,你用的什么配置,训练了多久,跟u-net训练时间比起来怎么样

图片补足的时候出现一点小问题

leftover_h = (img_h - config.patch_height) % config.stride_height  # leftover on the h dim
leftover_w = (img_w - config.patch_width) % config.stride_width  # leftover on the w dim
full_imgs=None
if (leftover_h != 0):  #change dimension of img_h
    tmp_imgs = np.zeros((imgs.shape[0],img_h+(config.stride_height-leftover_h),img_w,imgs.shape[3]))
    tmp_imgs[0:imgs.shape[0],0:img_h,0:img_w,0:imgs.shape[3]] = imgs
    full_imgs = tmp_imgs
if (leftover_w != 0):   #change dimension of img_w
    tmp_imgs = np.zeros((full_imgs.shape[0],full_imgs.shape[1],img_w+(config.stride_width - leftover_w),full_imgs.shape[3]))
    tmp_imgs[0:imgs.shape[0],0:imgs.shape[1],0:img_w,0:full_imgs.shape[3]] =imgs
    full_imgs = tmp_imgs
print("new full images shape: \n" +str(full_imgs.shape))
return full_imgs

我的数据集是256*256的,计算下来leftover_h和leftover_w都是0,所以full_imgs直接等于none了。我添加了一个if判断,问题解决了。
if(leftover_h==leftover_w==0):
full_imgs=imgs

关于结果

就是我下载你的代码和数据集,没有改动任何地方,训练准确率仅达到88%左右,然后跑的测试程序,预测结果没有出来与(VesselNet)/test/result一样的效果,可以说非常差,大神能看看是什么问题吗

About config_utils.py

from bunch import Bunch
error is No module named bunch
I cannot find content about bunch ,wolud you tell me how you learn this bunch,thanks

Question about dataset_normalized function

I know this function is from orobix's retina-unet repo, but they don't seem to actively maintain that repo now. This function first does Z normalization and then rescale the image back to [0, 255], which is equivalent to just scale the image to [0, 255]? Should the mean and std be calculated only along the batch axis?

Predicted one image too slow

I downloaded your code, and tested images.It runs!But one image took 2900s,I think it's too slow.Is there any other method?

希望在我的研究中使用您的代码

您好,我这边之前给您主页上留的邮箱发了一封邮件,希望能使用您的代码在我的课题上面,并且如果有论文发表,我这边将会给您挂作者,不知道您这边同不同意。希望能得到您的答复。

How to test model on multiple images?

Hello,
I was trying to test this model out on multiple images instead of just one and I wanted to know how that would be possible since when I currently have more than one image in the test/origin directory, the test results end up getting overwritten. Any help would be greatly appreciated.

Thanks,
Aditya

关于结果和参数设置的问题

你好,非常感谢大佬提供的如此整洁的代码。但是我在复现这个结果的时候,只能在验证集上达到95%左右的结果,用的是默认的参数配置,patch_size 是96*96,我想知道我该怎样设置参数才能达到98.4%左右的结果呢?

FCN?

这个是基于FCN的吧?那在建模的最后为什么要reshape成(None,9216, 2)呢?为什么不直接输出图片?
既然是逐像素分类,像素的标签是在数据集中已经标好了还是在代码中标注的?代码里没看到。
训练过程划分patch是随机划分的,还是每张图片划分出500个patch?

code dependence

hi
i use your environment but have some problems

Traceback (most recent call last):
File "main_train.py", line 54, in
main_train()
File "main_train.py", line 35, in main_train
dataloader.prepare_dataset()
File "/home/air/Desktop/BioHiLab/Retina-VesselNet/experiments/data_loaders/standard_loader.py", line 72, in prepare_dataset
imgs_train, groundTruth=self._access_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type)
File "/home/air/Desktop/BioHiLab/Retina-VesselNet/experiments/data_loaders/standard_loader.py", line 63, in _access_dataset
assert (np.max(groundTruth) == 255)
File "/home/air/anaconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2320, in amax
out=out, **kwargs)
File "/home/air/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity

About configs/segmention_config.json

I see “You can find model parameter in configs/segmention_config.json.“ in readme, but I can't find in your repo to reproduce experiment.

Server Specification

Hi Xing ChenCong

Previously big thanks for the good code! I have questions what kind of server / compute you use to achieve the train and test result? And how long it takes?

Thanks

question for training images

hello, thank you very much for sharing the great work.

I wonder why you used 40 images instead of 20 images(originally given for training).

what if we use only 20 images for training?

thank you in advance.

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.