• Stars
    star
    232
  • Rank 172,847 (Top 4 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tensorflow implementation of "Retinal Vessel Segmentation in Fundoscopic Images with Generative Adversarial Networks"

V-GAN in Tensorflow

This repository is Tensorflow implementation of Retinal Vessel Segmentation in Fundoscopic Images with Generative Adversarial Networks. The referenced keras code can be found here.

figure01

Improvements Compared to Keras Code

  1. Data augmentation is changed from off-line to online process, it solved memory limitation problem but it will slow down the training
  2. Add train_interval FLAGS to control training iterations between generator and discriminator, for normal GAN train_interval is 1
  3. The best model is saved based on the sum of the AUC_PR and AUC_ROC on validation data
  4. Add sampling function to check generated results to know what's going on
  5. Measurements are plotted on tensorboard in training process
  6. The code is written more structurally
    Area Under the Curve (AUC), Precision and Recall (PR), Receiver Operating Characteristic (ROC)

Package Dependency

  • tensorflow 1.6.0
  • python 3.5.3
  • numpy 1.14.2
  • matplotlib 2.0.2
  • pillow 5.0.0
  • scikit-image 0.13.0
  • scikit-learn 0.19.0
  • scipy 0.19.0

Download Data

Original data file strucure was modified for convenience by Jaemin Son.
Download data from here and copy data file in the same directory with codes file as following Directory Hierarchy.

Directory Hierarchy

.
β”œβ”€β”€ codes
β”‚   β”œβ”€β”€ dataset.py
β”‚   β”œβ”€β”€ evaluation.py
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ model.py
β”‚   β”œβ”€β”€ solver.py
β”‚   β”œβ”€β”€ TensorFlow_utils.py
β”‚   β”œβ”€β”€ utils.py
β”œβ”€β”€ data
β”‚   β”œβ”€β”€ DRIVE
β”‚   └── STARE
β”œβ”€β”€ evaluation (get after running evaluation.py)
β”‚   β”œβ”€β”€ DRIVE
β”‚   └── STARE
β”œβ”€β”€ results
β”‚   β”œβ”€β”€ DRIVE
β”‚   └── STARE

codes: source codes
data: original data. File hierarchy is modified for convenience.
evaluation: quantitative and qualitative evaluation. (get after running evaluation.py)
results: results of other methods. These image files are retrieved from here.

Training

Move to codes folder and run main.py

python main.py --train_interval=<int> --ratio_gan2seg=<int> --gpu_index=<int> --discriminator=[pixel|patch1|patch2|image] --batch_size=<int> --dataset=[DRIVE|STARE] --is_test=False
  • models will be saved in './codes/{}/model_{}_{}_{}'.format(dataset, disriminator, train_interval, batch_size)' folder, e.g., './codes/STARE/model_image_100_1' folder.
  • smapled images will be saved in './codes/{}/sample__{}_{}_{}'.format(dataset, disriminator, train_interval, batch_size)', e.g., './codes/STARE/sample_image_100_1' folder.

Arguments

train_interval: training interval between discriminator and generator, default: 1
ratio_gan2seg: ratio of gan loss to seg loss, default: 10
gpu_index: gpu index, default: 0
discriminator: type of discriminator [pixel|patch1|patch2|image], default: image
batch_size: batch size, default: 1
dataset: dataset name [DRIVE|STARE], default: STARE
is_test: set mode, default: False

learning_rate: initial learning rate for Adam, default: 2e-4
beta1: momentum term of Adam, default: 0.5
iters: number of iterations, default: 50000
print_freq: print loss information frequency, default: 100
eval_freq: evaluation frequency on validation data, default: 500
sample_freq: sample generated image frequency, default: 200

checkpoint_dir: models are saved here, default: './checkpoints'
sample_dir: sampled images are saved here, default: './sample'
test_dir: test images are saved here, default: './test'

Test

python main.py --is_test=True --discriminator=[pixel|patch1|patch2|image] --batch_size=<int> --dataset=[DRIVE|STARE]
  • Outputs of inferece are generated in 'seg_result_{}_{}_{}'.format(discriminator, train_interval, batch_size) folder, e.g., './codes/STARE/seg_result_image_100_1' folder.
  • Make sure model already trained with defined dataset, discriminator, training interval, and batch size.

Evaluation

Note: Copy predicted vessel images to the ./results/[DRIVE|STARE]/V-GAN folder

python evaluation.py

Results are generated in evaluation folder. Hierarchy of the folder is

.
β”œβ”€β”€ DRIVE
β”‚   β”œβ”€β”€ comparison
β”‚   β”œβ”€β”€ measures
β”‚   └── vessels
└── STARE
    β”œβ”€β”€ comparison
    β”œβ”€β”€ measures
    └── vessels

comparison: difference maps between V-GAN and gold standard
measures: AUC_ROC and AUC_PR curves
vessels: vessels superimposed on segmented masks
Area Under the Curve (AUC), Precision and Recall (PR), Receiver Operating Characteristic (ROC)

DRIVE Results

picture1

STARE Results

picture2

Difference Maps

DRIVE (top), STARE (bottom)
Green marks correct segmentation while blue and red indicate false positive and false negative picture3 picture4

DRIVE Dataset

train_interval Model AUC_ROC AUC_PR Dice_coeff
1 Pixel GAN 0.9049 0.8033 0.3020
1 Patch GAN-1 (10x10) 0.9487 0.8431 0.7469
1 Patch GAN-2 (80x80) 0.9408 0.8257 0.7478
1 Image GAN 0.9280 0.8241 0.7839
100 Pixel GAN 0.9298 0.8228 0.7766
100 Patch GAN-1 (10x10) 0.9263 0.8159 0.7319
100 patch GAN-2 (80x80) 0.9312 0.8373 0.7520
100 Image GAN 0.9210 0.7883 0.7168
10000 Pixel GAN 0.9353 0.8692 0.7928
10000 Patch GAN-1 (10x10) 0.9445 0.8680 0.7938
10000 patch GAN-2 (80x80) 0.9525 0.8752 0.7957
10000 Image GAN 0.9509 0.8537 0.7546

STARE Dataset

train_interval Model AUC_ROC AUC_PR Dice_coeff
1 Pixel GAN 0.9368 0.8354 0.8063
1 Patch GAN-1 (10x10) 0.9119 0.7199 0.6607
1 Patch GAN-2 (80x80) 0.9053 0.7998 0.7902
1 Image GAN 0.9074 0.7452 0.7198
100 Pixel GAN 0.8874 0.7056 0.6616
100 Patch GAN-1 (10x10) 0.8787 0.6858 0.6432
100 patch GAN-2 (80x80) 0.9306 0.8066 0.7321
100 Image GAN 0.9099 0.7785 0.7117
10000 Pixel GAN 0.9317 0.8255 0.8107
10000 Patch GAN-1 (10x10) 0.9318 0.8378 0.8087
10000 patch GAN-2 (80x80) 0.9604 0.8600 0.7867
10000 Image GAN 0.9283 0.8395 0.8001

Note:

  • Set higher training intervals between generator and discriminator, which can boost performance a little bit as paper mentioned. However, the mathematical theory behind this experimental results is not clear.
  • The performance of V-GAN Tensorflow implementation has a gap compared with paper. Without fully fine-tuning and subtle difference in implementations may be the reasons.

Architectures

  • Generator:

  • Discriminator(Pixel):

  • Discriminator(Patch-1):

  • Discriminator(Patch-2):

  • Discriminator(Image):

Tensorboard

AUC_ROC, AUC_PR, Dice_Coefficient, Accuracy, Sensitivity, and Specificity on validation dataset during training iterations Β 

  • AUC_ROC:

  • AUC_PR:

  • Dice_Coeffcient:

  • Accuracy:

  • Sensitivity:

  • Specificity:

More Repositories

1

Real-time-style-transfer

Tensorflow implementation of Justin Johnson's paper, perceptual losses for real-time style transfer and super-resolution.
Python
123
star
2

MRI-to-CT-DCNN-TensorFlow

This repository is the implementations of the paper "MR-based Synthetic CT Generation using Deep Convolutional Neural Network Method," Medical Physics 2017.
Python
101
star
3

semantic-image-inpainting

Tensorflow implementation of Semantic Image Inpainting with Deep Generative Models
Python
78
star
4

WGAN-GP-tensorflow

WGAN-GP tensorflow implementation
Python
72
star
5

WGAN-TensorFlow

Wasserstein GAN TensorFlow Implementation
Python
44
star
6

SpineC2M

This repository includes Spine data based CT to MR image synthesis
Python
40
star
7

Fast-Tracking-by-Detection

This repository includes fast tracking by detection method based on SSD detector and multiple Kalman tracker.
Python
32
star
8

MRGAN-TensorFlow

This repository is the implementation of the CT to MR synthesis using TensorFlow
Python
29
star
9

ActionViewer

ICVL Action Dataset Viewer
Python
26
star
10

VAE-Tensorflow

Variational Autoencoder Tensorflow Implementation
Python
24
star
11

License_plate_recognition

This repository supplies some functions for License Plate Recognition (LPR) project.
Python
15
star
12

VanillaGAN-TensorFlow

Vanilla GAN TensorFlow Implementation
Python
14
star
13

pix2pix-tensorflow

pix2pix TensorFlow Implementation
Python
13
star
14

U-Net-TensorFlow

TensorFlow implementation of the U-Net.
Python
12
star
15

PytorchZeroToAll

It's the pytorch practice following Sung Kim's Tutorial
Python
11
star
16

DCGAN-TensorFlow

DCGAN TensorFlow Implementation
Python
11
star
17

GANFromAtoZ

This repository reimplements all kinds of published GAN
Python
11
star
18

LaTex-beginner-lecture

This repository follows [κΆŒν˜„μš°](https://www.youtube.com/watch?v=V1Q6vEuoAQ0&list=PLSS68lwkeqyOH6KEHpCAmCWVSSKbciz3A) LaTex Tutorial.
TeX
11
star
19

Latex_Michelle

LaTeX tutorial using Texmaker. This repository follows [Michelle Krummel's Tutorial](https://www.youtube.com/watch?v=SoDv0qhyysQ&list=PL1D4EAB31D3EBC449&index=1).
TeX
10
star
20

LatexBible

Latex Bible Book Exercise
TeX
10
star
21

Tactile-Sensor

Tactile Sensor Project
Python
10
star
22

deep-neural-network-for-visual-recognition

This repository includes lecture materials of the class, Deep Neural Network for Visual Recognition.
10
star
23

Latex-Resume-Tutorial

This repository follows Luke Smith's Latex Resume Tutorial.
TeX
9
star
24

Python-Exercise

Python library exercise
Jupyter Notebook
9
star
25

DiscoGAN-TensorFlow

DiscoGAN TensorFlow Implementation
Jupyter Notebook
9
star
26

pixelrnn-tensorflow

PixelRNN Tensorflow Implementation
Python
9
star
27

Papers-Category

It's the repository for collecting papers that I read and category them according to the different objectives.
9
star
28

IrisGAN-TensorFlow

TensorFlow Implementation of Iris Synthesis using GAN
Python
8
star
29

Tensorflow-SungKim

This repository is tensorflow tutorial from Sung Kim's λͺ¨λ‘λ₯Ό μœ„ν•œ λ”₯λŸ¬λ‹.
Python
8
star
30

TensorFlow-Exercise

This repository includes some test codes for tf_record, tf.train, tf.data and so on
Python
8
star
31

GitExample

Git μ—°μŠ΅μš© λ ˆν¬μ§€ν† λ¦¬
Python
8
star
32

Face-Editing-Collection

This repository is a collection of the face editing papers and projects.
7
star
33

Pydicom-exercise

This repository include exercise codes using pydicom
Python
7
star
34

d-Fingerprint-Generation

Deterministic fingerprint generation
Python
7
star
35

Semantic-Eye-Segmentation

TensorFlow Implementation of the Synthetic Eye Generation
Python
7
star
36

Hvass-Laboratory-Tensorflow

This repository follows Hvass Laboratory's Tensorflow Tutorial.
Python
7
star
37

Adam-Analysis-TensorFlow

This repository analyzes the performance of Adam optimizer while comparing with others.
Python
6
star
38

Semi-supervised-semantic-segmentation

Semi-supervised Semantic Eye Segmentation in TensorFlow
Python
6
star
39

TensorFlow2.0-Tutorial

This repository includes the example codes using TensorFlow2.0
Python
6
star
40

Python-Libraries

collected various API functions
Python
5
star
41

image-animation

Implementations of MonkeyNet, FOMM and MRAA
Python
5
star
42

Synthetic-Eye-Generation

TensorFlow Implementation for the Synthetic-Eye-Generation
Python
5
star
43

TensorFlow-Tutorials-Weihai

TensorFlow Tutorials for Shandon University (Weihai)
Python
5
star
44

Support-Vector-Machine-Python

This repository is a study to deeply understand the theory of SVM.
Jupyter Notebook
4
star
45

leetcode

Solutions for Leetcode
Jupyter Notebook
4
star
46

BrainC2MusingDC2Anet

Brain CT to MR Synthesis using DC2Anet
Python
4
star
47

Lua-Basic-Tutorial

This repository for the Lua basic tutorial following John Sonmez
Lua
3
star
48

ChengBinJin

2
star
49

DirectX-Tutorial

The repository includes C++ DirectX Tutorials
C++
2
star
50

StyleGANv2-Re-Implementation

This project is a re-implementation of the StyleGANv2 to study the coding style.
Python
2
star
51

AttGAN-TensorFlow

This repository is for tensorflow implementation of the AttGAN
Python
2
star
52

Python-Toolbox

Python toolboxes that inludes basic python operations, opencv, tensorflow and pytorch and so on
Python
2
star