All-view cine CMR segmentation for CMR Annotator
YOLO26 instance-segmentation checkpoints for short- and long-axis cine CMR.
The model predicts LV_endo, LV_epi, LA_endo, RV_endo, RA_endo, and
RVOT_endo. CMR Annotator additionally derives myocardium as
LV_epi AND NOT LV_endo and can retain masks, editable contours, or both.
Checkpoints
| checkpoint | role | mask gate | SHA-256 |
|---|---|---|---|
checkpoints/lax_sax_cine_yolov26n_halo15.onnx |
Default August 2026 halo-trained nano | 10% per side | fac15795ff4c713c802a008ff7c5582334af86fc73de4614cfde75c4efcbd338 |
checkpoints/lax_sax_cine_yolov26s.onnx |
Selectable unchanged small | 0% | cccf9067cf31dac120861530b46cd03a9f1102b50adaf343d29199bcd1f3d37a |
checkpoints/lax_sax_cine_yolov26n.onnx |
Legacy nano retained for app 0.1.0 compatibility | 0% | ddb8250a2942528411b335b9163dd755ab42be0d8dd9ed4e9d0cc0c485dd3463 |
Only inference-ready ONNX checkpoints are published; no PyTorch checkpoint is
included. model_selection.json records the deployment rule and
training_provenance.json preserves training, validation, and halo-selection
provenance.
Corrected mask-decoding behavior
The default nano combines a 15% per-side negative training halo with a 10% per-side inference mask gate. For each retained detection, expand its box by 10% of its width and height on every side, clamp the expanded box to the model tensor, and use it only to gate the prototype-derived mask. Do not alter the original detection box, class, confidence, or NMS result. The gate is performed by consumer code and is not embedded in the ONNX file. The unchanged small and legacy nano checkpoints use the standard 0% gate.
This configuration reduced mean cardinal gate-edge contact from 0.479346 to 0.000153 on 3,169 leakage-free validation images while limiting mask mAP50-95 regression against the zero-halo baseline to 0.003551.
Browser inference contract
- Normalize one grayscale frame by its finite minimum and maximum.
- Resample from DICOM spacing to the selected input spacing; 1 mm is the model-native default.
- Resolve the selected full, centered, or whole-heart model field and letterbox it to 640x640 with padding value 114/255.
- Decode
output0 (1,300,38)as[x1, y1, x2, y2, confidence, class_id, 32 mask coefficients]and combine it withoutput1 (1,32,160,160)prototypes. - Apply the checkpoint-specific mask gate, union same-class instances, and map masks back into the full-frame result grid.
Python usage
import cv2
from cardiac_toolkit.segmentation import AllViewCineSegmentor
frame = cv2.imread("cine.png", cv2.IMREAD_GRAYSCALE)
segmentor = AllViewCineSegmentor(imgsz=(512, 768))
result = segmentor.segment(frame, pixel_spacing=(1.4, 1.4))
The Python wrapper selects the 10% gate automatically for the packaged nano.
Pass gate_margin=0.0 to recover standard Ultralytics gating or another
non-negative fraction for an explicit experiment.
Smooth-contour post-processing
The model-independent postprocessing/ package contains the versioned LAX and
SAX presets used by CMR Annotator. Anonymized examples and contact sheets are
under examples/; they are qualitative checks rather than manual-contour
ground truth.
Validation and limitations
See METRICS.md for aggregate, per-class, myocardium, and boundary metrics.
This research model accelerates expert annotation and is not intended for
autonomous clinical diagnosis or treatment decisions. Outputs require visual
review and may vary with acquisition, pathology, reconstruction, and anatomy
outside the training distribution.