Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,123 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
# GEM: Empowering MLLM for Grounded ECG Understanding with Time Series and Images
|
| 5 |
+
|
| 6 |
+
<!-- <p align="left">
|
| 7 |
+
<img src="pics/fig1_v.png" width="90%">
|
| 8 |
+
</p> -->
|
| 9 |
+
|
| 10 |
+
## Introduction
|
| 11 |
+
|
| 12 |
+
GEM is a multimodal LLM unifying ECG time series, 12-lead ECG images and text for grounded and clinician-aligned ECG interpretation. GEM enables feature-grounded analysis, evidence-driven reasoning, and a clinician-like diagnostic process.
|
| 13 |
+
|
| 14 |
+
## π₯ Updates
|
| 15 |
+
|
| 16 |
+
#### Paper: π [Arxiv](https://arxiv.org/pdf/2503.06073)
|
| 17 |
+
|
| 18 |
+
#### Model: π€ [GEM](https://huggingface.co/LANSG/GEM)
|
| 19 |
+
|
| 20 |
+
#### Data: π€ [ECG-Grounding](https://huggingface.co/datasets/LANSG/ECG-Grounding)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
## Setup
|
| 24 |
+
|
| 25 |
+
```shell
|
| 26 |
+
git clone https://github.com/lanxiang1017/GEM.git
|
| 27 |
+
bash GEM/setup.sh
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Data Preparation
|
| 31 |
+
|
| 32 |
+
Please download required data:
|
| 33 |
+
|
| 34 |
+
ECG:
|
| 35 |
+
- [MIMIC-IV](https://physionet.org/content/mimic-iv-ecg/1.0/)
|
| 36 |
+
- [PTB-XL](https://physionet.org/content/ptb-xl/1.0.3/)
|
| 37 |
+
- [Code-15%](https://zenodo.org/records/4916206)
|
| 38 |
+
- [CPSC 2018](https://physionet.org/content/challenge-2020/1.0.2/training/cpsc_2018/)
|
| 39 |
+
- [CSN](https://physionet.org/content/ecg-arrhythmia/1.0.0/)
|
| 40 |
+
- [G12E](https://physionet.org/content/challenge-2020/1.0.2/training/georgia/)
|
| 41 |
+
|
| 42 |
+
Images:
|
| 43 |
+
- [ECG-Grounding-Images](https://huggingface.co/datasets/LANSG/ECG-Grounding) (mimic_gen)
|
| 44 |
+
- [ECG-Bench](https://huggingface.co/datasets/PULSE-ECG/ECGBench)
|
| 45 |
+
|
| 46 |
+
After downloading all of them, organize the data as follows in `./data`,
|
| 47 |
+
|
| 48 |
+
```
|
| 49 |
+
βββ ecg_timeseries
|
| 50 |
+
βββ champan-shaoxing
|
| 51 |
+
βββ code15
|
| 52 |
+
βββ cpsc2018
|
| 53 |
+
βββ ptbxl
|
| 54 |
+
βββ georgia
|
| 55 |
+
βββ mimic-iv
|
| 56 |
+
βββ ecg_images
|
| 57 |
+
βββ cod15_v4
|
| 58 |
+
βββ csn_aug_all_layout_papersize
|
| 59 |
+
βββ csn_ori_layout_papersize
|
| 60 |
+
βββ csn_part_noise_layout_papersize
|
| 61 |
+
βββ gen_images
|
| 62 |
+
βββ mimic_gen
|
| 63 |
+
βββ mimic
|
| 64 |
+
βββ mimic_v4
|
| 65 |
+
βββ ptb-xl
|
| 66 |
+
βββ ecg_bench
|
| 67 |
+
βββ images
|
| 68 |
+
βββ jsons
|
| 69 |
+
βββ ecg_jsons
|
| 70 |
+
βββ ECG_Grounding_30k.json
|
| 71 |
+
βββ ECG_Grounding_130k.json
|
| 72 |
+
βββ ecg_grounding_test_data
|
| 73 |
+
βββ ecg-grounding-test.json
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Pretrained Model Preparation
|
| 78 |
+
|
| 79 |
+
Pretrained ECG Encoder:
|
| 80 |
+
- [ECG-CoCa](https://github.com/YubaoZhao/ECG-Chat) : place it in ```GEM/ecg_coca/open_clip/checkpoint```
|
| 81 |
+
|
| 82 |
+
Pretrained MLLMs:
|
| 83 |
+
- [PULSE](https://huggingface.co/PULSE-ECG/PULSE-7B)
|
| 84 |
+
- [LLaVA](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-7b)
|
| 85 |
+
|
| 86 |
+
## Train
|
| 87 |
+
|
| 88 |
+
```bash GEM/scripts/train_gem.sh```
|
| 89 |
+
|
| 90 |
+
## Evaluation
|
| 91 |
+
|
| 92 |
+
For ECG-Grounding:
|
| 93 |
+
- step 1. generate interpretations: ```GEM/evaluation/gem_bench/bench_ecggrounding.sh```
|
| 94 |
+
- step 2. process interpretations: ```GEM/gem_evaluation/process_gem_outputs.ipynb```
|
| 95 |
+
- step 3. generate GPT evaluation reports: ```GEM/gem_evaluation/generate_gpt_eval.py```
|
| 96 |
+
- step 4. process evaluation reports and get scores: ```GEM/gem_evaluation/process_grounding_scores.ipynb```
|
| 97 |
+
|
| 98 |
+
For ECG-Bench:
|
| 99 |
+
- step 1. generate results: ```GEM/evaluation/gem_bench/bench_ecggrounding.sh```
|
| 100 |
+
- step 2. evaluate results: ```GEM/evaluation/evaluate_ecgbench.py```
|
| 101 |
+
- step 3. evaluate reports: ```GEM/evaluation/eval_report.py```
|
| 102 |
+
|
| 103 |
+
*Note: You'll need to specify result paths first in all evaluation scripts*
|
| 104 |
+
|
| 105 |
+
## Citation
|
| 106 |
+
|
| 107 |
+
If you find GEM helpful for your research and applications, please cite our paper:
|
| 108 |
+
|
| 109 |
+
```bibtex
|
| 110 |
+
@misc{lan2025gemempoweringmllmgrounded,
|
| 111 |
+
title={GEM: Empowering MLLM for Grounded ECG Understanding with Time Series and Images},
|
| 112 |
+
author={Xiang Lan and Feng Wu and Kai He and Qinghao Zhao and Shenda Hong and Mengling Feng},
|
| 113 |
+
year={2025},
|
| 114 |
+
eprint={2503.06073},
|
| 115 |
+
archivePrefix={arXiv},
|
| 116 |
+
primaryClass={cs.CL},
|
| 117 |
+
url={https://arxiv.org/abs/2503.06073},
|
| 118 |
+
}
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
## Acknowledgement
|
| 122 |
+
We thank the authors of [PULSE](https://github.com/AIMedLab/PULSE/tree/dev) and [ECG-Chat](https://github.com/YubaoZhao/ECG-Chat) for their publicly released models, datasets, and training codes.
|
| 123 |
+
|