/ Модель

Характеристики

Лицензия
AGPL 3.0
Библиотека
segmentation-models-pytorch
Опубликована
24 окт 2026

lm3_specimen_segmenter__unetpp_effb7_1024_dinov3_vith16plus_2048_consensus

Сегментация изображенийИзображение → mask3 профессии
1скачиваний за 30 дней0лайковвеса обновлены25 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

UNet++ с энкодером EfficientNet-B7 выделяет растения на изображениях гербарных листов и фотографиях листьев для удаления фона.

Модель LeafMachine3 для выделения растительного материала на изображениях гербарных листов и фотографиях листьев, чтобы удалять фон и бумагу. Это сегментационная сеть UNet++ с энкодером EfficientNet-B7, предобученным на ImageNet; она выдаёт одноканальные логиты для построения бинарной маски. Модель обучена заново на базе ImageNet-энкодера, а не дообучена на весах предыдущей версии UNet++.

Версия v8 использует очищенные машинно-сгенерированные маски и обучение с пиксельными весами доверия и функцией потерь, устойчивой к ошибочным меткам. По сравнению с предыдущей версией она лучше исключает участки бумаги между стеблями и ветвями. В LeafMachine3 модель работает с изображением, приведённым к размеру 1024, и применяется как альтернативный сегментатор гербарного образца; доступны файлы ONNX и Core ML. Языковой ввод и текстовый вывод не предусмотрены.

Модель распространяется по лицензии AGPL-3.0. Целевые маски были сгенерированы автоматически, без ручной разметки, поэтому ошибки в обучающих масках могут ограничивать качество сегментации.

Сценарии применения

  • удаление фона с изображений гербарных листов
  • создание бинарной маски растительного образца
  • отделение стеблей и ветвей от бумаги между ними
  • подготовка гербарных изображений для анализа в LeafMachine3
  • выделение листьев и черешков на фотографиях растений

Ограничения

Обучающие маски сгенерированы автоматически, без ручной разметки, поэтому ошибки целевых масок могут влиять на качество. Версия v8 больше не является моделью по умолчанию в LeafMachine3 начиная с 3.0.1044.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

lm3_specimen_segmenter__unetpp_effb7_1024_dinov3_vith16plus_2048_consensus

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). This is UNet++ v8: the same network and input as unetpp_effb7_1024_dinov3_vith16plus_2048 (UNet++ v2), trained again on cleaner targets, with per-pixel weights that say how far each target pixel can be trusted and a loss that tolerates wrong labels. It keeps far less of the paper that v2 filled in between stems and branches. Was the default specimen_segmenter model in LeafMachine3 3.0.1043; from 3.0.1044 the default is lm3_specimen_segmenter__unetpp_effb7_1024_dinov3_vith16plus_2048_selftrain (UNet++ v9, trained on this model's own masks after the paper cleanup). This model stays available as an alternate (lm3 models install --model specimen_segmenter=unetpp_effb7_1024_dinov3_vith16plus_2048_consensus). The versions are numbered in sequence: v3 to v7 were experiments that were never released.

LM3 metadata

FieldValue
LM3 actionspecimen_segmenter
LM3_default_modelfalse (default in 3.0.1043; replaced by unetpp_effb7_1024_dinov3_vith16plus_2048_selftrain from 3.0.1044)
LM3_version3.0.1043 (minimum; earlier releases do not know this model key)
Model keyunetpp_effb7_1024_dinov3_vith16plus_2048_consensus (training run unetpp-v8-1024-dinov3_vith16plus_2048-v4targets-consensus-weights-30ep, epoch 7 of 30)
Inputwhole sheet image, letterboxed onto a white 1024 x 1024 square, RGB, ImageNet mean/std normalization; tensor input [1, 3, 1024, 1024] float32
Outputlogits [1, 1, 1024, 1024]; apply sigmoid, threshold 0.5, remove the letterbox pad, resize to the sheet
Classes (1)plant (foreground)
Trained2026-10-23
Iteration1

Architecture

ComponentDetail
NetworkUNet++ (nested, densely connected skip pathways), segmentation_models_pytorch.UnetPlusPlus
EncoderEfficientNet-B7, initialized from ImageNet weights (encoder_weights="imagenet")
Head1 output channel, no activation (logits)
Parameters66.4 M
Exported weightsthe exponential-moving-average copy (decay 0.9998, with warm-up) at epoch 7 of 30 (see Training)

The whole network is trained from the ImageNet encoder; it does not start from v2's weights. DINOv3, the v2 UNet++ and the LeafMachine3 leaf segmenter are not part of this model: they only produced the training targets.

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).
  • DINOv3 (Meta): Siméoni et al., "DINOv3", 2025. The frozen ViT-H+/16 backbone behind the v2 targets.
  • GrabCut: Rother, Kolmogorov and Blake, 2004 (OpenCV implementation); guided filter: He, Sun and Tang, 2013.
  • Generalized cross-entropy: Zhang and Sabuncu, "Generalized Cross Entropy Loss for Training Deep Neural Networks with Noisy Labels", 2018.
  • LeafMachine3 leaf segmenter (lm3_leaf_segmenter__yolo26x_seg_1024, YOLO26x-seg): leaf and petiole masks on the Leafsnap photographs (see Training data).

