compressionkit-ecg-hybrid-2x

A ECG signal compression codec: a learned wavelet-gain denoiser (trained weights) followed by wavelet + SPIHT + arithmetic coding. The deployable artifact is the denoiser weights, the bitstream contract, and a portable C99 reference implementation for the SPIHT stage.

Operating point

Field Value
Modality ECG
Sample rate 256 Hz
Frame size 512 samples
Target CR 2x
Wavelet bior4.4
DWT levels 6
Bit budget 4096 bits/frame
Entropy coder arithmetic coding

Quality metrics

Fidelity & Robustness

Both fidelity yardsticks are reported so the codec is judged fairly: faithfulness is PRD vs the recorded (still-noisy) input, while truth fidelity is PRD vs clean ground truth. Lower is better.

Metric Value
Truth PRD vs clean (%) 7.68
Truth PRD at native noise (%) 34.61
Faithful PRD vs input (%) 8.97
PRD degradation slope (PRD%/dB) 2.42
PRD at 0 dB SNR (%) 37.88
PRD at -6 dB SNR (%) 54.38
Pure-noise imprint autocorr 0.1242

Time Domain

PRD here is faithfulness (vs the recorded input); see Fidelity & Robustness above for the clean-truth and noise-regime view.

Metric Mean Median P90
PRD vs input โ€” faithfulness (%) 8.9669 7.3373 14.5582
RMSE 0.0897 0.0734 0.1456
Cosine Similarity 0.9948 0.9979 0.9995

Spectral

  • Band Total Relative Error (median): 0.1385

Bitrate

Python quickstart

from compressionkit.runtime import load_codec

codec = load_codec("Ambiq/compressionkit-ecg-hybrid-2x")
enc = codec.compress(frame)   # frame: (frame_size,) float32
recon = codec.decompress(enc)

C quickstart

The SPIHT stage ships a portable C99 reference; the denoiser (denoiser_gain_model.keras) currently only has a Python/TFLite runtime path. Run the denoiser stage first (Python, or a converted TFLite Micro model) and feed its output into the C SPIHT encoder below.

#include "spiht_app_config.h"

float frame[APP_SPIHT_FRAME_SIZE];
uint8_t bitstream[APP_SPIHT_MAX_BYTES];
/* ... fill frame from sensor (post-denoise, if hybrid) ... */
size_t nbits = spiht_encode_frame(&enc, bitstream, APP_SPIHT_MAX_BITS);

Files

File Description
config.json Deploy manifest (family: "hybrid")
spiht_config.json Codec parameters (language-neutral)
sample_stimulus.npz Synthetic test frames
reference_vectors.npz Reference encode/decode vectors
c_sources/spiht.[ch] Portable C99 reference
c_sources/spiht_app_config.h Codec-specific defines
model_card.json Provenance metadata
scorecard.json Frozen evaluation summary
denoiser_gain_model.keras Learned wavelet-gain denoiser (trained weights)
hybrid_manifest.json Pipeline stage order (denoise โ†’ SPIHT)

Dataset & license

Evaluation data: PTB-XL (CC BY 4.0). Sample data may include excerpts under the original license terms.

Codec source released under the OTHER license.

Citation

@software{compressionkit,
  author = {Ambiq AI},
  title = {compressionKIT: Signal Compression for Edge AI},
  url = {https://github.com/AmbiqAI/compressionkit}
}
Downloads last month
53
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support