- SRL-AE (Sparse Residual LSTM Autoencoder)
- This study proposes a hybrid model, the Sparse Residual LSTM Autoencoder (SRL-AE), combining a Sparse Autoencoder and Residual LSTM to improve anomaly detection in electrocardiogram (ECG) data.
- Accepted, but not published yet. (Paper Link will be updated soon.)
- 📌 Paper Link
- 📌 Doby's Lab (Blog Description)
# Clone this Repository
git clone https://github.com/drawcodeboy/SRL-AE.git
# Virtual Environment
python -m venv .venv
.venv\Scripts\activate # Window commands
# Install Packages
pip install -r requirements.txt
# You need to download the dataset(ECG5000), and place it under the data directory.
# <<Train or Test>>
# train LSTM-AE (CPU), if you want train on GPU, use argument "--use-cuda"
python train.py --model=LSTM-AE
# test LSTM-AE (CPU)
python test.py --model=LSTM-AE --weights-filename=LSTM-AE_{epochs}.pth
# train SRL-AE (CPU)
python train.py --model=SRL-AE
# test SRL-AE (CPU)
python test.py --model=SRL-AE --weights-filename=SRL-AE_{epochs}.pth
- It is interpreted that the decoder intentionally makes reconstruction difficult through residual connections, so normal data can be easily reconstructed, while abnormal data becomes difficult to reconstruct.
Accuracy | F1-Score | Normal Loss Mean | Loss Gap | |
---|---|---|---|---|
Both | 0.983 | 0.972 | 5.208 | 16.003 |
Encoder | 0.954 | 0.923 | 6.980 | 15.914 |
Decoder | 0.986 | 0.977 | 4.828 | 17.028 |
- A Sparse Autoencoder was used in the encoder to effectively extract simple patterns from normal data through sparsity constraints. This was demonstrated by conducting a quantitative evaluation using t-SNE.
![]() |
![]() |
---|
- To demonstrate the robustness of the SRL-AE model, experiments were conducted with four models. All models were trained using the same method, and their performance was evaluated. Compared to the conventional LSTM Autoencoder, the SRL-AE model showed slight differences in accuracy and F1-Score but demonstrated significant improvements in robustness metrics, thereby enhancing the reliability of the model's inference results.
Accuracy | F1-Score | Normal Loss Mean | Loss Gap | |
---|---|---|---|---|
LSTM-AE | 0.986 | 0.978 | 5.240 | 15.096 |
Residual LSTM-AE | 0.986 | 0.977 | 4.828 | 17.028 |
Sparse LSTM-AE | 0.987 | 0.979 | 5.010 | 16.280 |
SRL-AE (Ours) | 0.986 | 0.977 | 4.332 | 17.320 |
![]() |
![]() |
---|---|
![]() |
![]() |
- Hou, Borui, et al. "LSTM-based auto-encoder model for ECG arrhythmias classification." IEEE Transactions on Instrumentation and Measurement 69.4 (2019): 1232-1240.
- Farady, Isack, et al. "ECG Anomaly Detection with LSTM-Autoencoder for Heartbeat Analy sis." 2024 IEEE International Conference on Consumer Electronics (ICCE). IEEE, 2024.
- Dutta, Koustav, et al. "MED-NET: a novel approach to ECG anomaly detection using LSTM auto-encoders." International Journal of Computer Applications in Technology 65.4 (2021): 343-357.
- Matias, Pedro, et al. "Robust Anomaly Detection in Time Series through Variational AutoEncoders and a Local Similarity Score." Biosignals. 2021.
- Alamr, Abrar, and Abdelmonim Artoli. "Unsu pervised transformer-based anomaly detection in ECG signals." Algorithms 16.3 (2023): 152.
- ECG5000-Dataset, “http://timeseriesclassification.com/description.php?Dataset=ECG5000,“ Access Date: 2024/08/23.
- Wei, Yuanyuan, et al. LSTM-autoencoder-based anomaly detection for indoor air quality time-ser ies data." IEEE Sensors Journal 23.4 (2023): 3787-3800.
- Kim, Jaeyoung, Mostafa El-Khamy, and Jung won Lee. "Residual LSTM: Design of a deep recurrent architecture for distant speech recognition." arXiv preprint arXiv:1701.03360 (2017).
- Ng, Andrew. "Sparse autoencoder." CS294A Lecture notes 72.2011 (2011): 1-19.