Lobelia Silhouettes

Automating leaf-trait extraction from digitized herbarium specimens of Lobelia sect. Lobelia.

TL;DR. Herbaria hold hundreds of millions of pressed plants, and almost every measurable trait on them is locked inside a photograph. This project asked whether that measurement could be automated for one clade — Lobelia sect. Lobelia, 23 eastern North American wildflowers — by pairing aggregator-scale specimen acquisition with instance segmentation. It reached a working two-stage detection-then-segmentation pipeline over a hand-audited corpus of 2,733 specimen images, and ran headlong into the reason this problem is still open: a rosette does not decompose into leaves the way a model expects it to.
💻 Code on GitHub 🌿 GBIF download DOI
On this page: The data is already collected · Acquisition · The long tail · The diversity · Does outline identify a species? · The pipeline · Dismembered sheets · What didn't work · Status
A row of dark plant silhouettes on a pale background, each a whole Lobelia specimen showing a slender flowering stem, scattered leaves and a root mass at the base.
Whole-plant silhouettes recovered from digitized herbarium sheets of _Lobelia_ sect. _Lobelia_. Each outline is a single pressed specimen — flowering stem, leaves and roots — reduced to the shape that morphometrics can actually measure.

This was my undergraduate research at Kent State University, advised by Dr. Andrea Case in the Department of Biological Sciences. The proposal is dated December 2021, and the work ran through 2022 with a final data pull in early 2024. It sat inside a larger NSF-funded programme — BEE: Ecological and evolutionary processes affecting the co-existence of close relatives (DEB-2015606, Case at Kent State; collaborative with Lynda Delph at Indiana and Nico Cellinese at Florida) — which uses Lobelia sect. Lobelia as a model for why closely related species do or don’t manage to live alongside each other. My piece of it was the phenotype side: getting trait data out of herbarium sheets without measuring every one by hand.

The data is already collected

The argument for this work is that the specimens already exist. Centuries of botanists have pressed, mounted and labelled plants, and digitization programmes have since photographed a large fraction of them and put the images behind public APIs. What has not happened is the measurement. A sheet photographed at 5100 × 3500 px contains leaf areas, blade widths, petiole dimensions, stem thickness and phenology — all of it visible, essentially none of it in a database.

Lobelia sect. Lobelia is a good test case precisely because it is awkward. The clade spans 23 species with real morphological range, from the tall red-flowered L. cardinalis to the small aquatic L. dortmanna, and several of them grow as basal rosettes. Most published herbarium-vision work targets plants with clearly separated, planar leaves on a stem. A rosette pressed flat is a pile of overlapping blades radiating from one point, and the whole difficulty of the project is downstream of that fact.

Acquisition was the first real problem

Before any model could be trained, the corpus had to be assembled and audited. Records came from GBIF, SERNEC, iDigBio and the Kent State herbarium, filtered to preserved specimens with coordinates, no flagged geospatial issues, and an attached still image.

The tedious part was that aggregators return duplicates: the same physical sheet surfaces repeatedly under one gbifID, sometimes with several images of differing usefulness. Each species was reconciled by hand — duplicates identified, the most representative image kept, broken links purged, and every deletion logged with its reasoning in a per-species ledger.

That ledger survives, and it is the most honest description of the dataset:

stage count
species accounted for 23
occurrence records screened 2,906
specimen images retained 2,733
Totals are over the 20 of 23 species tabs whose ledger entries are complete on both ends. Three tabs are unfinished — batsonii was never tallied, and inflata and siphilitica record their intake but not a final figure — so the true corpus is larger than 2,733, not smaller. Records were retrieved 2022-01-14.

A later, narrower pull for L. siphilitica alone is permanently citable, since GBIF mints a DOI for every download (GBIF.org, 2024)10.15468/dl.5gavr9, 452 preserved-specimen records across 19 institutional datasets, retrieved 2024-02-16.

The record is long-tailed

Splitting the retained images by species exposes something the project didn’t set out to find. Herbarium coverage of this clade is extremely uneven:

Specimen images retained per species, after de-duplication. Hover any point for the occurrence records screened and the share kept. Shown as points on a log axis rather than bars: the range spans three orders of magnitude, and bar length encodes value from a zero baseline that a log axis does not have. The same numbers are tabulated below.
species screened retained
L. cardinalis 899 811
L. spicata 484 468
L. kalmii 334 315
L. glandulosa 230 230
L. puberula 211 206
L. paludosa 129 127
L. feayana 123 122
L. nuttallii 116 115
L. dortmanna 151 111
L. homophylla 51 51
L. appendiculata 44 44
L. elongata 26 26
L. floridana 24 23
L. brevifolia 23 23
L. georgiana 20 20
L. canbyi 18 18
L. flaccidifolia 11 11
L. rogersii 9 9
L. gattingeri 2 2
L. apalachicolensis 1 1

