HybridDenseViT: a unified explainable hybrid deep learning framework for multi-stage liver fibrosis staging across T2-weighted MRI and B-mode ultrasound
Abstract
Accurate staging of liver fibrosis is critical for guiding antifibrotic therapy and predicting disease prognosis. Liver biopsy, the current reference standard, is invasive, costly, and subject to significant sampling error. Although T2-weighted MRI and B-mode ultrasound offer established noninvasive alternatives, existing deep learning approaches are validated on a single imaging modality and lack visual interpretability. This study proposes HybridDenseViT, an explainable framework for multi-stage liver fibrosis classification applying a shared feature extraction backbone across both modalities. HybridDenseViT integrates DenseNet-121 for local texture feature extraction with ViT-B/16 for long-range spatial dependency modelling via a dual-branch parallel architecture. Training and evaluation used five-fold cross-validation: patient-level StratifiedGroupKFold on a 4-class T2W-MRI dataset (6,964 slices; 305 patients; cirrMRI600+; F0–F3) and image-level StratifiedKFold on a 5-class B-mode ultrasound dataset (6,323 images; METAVIR F0–F4). Class imbalance was corrected through an ordinal-aware class-weighted loss. Explainability used LayerCAM on the DenseNet-121 branch and Attention Rollout on the ViT-B/16 branch. On MRI, HybridDenseViT achieved an OOF Quadratic Weighted Kappa (QWK) of 0.9154 (95% CI: [0.8808, 0.9473]), 85.99% accuracy, and a patient-level QWK of 0.9406. On ultrasound, OOF QWK was 0.9958 (95% CI: [0.9930, 0.9986]) with 98.83% accuracy. Ablation with McNemar’s test confirmed the hybrid significantly outperforms individual branches on MRI (p < 10⁻⁷); no significant difference was observed on ultrasound, where all configurations reach near-ceiling performance. No non-adjacent misclassifications occurred in either modality. LayerCAM and Attention Rollout confirmed spatially complementary representations across branches. HybridDenseViT demonstrates that a shared-architecture pipeline achieves strong interpretable liver fibrosis staging across T2W-MRI and B-mode ultrasound, with hybrid benefit statistically confirmed on the patient-level MRI task. Prospective multi-site validation and volumetric extension are the primary directions for future work.