Unsupervised Leaf Vein Segmentation
W-Net for Plant Phenotyping

Deep Learning - University of Tennessee
W-Net, Unsupervised Segmentation, PyTorch

Deep Learning (COSC 525) · University of Tennessee, Knoxville · USA

Unsupervised Image Segmentation for Plant Phenotyping

Training a W-Net to segment leaf veins from over 14,000 leaf scans, without a single hand-labeled pixel.

Deep Learning University of Tennessee United States
PyTorch W-Net U-Net Soft N-Cut Loss Unsupervised Learning

Authors: Hashan Fernando, Peter Kruse

Additional Resources: Paper (PDF) · Git Repository

Plant phenotyping, measuring and characterizing a plant's expressed traits, is a bottleneck in genetic and breeding research precisely because it's so manual. Leaf vein segmentation is a good example: understanding how veins respond to drought or other treatments requires isolating vein pixels from the rest of the leaf, but the deep learning models that do this well are almost all supervised, and hand-labeling veins at the pixel level across thousands of high-resolution leaf scans is exactly the kind of tedious, expensive process phenotyping is trying to escape.

This project trains a W-Net, an unsupervised segmentation architecture that pairs two U-Nets in an encoder-decoder loop, to segment leaf veins with no labeled training data at all. The encoder produces a pixel-wise segmentation map directly from an RGB leaf image; the decoder reconstructs the original image from that map. Training balances two loss functions: soft normalized cut loss, which pushes the encoder toward coherent segment boundaries, and reconstruction loss, which keeps those segments faithful to the original image. We trained and evaluated it on over 14,000 scanned leaf images from a UC Davis plantation, with preliminary testing on an open Ficus Religiosa ("Pimpal") leaf dataset, and compared results against a state-of-the-art supervised vein-segmentation baseline.

Methodology

From leaf scan to segmentation map

Four stages take a full-resolution leaf scan to a learned vein segmentation, with no labels involved in training.

01

Tiling & Filtering

Leaf scans (3510×2550 px) are too large to fit in memory, so each is split into 224×224 tiles. Tiles that are more than 10% white background pixels are dropped, keeping the model focused on actual leaf structure.

02

W-Net Architecture

Two symmetric U-Nets, nine convolutional blocks each, with skip connections between matching contractive and expansive layers, form an encoder (Uenc) that segments and a decoder (Udec) that reconstructs from that segmentation.

03

Dual-Loss Training

Each batch is optimized in two steps: soft normalized cut loss shapes the encoder's segmentation quality, then reconstruction loss (comparing Udec's output to the original tile) is minimized across the full network; no ground-truth labels required either time.

04

Postprocessing & Evaluation

Predicted tiles are reassembled by their saved grid index into a full-leaf segmentation map, then compared pixel-wise against eight manually labeled test leaves and against a supervised segmentation baseline.

Pipeline Overview

The full pipeline, end to end

Built With

Tools & Stack

PyTorch W-Net U-Net Soft N-Cut Loss Stochastic Gradient Descent Few-Shot Learning ORNL DGX Cluster
Results

What the model actually learned

Tested first on an open leaf dataset, then on 14,000 UC Davis scans, with an eye toward where an unsupervised approach breaks down.

Squeeze Parameter (k)

How many segmentation classes best separate veins from leaf body?

The squeeze parameter k controls how many classes the encoder's output layer predicts. We compared k=2 (vein vs. non-vein) against k=64 on identical leaf tiles.

Solution

k=2 produced the clearest, most interpretable vein segmentations. k=64 could still pick out major veins, but the leaf body and finer veins came out noisy, so every later experiment used k=2.

Full-Leaf Generalization

Does a model trained on 224×224 tiles hold together when reassembled into a full leaf?

Individual tiles trained well in isolation, but a full leaf image requires hundreds of independently-classified tiles to agree with each other at their shared borders.

Solution

The reassembled maps clearly capture major veins and the leaf-body boundary, but tile-to-tile vein continuity breaks down, blank background tiles pick up spurious borders, and discolored or unhealthy leaf regions get segmented as if they were veins, the model was learning texture contrast in general, not veins specifically.

We were genuinely impressed that W-Net could learn coherent vein structure with zero labeled pixels, but it isn't yet a replacement for supervised, state-of-the-art vein segmentation. The clearest next steps: incorporating principal curvature analysis to enforce vein continuity, switching to a loss function better suited to tiled high-resolution inputs, and testing whether adjusting k further could help the model separate damaged or discolored leaf regions from true veins instead of confusing the two.

Gallery

Figures