U-Net meets ophthalmology: pixel-perfect retina vessel tracing
A reproducible Keras implementation that segments blood vessels in fundus images by training on 48×48 patches and averaging overlapping predictions at test time.

What it does This repo implements a U-Net-derived CNN for binary segmentation of blood vessels in retinal fundus images. It trains on 190,000 random 48×48 patches extracted from the 20-image DRIVE training set, then predicts vessel probability per pixel by averaging overlapping patch predictions at test time. The code is built on Keras 1.1.0 with either Theano or TensorFlow backend.
The interesting bit The training deliberately includes patches that spill outside the Field of View, so the network learns to distinguish FOV borders from actual vessels rather than treating the mask as a hard constraint. At inference, a stride-5 sliding window with probability averaging acts as a poor man’s ensembling without extra model parameters.
Key highlights
- Achieves 0.9790 AUC ROC on DRIVE, matching Liskowski et al. (with a note that FOV definitions differ)
- Also evaluated on STARE dataset using leave-one-out cross-validation
- Full reproduction pipeline: data preparation, training, testing, and visualization scripts included
- Saves both best-validation and final-epoch weights; configuration via plain text file
- ~20 hours training on a GeForce GTX TITAN GPU
Caveats
- Locked to Keras 1.1.0 era: requires
"image_dim_ordering": "th"in keras.json and dependencies from 2016 - No data augmentation beyond random patch extraction; the README explicitly notes this as a deliberate choice
- DRIVE dataset must be downloaded separately and folder structure must match exactly
Verdict Worth studying if you need a clean, reproducible medical segmentation baseline or want to understand patch-based training strategies. Skip if you need modern Keras/TensorFlow 2.x code out of the box—this is a research snapshot, not a maintained library.