---
title: 'CaPulse: Robust Pulse Extraction & Anomaly Detection'
url: https://www.emergentmind.com/topics/capulse
type: topic
---

# CaPulse: Robust Pulse Extraction & Anomaly Detection

CaPulse refers to a set of algorithmic and deep learning frameworks developed for (i) accurate, artifact-resistant pulse (heart rate) estimation from photoplethysmographic (PPG) signals (notably from video or wearable sensors) and (ii) causality-driven unsupervised anomaly detection in multivariate time series. While the term appears in several contexts, most notably in smartphone-based PPG heart-rate tracking and in modern causal anomaly detection, all share a focus on extracting physiologically or causally significant “pulses” from noisy data and achieving superior interpretability and accuracy.

## 1. CaPulse for Smartphone PPG Heart Rate Extraction

The earliest documented CaPulse scheme addresses robust estimation of beats-per-minute (BPM) from PPG signals acquired via smartphone cameras, emphasizing strong artifact rejection, accurate temporal/frequency processing, and alignment with clinical ECG [2012.02263]. The workflow encompasses:

- **Frame Acquisition and Touch Artifact Elimination:** The user places a fingertip over the rear camera under LED illumination; video frames are acquired at a constant rate (e.g., $f_s=30$ Hz), with a $50\times50$ pixel central ROI analyzed.
  
  - The raw PPG per frame is $\,\overline{R}[n] = \frac{1}{|\text{ROI}|} \sum_{(i,j)\in\text{ROI}} R_n(i,j)\,$, where $R_n(i,j)$ is the red-channel intensity.
  
  - Touch artifacts (abrupt changes $|\Delta R[n]|>T$, $T=15$ for 8-bit intensity) are detected and excised via filtering, then linearly interpolated or median-filtered for continuity.

- **Signal Conditioning:** A second-order Butterworth IIR bandpass filter for $0.75$–$3.5$ Hz (45–210 bpm), prototype
  $$
  H(e^{j\omega}) = \frac{b_0 + b_1 e^{-j\omega} + b_2 e^{-j2\omega}}{1 + a_1 e^{-j\omega} + a_2 e^{-j2\omega}},
  $$
  with coefficients $b_0=0.020083,$ $b_1=0,$ $b_2=-0.020083,$ $a_1=-1.561018,$ $a_2=0.641352$ for $f_s=30$ Hz.

- **Spectral Analysis:** A Hann window $w[n]=\tfrac12(1-\cos(2\pi n/(N_w-1)))$ is applied before frequency-domain analysis to suppress spectral leakage.

- **BPM Estimation:** Time-domain peak detection (local maxima above $(\text{mean}+\text{std})$ thresholding) and frequency-domain (FFT, heart-rate band localization, and median aggregation) routes are both implemented, with pseudocode provided for reproducibility.

- **Performance:** On a 20-subject evaluation, mean absolute error is 1.3 bpm (σ=1.8 bpm) for time-domain, 1.0 bpm (σ=1.5 bpm) for frequency-domain, substantially outperforming existing open-source PPG algorithms in both error magnitude and clinical correlation ($r>0.98$ to ECG, outlier rate $<2\%$) [2012.02263].

## 2. Multi-Modal Fusion and Deep CaPulse Architectures

Later CaPulse frameworks address the challenges of motion artifact (notably in PPG signals recorded on wearables during free-living activities) by fusing PPG and inertial signals using deep networks, enabling improved robustness and explainability [2210.11415].

- **Architecture:**
  - Input: One-channel PPG, three-axis accelerometer, segmented in fixed windows (e.g., 4×256 samples).
  - Temporal feature extraction: Three stacked dilated 1D-convolutional blocks per modality, yielding per-modality $T\times 64$ “action embeddings.”
  - Multi-Head Cross-Attention (MHCA): PPG embeddings serve as queries, accelerometer as keys and values (4 heads, 16-dim/head). Outputs are fused via a learnable linear layer.
  - Regression head: Layer normalization and two-layer MLP regresses fused features to scalar heart-rate per window.

- **Mathematical Formulation:**
  $$
  \text{Attention:}\quad
  \text{head}_i = \mathrm{softmax}(Q_i K_i^\top/\sqrt{d_k}) V_i, \quad \text{MultiHead} = \mathrm{Concat}(\text{head}_1,...,\text{head}_h) W_O
  $$
  where $Q_i$, $K_i$, $V_i$ embed PPG and accelerometer features as described.

- **Training Regimen:** Minimization of MAE, Adam optimizer (lr=$5\!\times\!10^{-4}$), batch size 256, cross-validation with Leave-One-Session-Out. Optional post-processing clips per-window predictions deviating >10% from the running average.

- **Results:** On PPG-DaLiA, MAE = 4.44 bpm (no post), 4.03 bpm (with post); representing 7.6% improvement over best previous CNN; model size ∼130 k vs. DeepPPG’s 8.5 M parameters per ensemble. Arm-motion-driven evaluation on IEEE_Test yields comparable performance to larger models [2210.11415].

## 3. Causal Anomaly Detection in Time Series: CaPulse

A distinct, causality-driven CaPulse framework for anomaly detection in multivariate time series is introduced in [2508.04630]. Unlike pulse extraction, here “pulse” refers to the underlying “causal rhythm” of the system, formulated via a structural causal model (SCM) and learned through density modeling and periodic factorization.

- **Structural Causal Model (SCM):**
  $$
  U \rightarrow X \leftarrow C \rightarrow y
  $$
  with
  - $U$: exogenous (noise)
  - $C$: latent causal factors (generating anomalies)
  - $X$: observed time series ($\mathbb{R}^{T\times D}$)
  - $y$: anomaly labels

  Structural equations:
  $$
  X_t = f(C_t,U_t),\quad y_t = h(C_t)
  $$
  with independence $C\perp U$ and mutually independent $c_{t,1}, ..., c_{t,N}$ (independent causal mechanisms).

