Skip to main content

Library that classifies quality of ECG signal using deep learning methods

Project description

Library description

This library is meant to be used to check quality of ECG signal. Recordings of any length can be processed, memory is the only limit. The library work with three basic levels of quality:

  • Quality 1 : All important segment of ECG can be detected in the signal
  • Quality 2 : Noise is present, but the QRS complex can still be detected
  • Quality 3 : Noise is too large, not even QRS complex can be detected

Each model works with a sliding window. At each step, the window is evaluated using one of 4 models and one score from range 0 to 1 is returned. The length of sliding windows for individual models can be found in their names. The 4 supported models are:

  • cnn2s
  • cnn5s
  • lstm2s
  • oscnn2s

The stride of the sliding window can be specified. The class limits so this value is at least 1 second and is a divisor of the length of the sliding window.

There are currently 4 return modes supported:

  • score : The model returns the score between 0 and 1. 0 is meant to represent quality 1, 0.5 to represent quality 2 and 1 to represent quality 3. This is however not given and the score distributions of different qualities can differ between models.
  • three_value : Three qualities are given using thresholds.
  • bin_clean : Signal is either marked as quality 1 or as quality 2/3
  • bin_qrs: Signal is either marked as quality 1/2 or as quality 3

The thresholds used in each of these modes, except of score, can be specified by the user. However, there are default thresholds, that aim to prioritize precision with the better classes. When using three_value, the returned values are one of 1, 2 and 3, depending on the quality of the signal. When using either of the binary modes, the returned values are either 1 or 2. 1 is for the better quality signal and 2 is for the worse quality.

In terms of length of output, there are two return_types supported:

  • intervals : value is returned for each window of the size stride, since the value of the quality ill not change in these
  • full : value is returned for each value in the input

Models were trained on cleaned data. These data were cleaned using default NeuroKit2 ecg_clean method. The class can clean signal it is meant to process using ecg_clean. Currently only default version of ecg_clean us supported. It can be specified not to do this. However, it is advised to either use this option, or to pass cleaned signal to the method. We give no guarantee about the quality of the signal if uncleaned signal is processed and no cleaning is done..

Signal processed must have frequency of 250 Hz. Signal of other frequencies is not supported as the models are not trained on such a signal.

Full explanation of all the modes can be found inside the source code documentation.

Installation

The library can be easily installed through the pip utility.

pip install ecg-quality

Usage

The library offers a high-level interface. The simplest example using all the default settings:

from ecg_quality.ECGQualityChecker import ECGQualityChecker  

checker = ECGQualityChecker()  
 
signal = ...	 

output = checker.process_signal(signal)  

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecg_quality-0.2.0.tar.gz (8.3 MB view details)

Uploaded Source

Built Distribution

ecg_quality-0.2.0-py3-none-any.whl (8.3 MB view details)

Uploaded Python 3

File details

Details for the file ecg_quality-0.2.0.tar.gz.

File metadata

  • Download URL: ecg_quality-0.2.0.tar.gz
  • Upload date:
  • Size: 8.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for ecg_quality-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4d6fc839204367d727675ec4d2ab8425663990e9b05849b66b8511c5f7bb43d5
MD5 f7c9b020a77b6905727e27fe40dcff6f
BLAKE2b-256 e2b024c8ef3c9e750e702a353af3c82c5d0caab42bfef043b996238f9f90a7ed

See more details on using hashes here.

File details

Details for the file ecg_quality-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ecg_quality-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for ecg_quality-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9713b2ccc4ee65137f47f2293f83bb2ab2f8a848e016b0329c453264e38bba
MD5 fb176a8938a2cf875493eb4d85f30cda
BLAKE2b-256 ac81c41b48cdb30df30ca33a3c9695fd981afe760073a59b988ad89598673762

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page