CoolFace
Apppublic

Dumpers/ecg-image-classifier

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

ECG Image-Based Arrhythmia Classifier

Classifies ECG images into three categories using MobileNetV2, and shows which parts of the image influenced the prediction using Grad-CAM.

Classes

  • —Abnormal Heartbeat
  • —History of Myocardial Infarction
  • —Normal Person

Results

Four pretrained CNN models were compared using 5-fold stratified cross-validation on a dataset of 707 ECG images.

ModelTest Accuracy
ResNet1898.13%
MobileNetV299.07%
EfficientNetB094.39%
VGG19-BN97.20%

MobileNetV2 performed best and is used in the demo.

Running locally

Install dependencies:

pip install -r requirements.txt

Train the model and save weights:

python train_and_save.py

Launch the app:

python app.py

Dataset

The dataset is not included in this repository due to size. Place the ECG Dataset 2 folder in the project root before training. The folder should contain three subfolders matching the class names above.