lm3_leaf_segmenter__yolo26x_seg_1024
YOLO26x-seg instance segmentation of Leaf, Petiole, and Hole on single-leaf crops from herbarium specimen sheets. Default leaf_segmenter model in LeafMachine3 >= 3.0.0.
LM3 metadata
| Field | Value |
|---|---|
| LM3 action | leaf_segmenter |
| LM3_default_model | true |
| LM3_version | 3.0.0 (minimum supported; later releases remain compatible) |
| Model key | yolo26x_seg_1024 (training run yolo26x-seg-1024-it2) |
| Architecture | YOLO26x segment, end-to-end (NMS-free) |
| Base weights | yolo26x-seg.pt (Ultralytics, AGPL-3.0) |
| Input | single-leaf crop from plant_detector, 1024 letterbox, RGB |
| Output | instance masks + boxes for 3 classes |
| Classes (3) | Leaf, Petiole, Hole |
| Trained | 2026-10-12 |
| Iteration | 2 |
Files
| Folder | File | Use |
|---|---|---|
pytorch/ | best.pt | Ultralytics, retraining |
onnx/ | model.onnx | LM3 default runtime (onnxruntime) |
torchscript/ | model.torchscript | libtorch |
openvino/ | model_openvino_model/ | Intel CPU/iGPU |
coreml/ | model.mlpackage/ | Apple devices |
coreml_fp32/ | model.mlpackage/, model.json | LM3 on macOS: Core ML on the Apple GPU, float32 |
docs/ | io_*_input_crop.jpg, io_*_output_masks.jpg, overlay_*.jpg | input/output pairs and inference examples |
SHA-256 of every file is in manifest.json.
Training data
Dataset 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). Images and labels are not distributed.
| Source project | Images |
|---|---|
| SEG_GroundTruth-Leaf_WHOLE_Group1-Partial | 11,531 |
| SEG_GBIF_BigLeaf | 2,944 |
| SEG_GBIF_BigLeaf_Fagaceae_Quercus | 2,123 |
| SEG_ALOT_Ginkgo_biloba | 291 |
| SEG_Botany_Icacinaceae | 6 |
| Split | Images | Leaf | Petiole | Hole |
|---|---|---|---|---|
| train | 13,480 | 14,970 | 12,246 | 10,220 |
| val | 1,711 | 1,866 | 1,540 | 1,401 |
| test | 1,704 | 1,837 | 1,561 | 1,398 |
Training
300 epochs planned, early-stopped at 237 (patience 50), best epoch 197. Cosine LR, batch 12, close_mosaic=15, overlap_mask, mask_ratio=4. Augmentation: hsv 0.015/0.7/0.4, degrees 15, translate 0.1, scale 0.5, shear 2, perspective 0.0005, flipud 0.5, fliplr 0.5, mosaic 1.0, mixup 0.15, copy_paste 0.3 (flip), erasing 0.4, randaugment.
Evaluation
| Split | Box mAP50 | Box mAP50-95 | Mask mAP50 | Mask mAP50-95 | Mask P | Mask R |
|---|---|---|---|---|---|---|
| val | 0.764 | 0.582 | 0.733 | 0.503 | 0.838 | 0.698 |
| test | 0.751 | 0.577 | 0.730 | 0.503 | 0.836 | 0.692 |
Test mask AP50 per class: Leaf 0.932, Petiole 0.827, Hole 0.432. Evaluated with Ultralytics val on best.pt at 1024 (evaluation_metrics.json).
Input and output (what the model sees)
The model is run on one leaf crop at a time: the axis-aligned Leaf_WHOLE box cut by lm3_plant_detector from the specimen's working image, exactly as stored by LeafMachine3. It returns instance masks in crop coordinates (Leaf green, Petiole magenta, Hole purple), which LeafMachine3 re-bases to the specimen frame. Neighboring leaves inside the box are expected; the pipeline keeps the instance that belongs to the box.
Examples
Inference examples: this model's instance masks drawn on LeafMachine3 working images (shown at 1600 px). Leaf green, Petiole magenta, Hole purple; boxes and labels off; not from the evaluation splits. Full-size images are in docs/.
Use in LeafMachine3
Stage leaf_segmenter (depends on plant_detector). Runs on every Leaf_WHOLE crop (Leaf_PARTIAL optional) with the ONNX export at 1024, conf=0.3, iou=0.5, retina_masks, max_det=100; polygons are re-based to the specimen frame and stored (polygon_xy, min area 64 px), with each Hole and Petiole attached to its owning Leaf. Downstream consumers: morphology, petiole_width, bilateral_symmetry, metric_grounding, ect, the leaf collage, and the Reporter overlays.
On macOS, LM3 runs coreml_fp32/ with Core ML on the Apple GPU instead; its output matches this ONNX model to float32 rounding.
from huggingface_hub import hf_hub_download
path = hf_hub_download("phyloforfun/lm3_leaf_segmenter__yolo26x_seg_1024", "onnx/model.onnx")
Citation
Weaver, W. N. (2026) LeafMachine3. https://leafmachine.org