Objective. Myocarditis poses a significant health risk, often precipitated by viral infections like
coronavirus disease, and can lead to fatal cardiac complications. As a less invasive alternative to the
standard diagnostic practice of endomyocardial biopsy, which is highly invasive and thus limited to
severe cases, cardiac magnetic resonance (CMR) imaging offers a promising solution for detecting
myocardial abnormalities. Approach. This study introduces a deep model called ELRL-MD that
combines ensemble learning and reinforcement learning (RL) for effective myocarditis diagnosis
from CMR images. The model begins with pre-training via the artificial bee colony (ABC)
algorithm to enhance the starting point for learning. An array of convolutional neural networks
(CNNs) then works in concert to extract and integrate features from CMR images for accurate
diagnosis. Leveraging the Z-Alizadeh Sani myocarditis CMR dataset, the model employs RL to
navigate the dataset’s imbalance by conceptualizing diagnosis as a decision-making process.
Main results. ELRL-DM demonstrates remarkable efficacy, surpassing other deep learning,
conventional machine learning, and transfer learning models, achieving an F-measure of 88.2%
and a geometric mean of 90.6%. Extensive experimentation helped pinpoint the optimal reward
function settings and the perfect count of CNNs. Significance. The study addresses the primary
technical challenge of inherent data imbalance in CMR imaging datasets and the risk of models
converging on local optima due to suboptimal initial weight settings. Further analysis, leaving out
ABC and RL components, confirmed their contributions to the model’s overall performance,
underscoring the effectiveness of addressing these critical technical challenges.