/ Модель

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

Лицензия
MIT
Опубликована
21 окт 2026

lm3_leaf_segmenter__birefnet_hr_swinl_1024_leaf_no_petiole

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

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

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

BiRefNet на Swin Transformer Large выделяет бинарной маской листовую пластинку без черешка на отдельных кропах гербарных образцов.

Это модель семантической сегментации листьев из проекта LeafMachine3: BiRefNet с backbone Swin Transformer Large дообучена разработчиком карточки на гербарных изображениях. Она выделяет только листовую пластинку (lamina) на отдельных кропах листьев и возвращает бинарную маску; черешок считается фоном. Модель основана на весах BiRefNet_HR-general-epoch_130 и дообучена 40 эпох на наборе LM3_Leaf. Доступен экспорт ONNX; также указаны веса PyTorch и TorchScript.

Модель предназначена для точного выделения контура листовой пластинки, включая тонкие детали, в задачах анализа гербарных образцов и обработки кропов из LeafMachine3. На тестовой выборке из 1 701 кропа средние Dice и IoU составили 0,980 и 0,962. Это семантическая сегментация, поэтому модель сама по себе не разделяет отдельные экземпляры листьев и сложнее встраивается в общий конвейер LeafMachine3, чем используемый там по умолчанию YOLO26x-seg. ONNX-модель занимает около 1 ГБ и требует около 17 ГБ видеопамяти при запуске через CUDA; на CPU обработка одного кропа занимает несколько секунд. Лицензия — MIT.

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

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

Ограничения

Модель обучена для одиночных кропов листьев и сегментирует только листовую пластинку, считая черешок фоном; она не является моделью сегментации экземпляров и не используется по умолчанию ни в одном выпуске LeafMachine3. ONNX-экспорт требует значительных ресурсов GPU, а запуск на CPU занимает несколько секунд на кроп.

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

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

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

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

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

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

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

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

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

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

Открыть на Hugging Face

lm3_leaf_segmenter__birefnet_hr_swinl_1024_leaf_no_petiole

BiRefNet (Swin-L backbone) fine-tuned to segment the lamina only on single-leaf crops from herbarium specimens (binary mask, foreground = lamina). Not a LeafMachine3 default model.

LeafMachine3 segments the lamina, petiole, and leaf holes with YOLO26x-seg (lm3_leaf_segmenter__yolo26x_seg_1024), but we also experimented with BiRefNet, which is designed to segment thin, fine structures precisely. BiRefNet is a semantic segmentation architecture, not an instance segmentation architecture like YOLO26, so it is harder to integrate into the overall LeafMachine3 workflow. We provide these models anyway because they are still useful. There are two: one finds only the lamina (lm3_leaf_segmenter__birefnet_hr_swinl_1024_leaf_no_petiole), and one finds the lamina and petiole as one mask (lm3_leaf_segmenter__birefnet_hr_swinl_1024_leaf). We also experimented with combining the two to isolate the lamina from the petiole (last column of the Examples), but BiRefNet is already a heavy model, and its precision gain did not make the extra computational cost worthwhile for LeafMachine3. Do whatever you want with them.

LM3 metadata

FieldValue
LM3 actionleaf_segmenter (alternate; no LeafMachine3 stage runs it)
LM3_default_modelfalse
LM3_versionnone (no LeafMachine3 release loads this model)
Model keybirefnet_hr_swinl_1024_leaf_no_petiole (training run birefnet-hr-1024-leaf-no-petiole-it2, checkpoint epoch 170)
Inputsingle-leaf crop, resized (not letterboxed) to 1024 x 1024, RGB scaled to [0, 1]; ImageNet mean/std normalization is inside the graph; tensor input_rgb01 [1, 3, 1024, 1024] float32
Outputprob [1, 1, 1024, 1024], foreground probability (sigmoid applied); resize to the crop, threshold 0.5
Foregroundlamina (one mask; holes are background)
Trained2026-10-17
Iteration2

Architecture

ComponentDetail
NetworkBiRefNet (bilateral reference): localization module plus a reconstruction decoder guided by in-image and gradient references, with deformable-convolution ASPP blocks
BackboneSwin Transformer Large (swin_v1_l)
Starting weightsBiRefNet_HR-general-epoch_130 (general high-resolution background removal, trained at 2048 x 2048)
Fine-tuningfull network, at 1024 x 1024
Outputmulti-scale predictions during training; the final full-resolution map at inference

