BaselineRemove¶
- class torch_ecg.preprocessors.BaselineRemove(fs: numbers.Real, window1: float = 0.2, window2: float = 0.6, inplace: bool = True, **kwargs: Any)[source]¶
Bases:
torch.nn.modules.module.Module
Baseline removal using median filtering.
- Parameters
fs (numbers.Real) – Sampling frequency of the ECG signal to be filtered.
window1 (float, default 0.2) – The smaller window size of the median filter, with units in seconds.
window2 (float, default 0.6) – The larger window size of the median filter, with units in seconds.
inplace (bool, default True) – Whether to perform the filtering in-place.
kwargs (dict, optional) – Other keyword arguments for
torch.nn.Module
.
- forward(sig: torch.Tensor) torch.Tensor [source]¶
Apply the preprocessor to the signal tensor.
- Parameters
sig (torch.Tensor) – The ECG signal tensor, of shape
(batch, lead, siglen)
.- Returns
The median filtered (hence baseline removed) ECG signals, of shape
(batch, lead, siglen)
.- Return type