💡 Inspiration
Cardiovascular disease remains the leading cause of death globally. While the 12-lead ECG is the gold standard for diagnosis, interpreting these signals is notoriously difficult—even for residents. A subtle ST-elevation or a T-wave inversion can easily be missed in a busy ER.
We were inspired to build Cardio-AI not just to "classify numbers," but to solve the "Black Box" problem in medical AI. We didn't want a system that just says "Probability: 90%." We wanted a system that could act as a true digital colleague, one that points to the exact heartbeat and says, "Look here. This T-wave morphology is suspicious."
🩺 What it does
Cardio-AI is an interpretable Deep Learning system that detects 5 major cardiovascular pathologies (including Myocardial Infarction and Ischemia) from raw 12-lead ECG signals.
It goes beyond simple classification by generating a Clinical Dashboard that:
- Stratifies Risk: Uses calibrated thresholds to flag patients as "Low," "Moderate," or "High" risk.
- Visualizes Evidence: Uses Grad-CAM (Gradient-weighted Class Activation Mapping) to project heatmaps onto the ECG, highlighting the specific waveforms (like the ST-segment) that triggered the diagnosis.
⚙️ How we built it
We adopted a "First Principles" approach to Geometric Deep Learning.
- Architecture: We built a custom 1D-ResNet backbone optimized for time-series data. We enhanced it with Squeeze-and-Excitation (SE) Blocks, which allow the network to dynamically "attend" to specific leads (e.g., prioritizing Lead II over Lead aVR) depending on the signal context.
- Data Pipeline: We used the PTB-XL dataset (21,000+ records). We implemented a rigorous preprocessing pipeline including 100Hz downsampling and Z-score normalization.
- Math & Optimization: To handle the massive class imbalance (healthy patients far outnumber sick ones), we replaced standard Cross-Entropy Loss with Focal Loss:
This mathematically down-weights "easy" examples and forces the model to focus its gradient energy on hard, rare cases like Conduction Disturbances.
🚧 Challenges we ran into
Our biggest hurdle was the "Clean Data Bias."
Midway through the project, we discovered a critical failure mode: The model assigned a higher risk score (28%) to a healthy patient with a loose electrode artifact (Patient 2400) than to a patient with a confirmed heart attack (Patient 63, 26%). The model had learned that "Signal Noise = Disease."
The Fix: We couldn't just tune hyperparameters. We engineered a Robust Training Pipeline with Online Noise Injection.
- We mathematically generated random Gaussian noise and amplitude scaling artifacts on the fly during training.
- We forced the model to classify these noisy signals as "Normal."
- We implemented Low-LR Fine-Tuning (learning rate ) to settle the weights.
The Result: The model learned to distinguish artifacts from pathology. In the final version, the Heart Attack patient's score jumped to 49%, while the Noisy Healthy patient correctly stayed at 27%.
🏆 Accomplishments that we're proud of
- SOTA Performance: Achieving a Macro-AUC of 0.920 on the test set, with Ischemia detection reaching 0.93.
- The "Safety Net": We successfully calibrated the model so that no confirmed heart attack in our validation set was missed (Sensitivity prioritization).
- Interpretability: Seeing the Grad-CAM heatmap correctly light up the T-Wave on a patient with ischemia was a definitive "Aha!" moment, proving the model learned the actual cardiology, not just statistical shortcuts.
🧠 What we learned
- Data-Centric AI is Key: The improvements didn't come from making the neural network deeper; they came from fixing how the model perceived noise via augmentation.
- Calibration Matters: A raw probability score is useless to a doctor. Mapping those probabilities to clinically relevant risk tiers ("High" vs "Moderate") is the bridge between code and care.
🚀 What's next for Cardio-AI
- Real-Time Deployment: Porting the PyTorch model to ONNX for edge deployment on portable ECG devices.
- Text Generation: Integrating an LLM to generate natural language reports (e.g., "Sinus rhythm with marked ST-elevation in Lead II") based on the model's feature vectors.
Log in or sign up for Devpost to join the conversation.