Files

FolderFileUse
pytorch/best.ptthe exported weights (EMA copy at epoch 7, key ema) with the training config; retraining
onnx/model.onnxLM3 default runtime (onnxruntime), opset 17
torchscript/model.torchscript.ptlibtorch
coreml/model.mlpackage/Apple devices (float16 input/output, iOS 16 / macOS 13)
docs/compare_*.jpg, failure_*.jpgexample panels (see Examples)

SHA-256 of every file is in manifest.json; training_metadata.json records the full training and dataset chain.

Training data

There is no hand-drawn ground truth for this task. The targets are machine-generated. They start from the v2 targets: detector boxes on 27,772 sheets turned into masks with a DINOv3 probe and GrabCut (steps 1 to 5 on the v2 card). Three steps follow:

  1. Context cleaning. v2 learned that paper surrounded by plant is plant, and its targets have the same flaw. The v2 UNet++ (iteration 1) was run on every sheet again with everything outside a moving 384-pixel window (on the 1024 letterbox) replaced by white or by a blur, so it sees each region without its surroundings. A pixel stays plant only where both the whole-sheet view and the windowed views say plant (the outline is restored within 4 pixels and dilated by 4). Sheets that would lose more than 90% of their mask keep the v2 mask (199 sheets). On average this removes 9.3% of each mask.
  2. Leafsnap leaves. On the 9,934 Leafsnap lab and field photographs, the mask is joined with the LeafMachine3 leaf segmenter's Leaf and Petiole masks (eroded by 1 pixel), minus its Hole masks. This adds the petioles and leaf tips the box-based masks miss (plant share on these photos 7.9% to 9.3%). 15 field photographs where the leaf segmenter's output was implausible keep the step-6 mask.
  3. Consensus weights. Every target pixel gets a weight from how many independent sources agree with it: the context-cleaned view, the v1 UNet++ (where its mask is plausible), the leaf segmenter and a thin-ridge detector. Weight 0 where the target says background but another source says plant (disputed pixels are not learned; 0.95% of a sheet on average); weight 2 for sure background (all sources agree, outside the plant boxes and at least 4 pixels from plant), archival boxes and the paper removed in step 6 (72.9%); weight 3 for hard negatives: strong-edge objects 10 to 30 pixels from the plant such as tape and clips (0.34%); weight 1 elsewhere (25.8%).

The result is dataset LM3_Specimen_Segmentation-dense-weak-bbox-from-plant-archival, masks pseudolabels_v4-v3ctx-leafsnapyolo/final_grabcut_ctx and weights pseudolabels_v4-v3ctx-leafsnapyolo/weights. Sheets whose mask is empty are skipped. Images, masks and weights are not distributed.

SplitSheetsEmpty masks (skipped)
train22,277202
val2,78229
test2,71320

The splits are the ones v1 and v2 were trained with, so no sheet is held out from one model and trained on by another.

Training

