Built to order

Retinal Vessel Segmentation using U-Net

A retinal blood-vessel segmentation system that trains a U-Net to separate vessels from background in fundus photographs, using the public DRIVE dataset (40 expert-annotated images) with STARE for cross-dataset checks. Training runs on 48x48 patches with BCE+Dice loss, CLAHE and augmentation, and the notebook logs Dice coefficient, IoU, sensitivity and specificity per epoch. A segmentation viewer renders the probability map with a live threshold slider, overlay and ground-truth comparison. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Biomedical streams.

Retinal Vessel Segmentation using U-Net — project thumbnail preview
More project photos (2)

The problem

The retinal vessel tree is one of the few places vasculature can be photographed directly, and its shape carries early signatures of diabetic retinopathy, glaucoma and hypertension. Tracing those vessels by hand — the gold standard for training data — takes an expert close to two hours per image, which is why automated segmentation matters. The DRIVE dataset (40 fundus images with expert vessel tracings, Staal et al., 2004) is the field's standard benchmark, and U-Net (Ronneberger et al., 2015) remains the reference approach: an encoder-decoder whose skip connections preserve the fine detail thin capillaries demand. This project implements that pipeline: green-channel extraction, CLAHE, patch-based training on the 20 training images, a BCE+Dice loss for the 10:1 class imbalance, and evaluation with Dice, IoU, sensitivity and specificity. A viewer makes outputs inspectable: probability maps, threshold slider, overlays and ground-truth comparisons, with an honest error analysis of missed vessel calibers.

How it works

  1. DRIVE fundus images (565x584) are preprocessed: green channel extracted, CLAHE applied, field-of-view mask computed.
  2. 48x48 patches are sampled from the 20 training images with augmentation (rotations, flips, elastic deformation, gamma jitter).
  3. A U-Net (encoder-decoder with skip connections) is trained with a combined binary-cross-entropy + Dice loss under the Adam optimizer for ~60 epochs.
  4. Dice coefficient, IoU, sensitivity and specificity are logged per epoch on a validation split; the best checkpoint is kept.
  5. The trained model segments the 20 DRIVE test images patch-wise; predictions are stitched, thresholded at 0.5 and evaluated against the expert manual tracings.
  6. The viewer application loads test images and predictions, rendering probability maps, threshold-controlled overlays and ground-truth comparisons.

Tech stack:

  • Python 3.10, PyTorch (U-Net, training loop, patch inference)
  • OpenCV (green channel, CLAHE, mask handling)
  • NumPy (patch extraction, metric computation)
  • Matplotlib (training curves, prediction visualizations)
  • Jupyter notebook (buyer-run training and evaluation)
  • HTML/CSS/JS viewer (probability maps, threshold slider, overlays)
Parameter Value
Dataset DRIVE: 40 fundus images 565x584, 20 train / 20 test, expert manual segmentations
Cross-dataset STARE: 20 images 700x605, leave-one-out evaluation
Model U-Net (encoder-decoder with skip connections), single-channel input
Design target ~0.79 Dice on the DRIVE test split; final numbers measured by the notebook on your build
Evaluation Dice, IoU, sensitivity, specificity, ROC-AUC — per epoch and on test
Training 60 epochs, Adam 1e-3, 48x48 patches, BCE+Dice loss
Preprocessing Green channel + CLAHE + augmentation (rotation, flip, elastic, gamma)
Output Binary vessel mask, probability map, overlay visualizations

Project features

  • [U-Net implementation] Encoder-decoder with skip connections in PyTorch, built for single-channel fundus input and binary vessel output
  • [Patch-based training] 48x48 random patches (10k per epoch) so 20 DRIVE training images become a viable training set
  • [Combined BCE+Dice loss] Handles the ~10:1 background-to-vessel pixel imbalance that plain cross-entropy mishandles
  • [Documented preprocessing] Green-channel extraction plus CLAHE contrast enhancement — the standard, cited DRIVE preprocessing recipe
  • [Full segmentation metrics] Dice coefficient, IoU, sensitivity, specificity and ROC-AUC logged per epoch and computed on the 20-image test split
  • [Segmentation viewer] Probability map, live threshold slider, vessel overlay and ground-truth-vs-prediction comparison on test images
  • [Augmentation pipeline] Rotations, flips, elastic deformation and gamma jitter to stretch the small training set
  • [Cross-dataset check] STARE evaluation measuring how the DRIVE-trained model transfers — the honest generalization test

What is included

  • Complete source code (U-Net, data pipeline, training, patch inference, evaluation, viewer)
  • Jupyter training and evaluation notebook (buyer-run: trains on your GPU/CPU and logs all metrics)
  • Project report PDF (background, U-Net architecture, methodology, results, error analysis)
  • PPT presentation for final review
  • Viva Q&A preparation document (U-Net, Dice loss, patch training, segmentation metrics, DRIVE/STARE)
  • Setup guide (environment, dataset download, training, running the viewer)

Limitations & prerequisites

  • This is an academic research prototype, not a medical device: it must not be used for diagnosis, screening or clinical decisions, and the viewer carries that disclaimer visibly.
  • Twenty training images is a tiny dataset — augmentation and patch training stretch it, but the model memorizes DRIVE's imaging conditions and transfers worse to STARE; the notebook measures that drop openly.
  • Thin capillaries and low-contrast vessel segments are where most errors concentrate; the report's error analysis breaks misses down by vessel caliber.
  • Pathological regions (hemorrhages, exudates) confuse the model because DRIVE contains few of them — STARE is the harder, more honest test set.
  • Training a U-Net needs a GPU for reasonable turnaround; CPU training works but is slow, and the setup guide gives realistic time estimates.
  • The browser viewer renders synthetic retina-style images with a simulated model output; real DRIVE inference runs in the notebook.

Frequently Asked Questions

Which datasets are used?

DRIVE (Staal et al., 2004): 40 color fundus photographs at 565x584 with expert manual vessel segmentations, split 20/20 for train/test. STARE (Hoover et al., 2000): 20 images at 700x605 used for cross-dataset generalization checks.

Why U-Net and not a newer architecture?

U-Net is the reference architecture for this exact benchmark — its skip connections preserve the fine spatial detail that thin vessels need, and two decades of DRIVE literature give the student a solid baseline to compare against. The report discusses newer variants as future scope.

Is the Dice score guaranteed?

No. The design target is around 0.79 Dice on the DRIVE test split, but the report documents whatever the notebook measures on your build — training curves, final metrics and the STARE transfer result included.

Can it segment vessels in my own eye photos?

Not reliably. The model is trained on DRIVE's specific camera, resolution and field of view; phone photos or other cameras shift the distribution and the report documents this limitation explicitly.

Is this a medical diagnosis tool?

No. It is an educational computer-vision prototype on public research data and must not be used for diagnosis or clinical decisions.

What will I receive with the project?

Complete source code, the training and evaluation notebook, the segmentation viewer, project report PDF, PPT presentation, viva Q&A document and a setup guide. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Biomedical Engineering.

Components & software requirements
  • Python 3.10, PyTorch (U-Net, training loop, patch inference)
  • OpenCV (green channel, CLAHE, mask handling)
  • NumPy (patch extraction, metric computation)
  • Matplotlib (training curves, prediction visualizations)
  • Jupyter notebook (buyer-run training and evaluation)
  • HTML/CSS/JS viewer (probability maps, threshold slider, overlays)
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation