lm3_specimen_segmenter__unetpp_effb7_1024

UNet++ with an EfficientNet-B7 encoder that separates plant material from everything else on a herbarium specimen sheet (binary foreground mask, used for background removal). Was the default specimen_segmenter model in LeafMachine3 3.0.0 to 3.0.1041; the current default is lm3_specimen_segmenter__unetpp_effb7_1024_dinov3_vith16plus_2048_consensus (UNet++ v8). This model stays available as an alternate (lm3 models install --model specimen_segmenter=unetpp_effb7_1024).

LM3 metadata

Field Value
LM3 action specimen_segmenter
LM3_default_model false (the default in 3.0.0 to 3.0.1041; now unetpp_effb7_1024_dinov3_vith16plus_2048_consensus)
LM3_version 3.0.0 (minimum supported; later releases remain compatible)
Model key unetpp_effb7_1024 (training run unet_masksFromSam3_paperclean_control_1024)
Input whole sheet image, letterboxed onto a white 1024 x 1024 square, RGB, ImageNet mean/std normalization; tensor input [1, 3, 1024, 1024] float32
Output logits [1, 1, 1024, 1024]; apply sigmoid, threshold 0.5, remove the letterbox pad, resize to the sheet
Classes (1) plant (foreground)
Trained 2026-07-28

Architecture

Component Detail
Network UNet++ (nested, densely connected skip pathways), segmentation_models_pytorch.UnetPlusPlus
Encoder EfficientNet-B7, initialized from ImageNet weights (encoder_weights="imagenet")
Head 1 output channel, no activation (logits)
Parameters 66.4 M
Exported weights the exponential-moving-average copy (decay 0.9998) of the best epoch

The whole network is fine-tuned; only the encoder starts from pretrained weights.

Credits

  • segmentation_models.pytorch (Pavel Iakubovskii, MIT): the UNet++ implementation and the pretrained encoder loader. https://github.com/qubvel-org/segmentation_models.pytorch
  • UNet++: Zhou et al., "UNet++: A Nested U-Net Architecture for Medical Image Segmentation", 2018.
  • EfficientNet-B7: Tan and Le, "EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks", 2019; ImageNet weights from EfficientNet-PyTorch (Apache-2.0).
  • SAM 3 (Meta): produced the first-generation masks the training targets descend from (see Training data).

Files

Folder File Use
pytorch/ best.pt training checkpoint (model, EMA, optimizer); retraining
onnx/ model.onnx LM3 default runtime (onnxruntime), opset 17
torchscript/ model.torchscript.pt libtorch
coreml/ model.mlpackage/ Apple devices
docs/ compare_*.jpg example panels (see Examples)

SHA-256 of every file is in manifest.json.

Training data

There is no hand-drawn ground truth for this task. The training targets are machine-generated masks, refined in three steps:

  1. Boxes to masks. Specimen boxes from the LeafMachine3 plant detection set prompt SAM 3; the per-box masks are unioned, holes filled, and failed masks gated out. 21,098 sheets kept.
  2. Self-training. A first UNet++ trained on those masks re-predicts every herbarium sheet; its cleaner predictions replace the SAM 3 masks. 2,193 field photographs are excluded as out of domain. 18,904 sheets.
  3. Paper removal. A color rule samples the mounting paper around each mask and deletes large in-mask regions that match it.

The result is dataset LM3_Specimen_Segmentation-specimen-unetMasksFromSam3-paperclean: 18,904 sheet images from 75 labeling projects, one plant class. Images and masks are not distributed.

Split Images
train 15,154
val 1,910
test 1,840

Training

34 epochs, batch 4, 1024 x 1024 letterbox, AdamW (lr 1e-4, weight decay 1e-4), cosine schedule, mixed precision, EMA. Loss: Dice + binary cross-entropy + 0.5 x boundary (Sobel edge) term. Augmentation: horizontal and vertical flips, 90-degree rotations, transpose, brightness/contrast 0.2, hue/saturation/value 10/15/10.

Evaluation

Scores are agreement with the machine-generated masks described above, not with human annotation. They measure how well the model reproduces its training targets on held-out sheets; a model that corrects a flawed target is penalized for it. Read them as a consistency check and judge quality from the examples.

Split Sheets scored Dice (mean) Dice (median) IoU (mean)
val, during training (best epoch) 1,910 0.946
val, exported ONNX 150 of 1,910 0.941 0.979 0.909
test, exported ONNX 150 of 1,840 0.948 0.977 0.916

The ONNX rows are random samples of each split, scored at native sheet resolution; 2% of test sheets and 3% of val sheets score below 0.5 Dice. Known weakness: faint, dried-brown material on similarly colored paper can be under-segmented.