30 epochs, batch 5, 1024 x 1024 letterbox, AdamW (lr 1e-4, weight decay 1e-4), cosine schedule over the 30 epochs, mixed precision, EMA with warm-up. Loss, every term weighted per pixel by the consensus weights: generalized cross-entropy (q 0.7, which down-weights pixels the network confidently disagrees with) + Dice + 0.5 x an edge term that pulls mask edges onto image edges (alpha 10). A band of 6 pixels on both sides of every target outline is not learned unless the image itself has an edge there. The white letterbox pad is trained as background. Augmentation: horizontal and vertical flips, 90-degree rotations, transpose, brightness/contrast 0.2, hue/saturation/value 10/15/10.

Checkpoint. This is epoch 7, not the epoch with the best validation Dice against the targets (epoch 26). The targets drop pale, dried and thin plant material; agreement with them kept rising for the whole run, but plant recall on hand-placed points fell from epoch 7 on, as the network learned the targets' mistakes. Every epoch was checked without labels on fixed sheet sets (full-sheet input, threshold 0.5):

CheckEpoch 7 (this model)Epoch 26 (best validation Dice)
Plant recall on hand-placed points (12 hard sheets)0.9090.762
Background points correct (same sheets)0.9810.992
Fill precision (24 sheets with thin stems on white paper)0.6710.654
Thin-structure recall (same sheets)0.8170.816
Petiole recall (50 Leafsnap photos)0.6910.710
Validation Dice vs the training targets0.9490.954

Evaluation

Scores are agreement with machine-generated masks, not with human annotation, and each target set has its own bias. Read them as consistency checks and judge quality from the examples. In the tables, UNet++ v2 is unetpp_effb7_1024_dinov3_vith16plus_2048 and UNet++ v8 is this model; "+ paper removal" is LeafMachine3's paper-removal step with its default method (LLR_Hyst_KeepBlobs).

