CPU-based fast cardiac cine MRI segmentation using lightweight CNNs and knowledge distillation.
Authors
Affiliations (3)
Affiliations (3)
- Department of Biomedical Engineering, University of Virginia, Charlottesville, VA, United States. Electronic address: [email protected].
- Department of Medicine, Cardiovascular Division, University of Virginia, Charlottesville, VA, United States.
- Department of Biomedical Engineering, University of Virginia, Charlottesville, VA, United States.
Abstract
Cardiac cine MRI segmentation is essential for quantifying ventricular function, but current deep learning methods typically require GPU hardware for inference, limiting deployment in clinical settings with constrained computational resources. This study develops and evaluates lightweight CNN architectures trained via knowledge distillation for fast and accurate cardiac cine segmentation on CPU devices, including deployment in web browsers. A residual-encoder U-Net teacher (9.22M parameters) was distilled into three lightweight student networks - MobileUNetV2 (2.09M), MobileUNetV3 (4.52M, with squeeze-and-excitation attention), and EfficientLiteUNet (5.08M, fused mobile convolutions) - trained with deep supervision at four output scales. Distillation matched softened teacher and student probabilities via Kullback-Leibler divergence, with a grid search over temperature T ∈ {1.0, 3.0, 5.0} and KD loss weight W ∈ {0.5, 0.99}, giving 6 KD configurations per architecture. Models were trained on 560 image series from the combined ACDC and M&Ms datasets, evaluated on 280 held-out series, and on a 29-patient external cohort (UVA). Paired t-tests on per-case mean Dice with Holm-Bonferroni correction (m = 6) compared each KD configuration with its baseline. Inference was benchmarked on CPU using PyTorch, native ONNX Runtime (C++), and ONNX Runtime Web - the latter running entirely inside the user's web browser with no images sent to any server. The teacher reached a mean Dice of 0.894 across the three structures (LV cavity, LV myocardium, RV cavity). The best KD students reached 0.883 (MobileUNetV2), 0.883 (MobileUNetV3), and 0.888 (EfficientLiteUNet) at T=3.0, W=0.99, versus baselines of 0.871, 0.871, and 0.876. KD improved every architecture (Holm-adjusted p ≤ 5 × 10⁻⁷ at the best configuration), the top configurations forming a plateau rather than a unique optimum. Students tracked the teacher on the external cohort (0.903 versus 0.891 - 0.895) and on segmentation-derived ejection fraction in both cohorts, where no student's error differed from the teacher's (internal LV_EF bias -0.2 to +0.8%). On CPU, EfficientLiteUNet ran at 11 ms per frame natively (ONNX Runtime, 4 threads) while MobileUNetV2 was smallest (8.3 MB) and second-fastest in the browser (183 ms per frame), behind MobileUNetV3 (159 ms). Lightweight CNNs trained with knowledge distillation come within 0.006 - 0.011 Dice of the teacher and match its downstream clinical measurements, while running on CPUs and inside ordinary web browsers. The browser deployment performs every step locally on the user's device, so no patient images leave the local environment - a practical path to clinical use without GPU infrastructure or outbound transfer of imaging data. A reference instance is at https://cmrsegmentation.org and the code is at https://github.com/xf4j/cmrsegmentation. Cardiac MRI is the reference standard for measuring how well the heart pumps, but it requires a clinician or technologist to draw outlines around the heart's chambers and walls on dozens of images per scan - a slow and subjective task. Computers can do this automatically using artificial intelligence (AI), but most modern AI segmentation tools require expensive graphics hardware (GPUs) and often involve sending the patient's images to an external server, which raises both cost and data-privacy concerns. In this study we trained smaller, faster AI models that match the accuracy of a much larger reference model (within about one percentage point on standard accuracy benchmarks) while running on an ordinary computer's main processor in a fraction of a second per image - about a hundredth of a second natively, under a fifth of a second inside a web browser. We compared three different small-model designs and a grid of training settings, and found a range of settings that worked equally well across all three - useful guidance for other groups doing similar work. We then packaged the trained AI directly into a web page so that anyone with a modern web browser can drop in a cardiac MRI scan and see the segmentation result in seconds. Crucially, the web page does not send any images to a server; the AI runs entirely on the user's own computer, so patient data never leaves the local device. A live demonstration is available at https://cmrsegmentation.org and the source code is open-source. This makes accurate, automated cardiac MRI segmentation accessible to clinical sites that lack specialised hardware or that cannot share imaging data with external services.