Credits

  • BiRefNet (Peng Zheng et al., MIT): architecture, training code and the BiRefNet_HR-general weights this model starts from. https://github.com/ZhengPeng7/BiRefNet
  • Zheng et al., "Bilateral Reference for High-Resolution Dichotomous Image Segmentation", CAAI Artificial Intelligence Research, 2024.
  • Swin Transformer: Liu et al., "Swin Transformer: Hierarchical Vision Transformer using Shifted Windows", 2021.

Files

FolderFileUse
pytorch/epoch_170.pthBiRefNet state dict; load with the BiRefNet repo (swin_v1_l, size 1024); retraining
onnx/model.onnxonnxruntime, opset 17, batch 1; deformable convolutions decomposed into standard ops (no custom ops)
torchscript/model.torchscripttorch.jit.load(..., map_location="cuda"); traced on CUDA and runs on CUDA only; needs torchvision's ops (import torchvision first)
openvino/model_openvino_model/OpenVINO IR (fp32), converted from the ONNX
docs/panel_*.jpgexample panels (see Examples)

SHA-256 of every file is in manifest.json. There is no CoreML export: coremltools cannot convert BiRefNet's deformable convolutions.

Training data

Dataset LM3_Leaf-birefnet-leafbg-nopetiole, derived from LM3_Leaf (built 2026-06-26 from 5 Labelbox segmentation projects, 16,895 single-leaf crops, frozen 80/10/10 split, salt lm3, class hash 7f2c49ca64d9): one binary mask per crop, foreground = Leaf polygons minus Hole polygons (the petiole is background). Crops with no foreground are skipped. Train and val built 2026-08-10; test built 2026-10-21 from the LM3_Leaf test split for the evaluation below. Images and masks are not distributed.

SplitCrops
train13,464
val1,705
test1,701

Training

Fine-tuned from epoch 130 to 170 (40 epochs) on the train split, batch 4, 1024 x 1024, AdamW, learning rate 1e-5, BiRefNet's general background-removal loss preset (binary cross-entropy 30, IoU 0.5, MAE 100, SSIM 10), with the contour-friendly loss switch over the final 20 epochs. Published checkpoint: the final epoch.

Evaluation

Scored against the hand-drawn LM3_Leaf polygons rasterized to this model's foreground, at native crop resolution, through the exported ONNX (fp32, onnxruntime CUDA); metrics are means over crops.

SplitCropsDice (mean)Dice (median)IoU (mean)PrecisionRecallMAE
val1,7050.9800.9890.9630.9810.9810.0140
test1,7010.9800.9890.9620.9820.9790.0144

No test crop scores below 0.5 Dice. Export parity with the PyTorch checkpoint (mask IoU at threshold 0.5, worst crop): ONNX 0.99972 (24 val crops, CPU and CUDA), TorchScript 1.00000 and OpenVINO 0.99995 (8 val crops).

Examples

The same eight Leaf_WHOLE crops on both BiRefNet cards: plant_detector crops from LeafMachine3 example runs, four of them the crops on the lm3_leaf_segmenter__yolo26x_seg_1024 card. Columns: the crop | the lamina + petiole model | the lamina-only model | the two combined: lamina (green) from the lamina-only model, petiole (magenta) = the bulk of what the lamina + petiole model adds, after a morphological opening removes the thin ring where the two models' edges disagree. Small crops are shown enlarged.

Use in LeafMachine3

No LeafMachine3 release runs this model; the leaf_segmenter stage runs YOLO26x-seg. To run it on a leaf crop:

import cv2, numpy as np, onnxruntime as ort
from huggingface_hub import hf_hub_download
path = hf_hub_download("phyloforfun/lm3_leaf_segmenter__birefnet_hr_swinl_1024_leaf_no_petiole", "onnx/model.onnx")
sess = ort.InferenceSession(path, providers=["CUDAExecutionProvider", "CPUExecutionProvider"])
bgr = cv2.imread("leaf_crop.jpg")
x = cv2.resize(cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB), (1024, 1024)).astype(np.float32) / 255.0
prob = sess.run(None, {"input_rgb01": x.transpose(2, 0, 1)[None]})[0][0, 0]
mask = cv2.resize(prob, (bgr.shape[1], bgr.shape[0])) > 0.5

The fp32 ONNX is about 1 GB; with onnxruntime's CUDA provider it uses about 17 GB of GPU memory (about 4 GB with the TensorRT provider), and on a CPU it takes several seconds per crop.

Citation

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

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

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

GPU в ailist

Универсальный рантайм

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

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

Ревизия весов
9a1cc6c

0 моделей