Ubuntu
Add README
a6b2e50
|
Raw
History Blame Contribute Delete
3.92 kB
# 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)