Three orders of magnitude separate the best- and worst-sampled species — 811 sheets for L. cardinalis, a single usable one for L. apalachicolensis. Showy, common, widely cultivated plants get collected; narrow endemics do not. Any model trained on this corpus inherits that skew, and any trait comparison across the clade has to carry it as a caveat rather than average it away.

The diversity being measured

All of the above is machinery. This is the thing it exists to capture — the same extraction run across the clade, one representative leaf per species:

Nine black leaf silhouettes in a row, labelled by species, ranging from a very narrow linear blade for glandulosa to broad ovate blades for apalachicolensis and spicata.
A **composed montage**: one leaf per species, each taken from that species' own segmentation mask and **scaled to a common length**. It therefore compares _shape_, not size — absolute scale is deliberately not preserved. The range is the point: _L. glandulosa_ is nearly linear, _L. cardinalis_ falcate and tapering, _L. apalachicolensis_ and _L. spicata_ broad and blunt. Representative leaves were chosen by solidity rather than by size, because the largest connected component in a mask is frequently a stem fragment rather than a leaf.

Nine species, not ten. L. canbyi is absent because its only mask cannot supply a leaf: the largest component in it is 3,257 px at 0.55 solidity — a stem sliver — against 0.93–0.97 for a clean blade. That is a segmentation failure, and dropping the species is more honest than showing debris under its name.

Does outline alone identify a species?

Showing that the shapes differ is not the same as showing they separate. Every one of the 104 masks yields multiple leaves, so the question can be asked quantitatively: 486 leaves from 88 specimens across 8 species, each outline resampled to 128 equally spaced pseudo-landmarks, aligned, scaled to unit centroid size, and ordinated by PCA. This follows the same family of method as the Procrustes pseudo-landmark approach the Case lab later published for leaf shape.

Eight small scatter panels, one per species, each plotting PC1 against PC2 with that species highlighted in green against all 486 leaves in grey. L. glandulosa sits far left; L. apalachicolensis and L. inflata sit right.
Small multiples rather than one eight-colour scatter — in a scatter any two points can fall adjacent, so eight categorical hues would be asking the reader to discriminate colours that cannot be made reliably distinct. Grey is all 486 leaves; green is the named species. _L. glandulosa_ occupies the narrow-leaf extreme; _L. apalachicolensis_ and _L. inflata_ sit at the broad end.

PC1 carries 48% of shape variance and is almost exactly leaf breadth — its correlation with directly measured width-to-length is r = 0.978, so the axis is a checked quantity rather than a label I assigned by eye. Species order along it monotonically, from L. glandulosa at a width:length of 0.109 to L. apalachicolensis at 0.439.

That axis is also where the species signal lives, and essentially nowhere else:

  PC1 PC2
share of shape variance 48% 26%
between-species share of that axis (η²) 0.493 0.006

PC2 is real variation — it is just variation within plants, not between species.

Classifying species from outline alone, with cross-validation grouped by specimen so no leaf from a test plant is ever seen in training:

  accuracy
LDA, grouped by specimen 0.372
permuted-label null 0.166
majority-class baseline 0.191
LDA, naive split (leaves of one plant span train and test) 0.430

So outline alone runs at roughly twice chance — a real signal, and a modest one. The naive split scores 6 points higher, which is the size of the pseudo-replication illusion you get for free if you forget that ten leaves off one plant are not ten independent observations.

What this does not show. Sampling is uneven (93 leaves from puberula, 26 from inflata) and specimen counts more so (21 for glandulosa, 3 for apalachicolensis), so the per-species positions are not equally trustworthy. Absolute size is discarded by construction, and size is a real diagnostic character. Venation, margin dentition and pubescence — all of which a botanist uses — are not in an outline at all. L. cardinalis (3 leaves) and L. canbyi (no usable leaf) are excluded entirely.

The honest reading is that leaf outline is a weak-but-genuine species character in this clade, and that the automation was never going to identify species from shape alone. That is a useful thing to have measured rather than assumed.

The pipeline

Specimen sheets are large and mostly empty, which makes naive whole-image segmentation wasteful and imprecise. The workflow was therefore two-stage, built on GinJinn2 (a herbarium-oriented wrapper over Detectron2) with a Mask R-CNN R101-FPN backbone:

  1. Annotate. Training masks were drawn in CVAT and exported as COCO. Sheets were rescaled from 5100 × 3500 to 1200 × 800, with model inputs normalized to 256 × 256. Target was 500+ annotated images, split 60 / 20 / 20 into train / validation / test.
  2. Detect. Sheets were cut into 2048 px sliding windows with 512 px overlap so that individual leaves occupied a usable fraction of the frame. Bounding boxes were predicted per window, then merged back across window seams to reconstruct whole-sheet predictions.
  3. Crop. Merged boxes were cropped with padding (-p 25), turning one sheet into many single-leaf images.
  4. Segment. A separate instance-segmentation model ran on the crops, producing the per-leaf masks that the morphometrics depend on — and the silhouettes at the top of this page.

