Code Monkey home page Code Monkey logo

rvgan's Introduction

MICCAI2021 RVGAN

PWC PWC PWC

This code is for our paper "RV-GAN: Segmenting Retinal Vascular Structure inFundus Photographs using a Novel Multi-scaleGenerative Adversarial Network" which is part of the supplementary materials for MICCAI 2021 conference. The paper has since been accpeted and presented at MICCAI 2021.

Arxiv Pre-print

https://arxiv.org/pdf/2101.00535v2.pdf

Springer

https://link.springer.com/chapter/10.1007/978-3-030-87237-3_4

Citation

@inproceedings{kamran2021rv,
  title={RV-GAN: Segmenting retinal vascular structure in fundus photographs using a novel multi-scale generative adversarial network},
  author={Kamran, Sharif Amit and Hossain, Khondker Fariha and Tavakkoli, Alireza and Zuckerbrod, Stewart Lee and Sanders, Kenton M and Baker, Salah A},
  booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
  pages={34--44},
  year={2021},
  organization={Springer}
}

Virtual Oral Presentation (Youtube)

IMAGE ALT TEXT HERE

Pre-requisite

  • Ubuntu 18.04 / Windows 7 or later
  • NVIDIA Graphics card

Current branch is for Tensorflow 2.0-gpu version

For Tensorflow 2.6-gpu version check the following branch

https://github.com/SharifAmit/RVGAN/tree/tf-2.6

Installation Instruction for Ubuntu

sudo apt-get install pip3 python3-dev
  • Install Tensorflow-Gpu version-2.0.0 and Keras version-2.3.1
sudo pip3 install tensorflow-gpu==2.0.0
sudo pip3 install keras==2.3.1
  • Install packages from requirements.txt
sudo pip3 install -r requirements.txt

DRIVE Dataset

  • Please cite the paper if you use their data
