Editing
AI in Wearables
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''AFib detection from PPG signal using 1D CNN:''' <syntaxhighlight lang="python"> import torch import torch.nn as nn import numpy as np from scipy.signal import butter, filtfilt def preprocess_ppg(signal: np.ndarray, fs: int = 50) -> np.ndarray: """Bandpass filter PPG signal and normalize.""" b, a = butter(4, [0.5/(fs/2), 8/(fs/2)], btype='band') filtered = filtfilt(b, a, signal) return (filtered - filtered.mean()) / (filtered.std() + 1e-8) class PPG_AFibDetector(nn.Module): """1D CNN for AFib detection from PPG signal windows.""" def __init__(self, window_seconds=30, fs=50): super().__init__() self.conv_layers = nn.Sequential( # Multi-scale temporal convolutions nn.Conv1d(1, 32, kernel_size=5, padding=2), nn.BatchNorm1d(32), nn.ReLU(), nn.Conv1d(32, 64, kernel_size=5, padding=2), nn.BatchNorm1d(64), nn.ReLU(), nn.MaxPool1d(4), nn.Conv1d(64, 128, kernel_size=3, padding=1), nn.BatchNorm1d(128), nn.ReLU(), nn.Conv1d(128, 128, kernel_size=3, padding=1), nn.BatchNorm1d(128), nn.ReLU(), nn.MaxPool1d(4), nn.Conv1d(128, 256, kernel_size=3, padding=1), nn.BatchNorm1d(256), nn.ReLU(), nn.AdaptiveAvgPool1d(16) ) self.classifier = nn.Sequential( nn.Linear(256 * 16, 256), nn.ReLU(), nn.Dropout(0.5), nn.Linear(256, 64), nn.ReLU(), nn.Dropout(0.3), nn.Linear(64, 1) # Binary: AFib vs. normal sinus rhythm ) def forward(self, x): # x: (B, 1, T) feat = self.conv_layers(x).flatten(1) return self.classifier(feat) # Additional HRV features (model inputs alongside raw PPG) def extract_hrv_features(rr_intervals: np.ndarray) -> dict: """Extract heart rate variability features from RR intervals (ms).""" return { 'rmssd': np.sqrt(np.mean(np.diff(rr_intervals)**2)), # HRV 'sdnn': np.std(rr_intervals), 'pnn50': np.mean(np.abs(np.diff(rr_intervals)) > 50), # AFib indicator 'irregularity': np.std(np.diff(rr_intervals)), # Key AFib feature 'mean_rr': np.mean(rr_intervals) } model = PPG_AFibDetector() # Train on PhysioNet/CinC Challenge 2017: 8,528 short ECG/PPG recordings # Labels: Normal, AFib, Other rhythm, Noise </syntaxhighlight> ; Wearable health AI applications : '''AFib detection''' β Apple Watch ECG (FDA cleared), Fitbit ECG, AliveCor KardiaMobile : '''CGM + AI''' β Dexcom Clarity, Abbott LibreView; closed loop: Tandem Control-IQ : '''Sleep''' β Oura Ring, WHOOP, Fitbit sleep staging : '''Fall detection''' β Apple Watch, Samsung Galaxy Watch, Fall detection algos (FDA cleared) : '''Seizure''' β Empatica Embrace2 (FDA De Novo cleared) : '''General health''' β Apple HealthKit ML, Google Fitbit Health Studies </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information