Splitting detection from segmentation matters: it lets the detector work at sheet scale, where context disambiguates a leaf from a label or a scale bar, while the segmentation model sees a tightly framed leaf and can spend its resolution on the margin, which is where the shape information actually lives.

The dismembered-sheet track

Running alongside the digital pipeline was a physical one, used both to generate clean training data and to provide ground truth. Specimens were dismembered, laid out and photographed, then processed under a fixed protocol: rotate every image in ImageJ so leaf tips face the same direction, record the 1 cm scale standard, and measure base-to-first-leaf, base-to-first-flower, and stem thickness at both the base and the first flower. Leaves too folded or damaged to read were excluded by explicit criterion rather than by eye.

What comes out the far end is a binary mask per specimen — every leaf reduced to an outline, ordered down the stem. This is the measurable object, and the thing the whole pipeline exists to produce:

Eight solid black leaf outlines from one Lobelia siphilitica specimen, arranged left to right from largest to smallest, each a smooth lance shape.
Segmentation output for one _L. siphilitica_ specimen (voucher AC17142): the full leaf series, largest to smallest. The size gradient down a single stem is real biological signal — and it is also why a per-plant average is a poor summary of leaf shape. Every quantity the project cared about (blade length, width, area, margin) is computable directly from outlines like these.

The masks also make plain why the workflow needed an explicit exclusion criterion rather than a trained eye:

Ten black leaf outlines from one Lobelia spicata specimen; several are visibly torn or truncated and one carries a hole through the middle of the blade.
The same output for _L. spicata_ (voucher AC17073), and a far less cooperative specimen. Several laminae are torn through or missing sections, and the leftmost carries a puncture straight through the blade. An area measured from any of these is wrong while looking perfectly valid in a spreadsheet — pressed material decades old is full of them, and no amount of segmentation accuracy fixes a leaf that is physically incomplete.

</div>

Leaf area then came from the LeafArea R package driving ImageJ, calibrated at 85 px/cm:

library(LeafArea)
run.ij(set.directory = ".../leafcrops",
       distance.pixel = 85,
       known.distance = 1,   # cm
       trim.pixel     = 0)

Orientation is the quiet constraint here. Nearly every leaf-morphometrics tool assumes leaves are aligned on a common axis, which is trivial for a dismembered specimen you photographed yourself and decidedly not trivial for an arbitrary herbarium sheet.

What didn’t work

The morphometrics tooling was surveyed before anything was committed to, and most of it did not survive contact with real specimens:

tool outcome
MorphoLeaf Needs single leaves on a clean, high-contrast, clutter-free background with uniform orientation. Herbarium sheets are none of those.
LeafJ (ImageJ) Failed to detect whole leaves on our samples; manual correction was more work than measuring by hand.
LeafMachine Promising, but MATLAB-licensed.
MASS Also MATLAB.
TraitEx Would not import our leaf images at all.
Morphidas Too little documentation to evaluate.

Two things are worth saying plainly. First, the binding constraint on this kind of work is rarely the model — it is that measurement tools assume an idealized input that digitized herbarium material never satisfies. Second, the rosette problem was never fully solved. Delineating individual leaves in a flattened rosette, where blades overlap and converge on a single point, remained the hard open edge of the project.

Status

This is completed undergraduate work, presented here as a record rather than as a maintained project. It was never written up for publication, and the pipeline is not packaged for reuse.

The code and the original workflow notes are now on GitHub at musharna/lobelia-silhouettes — the GBIF acquisition and Hough line-removal notebooks, the GinJinn2 and annotation commands, the dismembered-sheet protocol, the morphometrics tool survey, and the per-species acquisition ledger the counts on this page come from. Notebook outputs are stripped, and no specimen imagery is included: the raw sheets carry all-rights-reserved notices burned into the pixels regardless of the licence field on the aggregator record.

The wider programme it belonged to has since published its phylogenomic arm, under the same NSF awards (Godden et al., 2025).

Provenance. Specimen images are the property of their holding institutions and are used here under their respective terms; the GBIF download above is CC BY-NC 4.0. Counts on this page come from the project’s own acquisition ledger, and the two incomplete species tabs are flagged rather than silently dropped.

References

2025

  1. MPE
    Population-level phylogenomic analysis yields insights into species cohesion and population substructure of Lobelia section Lobelia (Campanulaceae)
    Grant T. Godden, Andrew A. Crowl, Stephen R. Patten, and 11 more authors
    Molecular Phylogenetics and Evolution, 2025
    Phylogenomic arm of the same NSF BEE programme (DEB-2015606) that the Lobelia Silhouettes trait-extraction work sat within.

2024

  1. Data
    GBIF Occurrence Download: Lobelia siphilitica preserved specimens with images
    GBIF.org
    Feb 2024
    452 preserved-specimen records across 19 institutional datasets, retrieved 2024-02-16. Taxon key 5409120, country US, georeferenced, no geospatial issue, media type StillImage, CC BY-NC 4.0.