@article{staal2004ridge,
  title={Ridge-based vessel segmentation in color images of the retina},
  author={Staal, Joes and Abr{\`a}moff, Michael D and Niemeijer, Meindert and Viergever, Max A and Van Ginneken, Bram},
  journal={IEEE transactions on medical imaging},
  volume={23},
  number={4},
  pages={501--509},
  year={2004},
  publisher={IEEE}
}

Dataset download link for DRIVE

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

STARE Dataset

  • Please cite the paper if you use their data
@article{hoover2000locating,
  title={Locating blood vessels in retinal images by piecewise threshold probing of a matched filter response},
  author={Hoover, AD and Kouznetsova, Valentina and Goldbaum, Michael},
  journal={IEEE Transactions on Medical imaging},
  volume={19},
  number={3},
  pages={203--210},
  year={2000},
  publisher={IEEE}
}

Dataset download link for STARE

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

CHASE-DB1 Dataset

  • Please cite the paper if you use their data
@article{owen2009measuring,
  title={Measuring retinal vessel tortuosity in 10-year-old children: validation of the computer-assisted image analysis of the retina (CAIAR) program},
  author={Owen, Christopher G and Rudnicka, Alicja R and Mullen, Robert and Barman, Sarah A and Monekosso, Dorothy and Whincup, Peter H and Ng, Jeffrey and Paterson, Carl},
  journal={Investigative ophthalmology \& visual science},
  volume={50},
  number={5},
  pages={2004--2010},
  year={2009},
  publisher={The Association for Research in Vision and Ophthalmology}
}

Dataset download link for CHASE-DB1

https://blogs.kingston.ac.uk/retinal/chasedb1/

Dataset Pre-processing

  • Type this in terminal to run the strided_crop_DRIVE.py, strided_crop_STARE.py or strided_crop_CHASE.py file.
python3 strided_crop_DRIVE.py --input_dim=128 --stride=32
  • There are different flags to choose from. Not all of them are mandatory.
    '--input_dim', type=int, default=128
    '--stride', type=int, default=32

NPZ file conversion

  • Convert all the images to npz format using convert_npz_DRIVE.py, convert_npz_STARE.py or convert_npz_CHASE.py file.
python3 convert_npz_DRIVE.py --input_dim=(128,128) --n_crops=210 --outfile_name='DRIVE'
  • There are different flags to choose from. Not all of them are mandatory.
    '--input_dim', type=int, default=(128,128)
    '--n_crops', type=int, default=210
    '--outfile_name', type=str, default='DRIVE'

Training

  • Type this in terminal to run the train.py file
python3 train.py --npz_file=DRIVE --batch=4 --epochs=200 --savedir=RVGAN --resume_training=no --inner_weight=0.5
  • There are different flags to choose from. Not all of them are mandatory
   '--npz_file', type=str, default='DRIVE.npz', help='path/to/npz/file'
   '--batch_size', type=int, default=24
   '--input_dim', type=int, default=128
   '--epochs', type=int, default=200
   '--savedir', type=str, required=False, help='path/to/save_directory',default='RVGAN'
   '--resume_training', type=str, required=False,  default='no', choices=['yes','no']
   '--inner_weight', type=float, default=0.5

Pretrained Weights

https://drive.google.com/drive/folders/1GxUzvFaLdeMtKIAeegswznLQzc4T7NZS?usp=sharing

Inference

  • Type this in terminal to run the infer.py file
python3 infer.py --test_data=DRIVE --out_dir=test --weight_name_global=global_model_100.h5 --weight_name_local=local_model_100.h5 --stride=3 
  • There are different flags to choose from. Not all of them are mandatory
    '--test_data', type=str, default='DRIVE', required=True, choices=['DRIVE','CHASE','STARE']
    '--out_dir', type=str, default='pred', required=False)
    '--weight_name_global',type=str, help='path/to/global/weight/.h5 file', required=True
    '--weight_name_local',type=str, help='path/to/local/weight/.h5 file', required=True
    '--stride', type=int, default=3, help='For faster inference use stride 16/32, for better result use stride 3.'

Evaluation on test set

  • Type this in terminal to run the infer.py file
python3 eval.py --test_data=DRIVE --weight_name_global=global_model_100.h5 --weight_name_local=local_model_100.h5 --stride=3 
  • There are different flags to choose from. Not all of them are mandatory
    '--test_data', type=str, default='DRIVE', required=True, choices=['DRIVE','CHASE','STARE']
    '--weight_name_global',type=str, help='path/to/global/weight/.h5 file', required=True
    '--weight_name_local',type=str, help='path/to/local/weight/.h5 file', required=True
    '--stride', type=int, default=3, help='For faster inference use stride 16/32, for better result use stride 3.'

License

The code is released under the BSD 3-Clause License, you can read the license file included in the repository for details.

rvgan's People

Contributors

sharifamit 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

Watchers

 avatar  avatar

rvgan's Issues

need help!

Hello! can you send me your generated dataset npz file? I can't generate is using your code

Hi~

I try to do your work,but meet a bug.
03000ae4a968fc3b9ded2c3f3859ed4
22a7fb94e3a7319d711d6881d25c0e9
2e5832eb14769d749ec282c29f0c718
My tensorflow is 2.7.4 and keras is 2.7.0. I don't know what whould I do.

Question

When I run train.py, I found the loss is 'nan' at behind of 2-epochs. Do you have this problem when you train. So I want to know why is it and how to solve this problem.

Warning while training

Hi,
When I am training the model with the newer version of tf2.6, I got this warning message:
2021-10-22 14-03-18 的屏幕截图
But my training seems goes well, don't know if this is a bug.

How to determine the best model

Hi!Thank you for your work!
I'm a little confused that you said,we should looped over all 100 saved weights to find the best performing coarse and fine generator pairs and train again.Which data do we use to determine the best model?

pretrained model of chase can't be loaded

Hello, the pretrained model of CHASE can't be loaded. Error message is
ValueError: Shapes (7, 7, 4, 128) and (64, 4, 7, 7) are incompatible.

In addition, could you provide the trained model?
I have tried many times, but I can't get the f1 score near which descaribed in the paper.
Until now, the best F1 score trained on drive is 0.78, Se is 0.74. The results on STARE is better(f1=0.8030 Se=0.8191). The training process is time-consuming(I use a card of 2080ti).

Question about loss decline

May I ask what kind of value range will your losses eventually stabilize in, including d1, d2, ect?
The value g_local loss has remained steady at about 3 when I try to train the Drive Dataset from 18 to 200 epochs.
I wonder what's the reason for that

libtiff error

Hi
when i run infer.py, an error occurred. I had installed libtiff,
Traceback (most recent call last):
File "infer.py", line 7, in
from libtiff import TIFF
File "/home/miniconda3/envs/gwc_test/lib/python3.6/site-packages/libtiff/init.py", line 23, in
from .libtiff_ctypes import libtiff, TIFF, TIFF3D # noqa: F401
File "/home/miniconda3/envs/gwc_test/lib/python3.6/site-packages/libtiff/libtiff_ctypes.py", line 128, in
value = eval(value)
File "", line 1
\

looking forward to your reply
best wishes

datasets

Could you provide the data set of npz format or provide preprocessed code?

local_plot predictions always blank

I am trying to train the DRIVE data with RVGAN-tf-2.6. An issue I'm finding is the predictions in local_plot are always blank even after 53 epochs of training which took over 20 hours:

local_plot_000053
local_plot_000053.png

The global_plot though is visible
global_plot_000053
global_plot_000053.png

I am trying to reproduce eval.py IOU values but the predictions are always blank and looks like it is because predictions from g_local_model are always blank though not from g_global_model

Some questions about the paper and code

I have read your paper and run your code on my computer. I found some issues.

  1. SFA block written in the code is different from which described in the paper. It's short of a input added to the terminal output.
  2. Discriminator Residual Block described in the paper is not used in your code. In the code, Discriminator Residual Block just outputs two times of input.
    And i have a question.
    Is the network in the code no need to modify identical with which in the paper?
    Look forward to your reply!

Are there pretrained model weights available?

Hi, great stuff here, really interesting approach!

Are there pre-trained models weights available somewhere? I have an application in mind that I would love to use them for, would be citing your paper.

Killed error

Hi,

I got this error. I tried to drop batch size, it didn't work.

Screenshot from 2022-03-08 09-38-25

System features as below:
Screenshot from 2022-03-08 09-40-00

Thank you

the generation of the final output image

The paper descire the model and training skill very well in detail, but it seems to forget to describe the generation of the final output image. How do you use the results from Gf and Gc to predict an image?

length error!

Hi, I got this error running train.py using DRIVE dataset in Colab:

Traceback (most recent call last):
File "/content/drive/MyDrive/RVGAN-master/train.py", line 215, in
train(d_model1, d_model2,g_model_coarse, g_model_fine, rvgan_model, dataset, n_epochs=args.epochs, n_batch=args.batch_size, n_patch=[128,64],savedir=args.savedir)
File "/content/drive/MyDrive/RVGAN-master/train.py", line 100, in train
g_global_loss,_ = g_global_model.train_on_batch([X_realA_half,X_realB_half], [X_realC_half])

ValueError: The two structures don't have the same sequence length. Input structure has length 1, while shallow structure has length 2.

Would you help me to fix it?

Hello!

1667311930327
I meet i problem. I don't understand you how to solve the data number is small,and how to get the number 4320 for STARE、15120 for CHASE-DB1、4200 for DRIVE .can you explain it? or send me your preprocess datasets. Thanks!!!

Inference time

Hi,
I noticed that in your paper the inference time for each image is 0.025 second, is that for patch image or the whole image?

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.