Examples

Background removal on the same sheets by this model (UNet++) and by the two other LeafMachine3 specimen segmenters trained on the same data, BiRefNet and YOLO26x-seg, for comparison. Black marks what each model removed; the percentage is the share of the sheet kept. Raw model masks, before LeafMachine3's paper-removal follow-up. File names give each sheet's dataset split. Panels 1 to 12 are a standing comparison set that includes deliberately hard sheets (several from the training split); panels 13 to 20 are random held-out test sheets.


Acer saccharum, CMN_1804514859 路 test split 路 kept: UNet++ 40.1%, BiRefNet 40.2%, YOLO26x-seg 47.1%

Acer saccharum, CM_2859177966 路 train split 路 kept: UNet++ 28.5%, BiRefNet 28.5%, YOLO26x-seg 32.4%

Cassia fistula, FLAS_1457816931 路 val split 路 kept: UNet++ 23.0%, BiRefNet 23.3%, YOLO26x-seg 23.8%

Chrysophyllum gonocarpum, NY_1928830727 路 val split 路 kept: UNet++ 22.6%, BiRefNet 22.2%, YOLO26x-seg 30.8%

CHC21_009_9 路 val split 路 kept: UNet++ 2.6%, BiRefNet 2.6%, YOLO26x-seg 2.7%

Macaranga saccifera, MNHN_730851102 路 val split 路 kept: UNet++ 44.4%, BiRefNet 44.6%, YOLO26x-seg 49.3%

Macaranga magnifolia, MNHN_731821562 路 train split 路 kept: UNet++ 11.0%, BiRefNet 0.5%, YOLO26x-seg 47.6%

Macaranga gracilis, UM_1807486051 路 train split 路 kept: UNet++ 31.2%, BiRefNet 34.0%, YOLO26x-seg 37.8%

Torricellia angulata, K_912592861 路 train split 路 kept: UNet++ 22.7%, BiRefNet 24.2%, YOLO26x-seg 27.5%

Quercus grisebachii, CLF_1437883182 路 train split 路 kept: UNet++ 22.5%, BiRefNet 23.5%, YOLO26x-seg 23.8%

Quercus semilanuginosa, CLF_1437893278 路 train split 路 kept: UNet++ 20.5%, BiRefNet 32.1%, YOLO26x-seg 29.5%

Quercus pinnatiloba, MNHN_731018123 路 train split 路 kept: UNet++ 33.0%, BiRefNet 32.7%, YOLO26x-seg 33.7%

Lonicera maackii, KYO_2443051967 路 test split 路 kept: UNet++ 15.1%, BiRefNet 15.5%, YOLO26x-seg 19.2%

Macaranga waturandangii, BO1284103_4067113860 路 test split 路 kept: UNet++ 33.8%, BiRefNet 34.1%, YOLO26x-seg 35.6%

Melanophylla alnifolia, L_2517447339 路 test split 路 kept: UNet++ 22.2%, BiRefNet 21.9%, YOLO26x-seg 23.7%

Raphanus raphanistrum, ASU_2270499210 路 test split 路 kept: UNet++ 10.0%, BiRefNet 10.2%, YOLO26x-seg 15.7%

Posoqueria longiflora, UM_1807432107 路 test split 路 kept: UNet++ 29.4%, BiRefNet 29.5%, YOLO26x-seg 31.4%

1D41D09F-BC60-4E11-9283-3A0F23787BA7_1_105_c 路 test split 路 kept: UNet++ 24.9%, BiRefNet 24.9%, YOLO26x-seg 27.8%

Piper salinasanum, MNHN_438671634 路 test split 路 kept: UNet++ 12.1%, BiRefNet 12.0%, YOLO26x-seg 13.3%

lab_tilia_tomentosa_ny1110-08-4 路 test split 路 kept: UNet++ 7.5%, BiRefNet 7.5%, YOLO26x-seg 7.7%

Use in LeafMachine3

Stage specimen_segmenter (no dependencies; runs on the whole working image, independent of the plant boxes). ONNX at 1024, sigmoid threshold conf (default 0.5), then the paper-removal follow-up (paperclean: true). One mask per specimen is stored; the Reporter draws it as Overlay_Specimen_Segmentation and exports it under Specimen_Masks (binary mask and RGB cutout).

from huggingface_hub import hf_hub_download
path = hf_hub_download("phyloforfun/lm3_specimen_segmenter__unetpp_effb7_1024", "onnx/model.onnx")

Citation

Weaver, W. N. (2026) LeafMachine3. https://leafmachine.org

Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support