/ Модель

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

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

lm3_leaf_segmenter__birefnet_hr_swinl_1024_leaf

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

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

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

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

Это дообученная модель BiRefNet со Swin Transformer Large в качестве основы, опубликованная для сегментации листьев на гербарных изображениях. Она принимает отдельные изображения с одним листом и выдаёт бинарную маску, объединяющую листовую пластинку и черешок; отверстия в листе исключаются из маски. Модель основана на весах BiRefNet_HR-general-epoch_130 и дообучена до эпохи 170 на 1024 × 1024. Разработчики описывают её как экспериментальную альтернативу сегментатору YOLO26x-seg в LeafMachine3; ни один релиз LeafMachine3 по умолчанию её не запускает.

На тестовом наборе из 1 703 кропов средний Dice составил 0,978, а средний IoU — 0,960. Доступны веса PyTorch, ONNX и TorchScript; ONNX-файл также пригоден для запуска через OpenVINO. ONNX-модель требует около 17 ГБ видеопамяти при использовании CUDA или около 4 ГБ с TensorRT; на CPU обработка одного кропа занимает несколько секунд. Для модели указана лицензия MIT.

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

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

Ограничения

Модель рассчитана на кропы с одним листом и не является сегментатором экземпляров; она не интегрирована в выпуски LeafMachine3 по умолчанию. ONNX-версия требовательна к видеопамяти, а на 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

BiRefNet (Swin-L backbone) fine-tuned to segment the lamina and petiole as one mask on single-leaf crops from herbarium specimens (binary mask, foreground = lamina + petiole). 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 (training run birefnet-hr-1024-leaf-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 + petiole (one mask; holes are background)
Trained2026-10-15
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, 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 and Petiole polygons minus Hole polygons. Crops with no foreground are skipped. Train and val built 2026-08-09; test built 2026-10-21 from the LM3_Leaf test split for the evaluation below. Images and masks are not distributed.

SplitCrops
train13,477
val1,709
test1,703

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,7090.9780.9880.9590.9770.9800.0160
test1,7030.9780.9880.9600.9790.9790.0159

0.1% of test crops score below 0.5 Dice. Export parity with the PyTorch checkpoint (mask IoU at threshold 0.5, worst crop): ONNX 0.99995 (24 val crops, CPU and CUDA), TorchScript 1.00000 and OpenVINO 0.99996 (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", "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: не понять архитектуру модели.

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

0 моделей