During training (validation, 2,753 sheets, against this model's targets, epoch 7): Dice 0.949, IoU 0.914, boundary F 0.726.

Exported ONNX run the way LeafMachine3 runs it (the ingest working image, at most 3,200 pixels on the long side; threshold 0.5; scored at that resolution), on random samples (seed 7) of held-out sheets, with and without paper removal:

Against this model's targets (steps 6 and 7 above; dense-weak test and val splits):

SplitModelSheetsDice (mean)Dice (median)PrecisionRecallDice < 0.5
testUNet++ v2 raw150 of 2,7130.9100.9650.8830.9644%
testUNet++ v2 + paper removal150 of 2,7130.9210.9690.9300.9323%
testUNet++ v8 raw150 of 2,7130.9380.9700.9280.9651%
testUNet++ v8 + paper removal150 of 2,7130.9270.9640.9380.9351%
valUNet++ v2 raw150 of 2,7820.9180.9740.9020.9623%
valUNet++ v2 + paper removal150 of 2,7820.9220.9750.9410.9263%
valUNet++ v8 raw150 of 2,7820.9390.9770.9310.9703%
valUNet++ v8 + paper removal150 of 2,7820.9270.9740.9400.9363%

Against the v2 targets (the same sheets before steps 6 and 7; they include the paper fill this model was trained to leave out, which favors v2):

SplitModelSheetsDice (mean)Dice (median)PrecisionRecallDice < 0.5
testUNet++ v2 raw150 of 2,7130.9300.9680.9300.9392%
testUNet++ v2 + paper removal150 of 2,7130.9060.9540.9470.8822%
testUNet++ v8 raw150 of 2,7130.9040.9550.9360.9033%
testUNet++ v8 + paper removal150 of 2,7130.8910.9500.9420.8774%
valUNet++ v2 raw150 of 2,7820.9290.9740.9350.9432%
valUNet++ v2 + paper removal150 of 2,7820.9010.9690.9470.8863%
valUNet++ v8 raw150 of 2,7820.9110.9700.9330.9133%
valUNet++ v8 + paper removal150 of 2,7820.8950.9680.9380.8854%

Against the SAM 3-derived masks (unetpp_effb7_1024's targets; the samples its card is scored on). These targets were themselves cleaned with the original paper-removal rule:

SplitModelSheetsDice (mean)Dice (median)PrecisionRecallDice < 0.5
testUNet++ v2 raw150 of 1,8400.8710.9170.8710.9135%
testUNet++ v2 + paper removal150 of 1,8400.9030.9510.9290.9074%
testUNet++ v8 raw150 of 1,8400.9070.9510.9110.9312%
testUNet++ v8 + paper removal150 of 1,8400.9190.9650.9390.9242%
valUNet++ v2 raw150 of 1,9100.8710.9300.8800.9015%
valUNet++ v2 + paper removal150 of 1,9100.8950.9580.9260.8964%
valUNet++ v8 raw150 of 1,9100.9070.9520.9190.9193%
valUNet++ v8 + paper removal150 of 1,9100.9210.9650.9470.9132%

Hand-placed points. On 12 sheets where unetpp_effb7_1024 failed, plant and background points were placed by hand (10 sheets are in the training split, 2 in test; 2 sheets hold no plant and have background points only):

ModelPlant points inside the maskBackground points outside the mask
UNet++ v2 raw73.5% of 44195.0% of 624
UNet++ v2 + paper removal73.5% of 44196.0% of 624
UNet++ v8 raw90.5% of 44198.1% of 624
UNet++ v8 + paper removal90.5% of 44199.0% of 624

The training loader decodes JPEGs at reduced size before the 1024 resize; LeafMachine3 decodes the full image. On 50 test sheets the two give masks with IoU 0.988 (minimum 0.953).

Known weaknesses: in tight angles on pale paper (between a petiole and the leaf base, between close stems) the model can still keep a wedge of paper; the paper-removal step takes most of it out (the IMG_KS_T2 Ginkgo leaf below). The step itself lowers recall a little against this model's own targets (it also removes some pale, dried stems and roots on white paper) while raising precision; it did not remove any hand-placed plant point. Against the v2 targets this model scores lower than v2 because those targets contain the paper fill it was trained to leave out.

Examples

Background removal on the 20 sheets of the unetpp_effb7_1024 card, by UNet++ v2 and this model (UNet++ v8). Black marks what each model removed; the percentage is the share of the sheet kept. Raw model masks, before LeafMachine3's paper-removal step. 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 test sheets.

Sheets the v1 UNet++ failed on

The held-out sheets of the unetpp_effb7_1024_dinov3_vith16plus_2048 card on which unetpp_effb7_1024 removed most of the plant: tan, brown or gray-green material on paper or card of a similar color. Original | UNet++ v2 | UNet++ v8, raw model masks.

The same sheets with paper removal

LeafMachine3 follows the model with a paper-removal step (paperclean: true, default method LLR_Hyst_KeepBlobs): it samples the paper around the mask, models paper and plant colors, and deletes regions inside the mask that are confidently paper. Red marks what it deleted. The last 4 sheets are ones where the step has paper to remove.

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 step (paperclean: true, method LLR_Hyst_KeepBlobs while LLR_Hyst_KeepBlobs: true; false selects the original HSV method). One mask per specimen is stored; the Reporter draws it as Overlay_Specimen_Segmentation and exports both masks under Specimen_Masks: this model's own mask in *_Specimen and the paper-cleaned one in *_Specimen_PaperCleaned, each as a binary mask, an RGB cutout and their inverses. lm3 models install puts the model in models/specimen_segmenter/unetpp_effb7_1024_dinov3_vith16plus_2048_consensus/; the settings name it by key:

specimen_segmenter:
  model: {key: unetpp_effb7_1024_dinov3_vith16plus_2048_consensus, path: models/specimen_segmenter/unetpp_effb7_1024_dinov3_vith16plus_2048_consensus/model.onnx, format: onnx}
  paperclean: true
  LLR_Hyst_KeepBlobs: true
from huggingface_hub import hf_hub_download
path = hf_hub_download("phyloforfun/lm3_specimen_segmenter__unetpp_effb7_1024_dinov3_vith16plus_2048_consensus", "onnx/model.onnx")

Citation

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

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · segmentation-models-pytorch

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
c0c898f

0 моделей