- **Periodic Normalizing Flows (PeNF):**
  Instead of fixed transformations, PeNF layers utilize a period checkerboard mask and invertible coupling conditioned on causal factors, enabling the flow to be aware of both global and local periodicity:
  $$
  p_X(X|C_\text{ind}) = p_Z(F_\theta(X,C_\text{ind})|C_\text{ind})\,|\det \partial F_\theta(X,C_\text{ind})/\partial X|
  $$
  with negative log-likelihood loss over standard normal base $p_Z$.

- **Periodic Mask Mechanism (PC-Mask):**
  Masks alternate along feature axes in blocks of size $p_g$, estimated as the dominant period in the signal (via FFT).
  $$
  m_{i,j} = (\lfloor j/p_g \rfloor \bmod 2)
  $$
  Partitioned inputs receive different flow transformations to capture periodic structure.

- **Periodical Learners (PaCM + MpCF):**
  - **PaCM:** Identifies top-$k$ local frequencies, reshapes subsequences, mines period-specific latent factors via small MLPs; collects amplitude weights.
  - **MpCF:** Merges period-specific factors using self-attention across $k$ periods, yielding a fused “omni” causal representation.

  To satisfy causal independence, parallel augmentation (Gaussian perturbation in the high-frequency spectrum) is performed, enforcing invariance and mutual independence through cosine-similarity ($L_\text{sim}$) and orthogonality ($L_\text{ind}$) regularizations.

  Total loss:
  $$
  L = L_\text{nf} + \alpha L_\text{sim} + \beta L_\text{ind}
  $$
  where $\alpha,\beta$ control the weighting.

- **End-to-End Pipeline:** Steps include period detection, mask construction, intervention/augmentation, multi-period causal extraction and fusion, density estimation via PeNF, and composite objective minimization.

## 4. Theoretical Foundations and Interpretability

The CaPulse anomaly framework establishes theoretical guarantees for causal disentanglement and identifiability: enforcing invariance under high-frequency (exogenous noise) perturbation induces the latent codes to capture the underlying stable, generative factors of anomaly occurrence. Orthogonality of the latent causal dimensions encourages their statistical independence, in line with the independent causal mechanisms principle.

Interpretability is direct: post-hoc tools (e.g., SHAP), attention score maps, and the amplitude or attention weights $w_p$, $\alpha_p$ reveal which latent factors or periods most contribute to detected anomalies. In pulse estimation architectures, explainability is provided via visualization of attention maps and correlation to known motion artifacts.

## 5. Experimental Evaluation and Empirical Outcomes

**PPG Heart Rate Extraction:**  
CaPulse achieves MAE = 1.0–1.3 bpm (σ = 1.5–1.8 bpm) on resting fingertip smartphone video [2012.02263], outperforming open-source alternatives (MAE = 3–5 bpm, $r\approx0.85$). In deep fusion settings, MAE = 4–5 bpm (lab/field PPG+IMU), matching or exceeding much larger networks [2210.11415].

**Causal Anomaly Detection:**  
CaPulse delivers substantially improved AUROC (+3% to +17%) on seven real-world anomalous multivariate time series, outperforming DeepSVDD, DeepSAD, DROCC, GANF, AnomalyTransformer, TimesNet, and others. Ablation studies confirm that global period masking, causal intervention, mutual independence, and multi-period attention all contribute measurably; e.g., removing causal intervention reduces AUROC by 1.8–7.0% [2508.04630].

Efficiency is strong: O($D T\log T$) per batch for FFT-based steps, linear in network depth and hidden dimensions, with WADI-scale datasets trainable in $<0.03$ s per $10$k samples/epoch on modern GPU.

## 6. Impact and Significance

CaPulse unifies artifact-robust PPG pulse extraction and state-of-the-art causal anomaly detection in time series via explicit integration of signal processing, deep learning, and causal modeling principles. Its interpretable multi-scale architectures, strong empirical error bounds, principled augmentation and regularization, and competitive computational efficiency establish it as a reference for both clinicians (PPG BPM) and system analysts (anomaly detection). A plausible implication is that the architectural and algorithmic motifs deployed in CaPulse may provide generalizable patterns for causal and periodicity-aware modeling across wider domains of structured time series.

## 7. Related Methods and Distinctions

While classical PPG-based heart rate estimation relies on bandpass filtering and peak detection, CaPulse adds robust artifact filtering and frequency-domain regularization, resulting in increased clinical correlation. In deep anomaly detection, CaPulse’s causal disentanglement and explicit periodic fusion distinguish it from purely correlation-based or principal-axes methods, facilitating improved interpretability and resilience to data imbalance and label scarcity.

Summary comparisons across the principal CaPulse variants:

| Domain                | Input Modalities     | Core Algorithmic Element      | Reported Performance      |
|-----------------------|---------------------|------------------------------|--------------------------|
| Smartphone PPG BPM    | Video-PPG           | Artifact removal + Butterworth + Hann-FFT | MAE=1.0–1.3 bpm, $r{>}0.98$ [2012.02263] |
| Wearable HR (Deep)    | PPG + 3-axis Accel  | TCN + MHCA fusion            | MAE=4.0–4.4 bpm [2210.11415]|
| Time Series Anomaly   | Multivariate X      | SCM + PaCM/MpCF + PeNF+PC-Mask| AUROC +3–17% vs SOTA [2508.04630]|

Each instantiation operationalizes the extraction or detection of physiologically or causally meaningful “pulses” via principled filtering, normalization, fusion, and causality-based density estimation.

Source: https://www.emergentmind.com/topics/capulse