Skip to content

Neural networks trained to categorize heartbeat ECG's using mitbit and ptbdb datasets

License

Notifications You must be signed in to change notification settings

Red1C3/ecg-heartbeat-categorization-cnn-mlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mitbih-ptbdb-ecg-heartbeat-categorization

We used these datasets to train a CNN and an MLP.

Datasets

MITBIH

Testing Set Count

Training Set Count

Category

18118

72471

Category - N

556

2223

Category - S

1448

5788

Category - V

162

641

Category - F

1608

6431

Category - Q

Samples Count: 109446

Categories Count: 5

Sampling Frequency: 125Hz

Data Source: Physionet's MIT-BIH Arrhythmia Dataset

Categories:

  • N : Non-ecotic beats (normal beat)
  • S : Supraventricular ectopic beats
  • V : Ventricular ectopic beats
  • F : Fusion Beats
  • Q : Unknown Beats

PTBDB

4046

Normal

10506

Abnormal

Samples Count: 14552

Categories Count: 2

Sampling Frequency: 125Hz

Data Source: Physionet's PTB Diagnostic Database

Data Balancing

We used Fourier method to generate more signals so all the categories are of the same size.

Neural Networks Architectures

CNN

Layer (type)

Output Shape

#Param

Activation Function

Conv1D-64/7 (Conv1D)

(None, 181, 64)

512

ReLU

SD1D-0.4 (SpatialDropout1D)

(None, 181, 64)

0

-

BN-1 (BatchNormalization)

(None, 181, 64)

256

-

MP1D-7 (MaxPooling1D)

(None, 25, 64)

0

-

Conv1D-32/5 (Conv1D)

(None, 21, 32)

10272

ReLU

BN-2 (BatchNormalization)

(None, 21, 32)

128

-

MP1D-5 (MaxPooling1D)

(None, 4, 32)

0

-

GMP1D (GlobalMaxPooling1D)

(None, 32)

0

-

Output (Dense)

(None, 5)

165  

Softmax / Sigmoid

Total params: 11,333

Trainable params: 11,141

Non-trainable params: 192

MLP

Layer (type)

Output Shape

#Param

Activation Function

Dense-64 (Dense)

(None, 64)

12032

ReLU

Dropout-0.25 (Dropout)

(None, 64)

0

-

Dense-32 (Dense)

(None, 32)

2080

ReLU

Dense-16 (Dense)

(None, 16)

528

ReLU

Output (Dense)

(None, 5)

85

Softmax

Total params: 14,725

Trainable params: 14,725

Non-trainable params: 0

Results

CNN-MITBIH

Precision

Recall

f1-score

Support

Category-N

0.98

0.98

0.98

18118

Category-S

0.73

0.60

0.65

556

Category-V

0.94

0.91

0.93

1448

Category-F

0.49

0.85

0.62

162

Category-Q

0.96

0.99

0.97

1608

Accuracy

 0.9658322930335999

21892

Loss

 0.13102902472019196

21892

Macro Avg

0.82

0.86

0.83

21892

Weighted Avg

0.97

0.97

0.97

21892

cnn-mitbih

CNN-PTBDB

Precision

Recall

f1-score

Support

Normal

0.97

0.99

0.98

818

Abnormal

1.00

0.99

0.99

2093

Accuracy

0.9900377988815308

2911

Loss

0.0375625379383564

2911

Macro Avg

0.99

0.99

0.99

2911

Weighted Avg

0.99

0.99

0.99

2911

cnn-ptbdb

MLP-MITBIH

Precision

Recall

f1-score

Support

Category-N

0.97

0.99

0.98

18118

Category-S

0.76

0.60

0.67

556

Category-V

0.93

0.84

0.88

1448

Category-F

0.72

0.64

0.68

162

Category-Q

0.98

0.92

0.95

1608

Accuracy

0.9611730575561523

21892

Loss

0.15909039974212646

21892

Macro Avg

0.87

0.80

0.83

21892

Weighted Avg

0.96

0.96

0.96

21892

mlp-mitbih

MLP-PTBDB

Precision

Recall

f1-score

Support

Normal

0.93

0.94

0.94

818

Abnormal

0.98

0.97

0.97

2093

Accuracy

0.9639298915863037

2911

Loss

0.12964512407779694

2911

Macro Avg

0.95

0.96

0.96

2911

Weighted Avg

0.96

0.96

0.96

2911

mlp-ptbdb

License

Unlicense