| # ECG Digitization Experiments |
|
|
| This repository contains archived PyTorch `.pth` checkpoints from ECG digitization research experiments (Kaggle competition). |
|
|
| ## About |
|
|
| These are model weights for ECG image-to-signal digitization - extracting ECG waveform values from paper ECG images. |
|
|
| **Competition:** [ECG Image Digitization Challenge](https://www.kaggle.com/competitions/ecg-image-digitization) |
|
|
| ## Experiments Overview |
|
|
| | Experiment | Architecture | Description | Best SNR | |
| |------------|--------------|-------------|----------| |
| | v7 | EfficientNet-B4 | Early baseline | ~15 dB | |
| | v9 | EfficientNet-B4 | Improved training | ~16 dB | |
| | v10 | EfficientNet-B4 | Multi-scale features | ~17 dB | |
| | v10_1 | EfficientNet-B4 | Refinements | ~17 dB | |
| | v11 | EfficientNet-B4 | 1.5x scale | ~17 dB | |
| | v14 | ConvNeXt + SimDR | SimDR heatmap approach | ~18 dB | |
| | v15 | Per-Lead CNN | Per-lead extraction | ~18 dB | |
| | v16 | Per-Lead + BiLSTM | Temporal coherence | ~19 dB | |
| | v18 | Refiner Network | Post-processing refiner | ~19 dB | |
| | v19 | Augraphy Augmentation | Paper degradation aug | ~20 dB | |
| | v20 | Integral Regression | Integral loss | ~20 dB | |
| | v21 | GRU Refiner | GRU-based refinement | ~20 dB | |
| | v22 | ConvNeXt-Base + U-Net | Multi-scale fusion + Height Attention + BiLSTM | ~22 dB | |
| | **v23** | **V22 + DSNT** | **DSNT Sub-Pixel Head (Rank 3 technique)** | **~22.35 dB** | |
| | mixed | Various | Early mixed training | ~16 dB | |
| | mixed_v4 | Various | Mixed v4 | ~17 dB | |
| | mixed_v5 | Various | Mixed v5 | ~17 dB | |
| |
| ## V23 Architecture (Best Model) |
| |
| ``` |
| β ConvNeXt-Base Encoder β L3 + L4 multi-scale features |
| β‘ Feature Fusion (fine details + semantics) |
| β’ U-Net Decoder with skip connections |
| β£ Height Attention (learns vertical regions) |
| β€ BiLSTM (temporal coherence) |
| β₯ Conv1D + Linear β Sigmoid (V22 head) |
| β¦ DSNT Sub-Pixel Head (Rank 3 winner technique) |
| ``` |
| |
| ## Directory Structure |
| |
| ``` |
| βββ README.md |
| βββ v7/ # EfficientNet-B4 baseline |
| βββ v9/ # Improved training |
| βββ v10/ # Multi-scale features |
| βββ v10_1/ # Refinements |
| βββ v11/ # 1.5x scale |
| βββ v14/ # ConvNeXt + SimDR |
| βββ v15/ # Per-lead CNN |
| βββ v16/ # Per-lead + BiLSTM |
| βββ v18/ # Refiner network |
| βββ v19/ # Augraphy augmentation |
| βββ v20/ # Integral regression |
| βββ v21/ # GRU refiner |
| βββ v22/ # ConvNeXt-Base + U-Net |
| βββ v23/ # V22 + DSNT (BEST) |
| βββ mixed/ # Mixed training v1 |
| βββ mixed_v4/ # Mixed training v4 |
| βββ mixed_v5/ # Mixed training v5 |
| βββ code/ |
| βββ scripts/ # All training scripts |
| βββ notebooks/ # Kaggle inference notebooks |
| ``` |
| |
| ## Checkpoint Format |
|
|
| Each `.pth` file contains: |
| - `model`: Model state dict |
| - `opt`: Optimizer state dict |
| - `epoch`: Training epoch |
| - `snr`: Validation SNR (dB) |
| - `mae`: Mean Absolute Error (pixels) |
|
|
| ## Usage |
|
|
| ```python |
| import torch |
| |
| # Load checkpoint |
| checkpoint = torch.load("v23/v23_epoch038.pth", map_location="cpu") |
| |
| # Load model state |
| model.load_state_dict(checkpoint['model']) |
| |
| # Check metrics |
| print(f"Epoch: {checkpoint['epoch']}") |
| print(f"SNR: {checkpoint['snr']:.2f} dB") |
| ``` |
|
|
| ## Key Files |
|
|
| - `v23/v23_epoch038.pth` - Best V23 checkpoint (22.35 dB) |
| - `v22/v22_best_snr.pth` - Best V22 checkpoint |
| - `code/scripts/train_v23.py` - V23 training script |
| - `code/scripts/inference_v23.py` - V23 inference script |
| - `code/notebooks/kaggle_v23_inference.ipynb` - Kaggle submission notebook |
|
|
| ## License |
|
|
| Research use only. Please cite if you use these weights. |
|
|
| ## Framework |
|
|
| - PyTorch 2.x |
| - timm (ConvNeXt-Base encoder) |
| - albumentations (augmentation) |
|
|