Realtime Estimator Selection Guide
Overview
Choosing the right realtime estimator is crucial for your application's success. This guide helps you make an informed decision based on your specific requirements, constraints, and use cases.
Quick Decision Tree
Detailed Comparison
ME-rPPG Estimator (Default)
Best For:
- Consumer fitness and wellness applications
- Challenging lighting or motion conditions
- Applications where AI robustness is valuable
- Projects with open-source requirements
- High-end devices with good connectivity
Choose ME-rPPG if:
- ✅ Users may move slightly during measurement
- ✅ Lighting conditions vary significantly
- ✅ You can download ~10 MB of models
- ✅ Open-source licensing is required
- ✅ You want state-of-the-art AI accuracy
Avoid ME-rPPG if:
- ❌ You need instant initialization
- ❌ Bundle size is critical (< 1 MB)
- ❌ Offline-first is required immediately
- ❌ Target devices have limited memory
- ❌ Slow network connections are common
FDA Estimator
Best For:
- Medical and healthcare applications
- Regulatory compliance requirements
- Resource-constrained environments
- Embedded systems and IoT devices
- Applications requiring instant startup
Choose FDA if:
- ✅ Medical-grade accuracy is required
- ✅ You need instant initialization
- ✅ Bundle size must be minimal
- ✅ Offline capability is critical
- ✅ Proprietary IP protection is acceptable
Avoid FDA if:
- ❌ Users will be moving significantly
- ❌ Lighting conditions are uncontrolled
- ❌ You need maximum motion tolerance
- ❌ Open-source licensing is required
- ❌ AI-powered features are preferred
Feature Comparison Matrix
| Feature | ME-rPPG | FDA | Winner |
|---|---|---|---|
| Accuracy (Ideal Conditions) | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | 🤝 Tie |
| Accuracy (Motion) | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | 🤖 ME-rPPG |
| Accuracy (Poor Lighting) | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | 🤖 ME-rPPG |
| Initialization Speed | ⭐⭐⭐ (1-2s) | ⭐⭐⭐⭐⭐ (instant) | 📈 FDA |
| Processing Speed | ⭐⭐⭐⭐ (10-30ms) | ⭐⭐⭐⭐ (5-10ms) | 📈 FDA |
| Bundle Size | ⭐⭐⭐ (~10 MB) | ⭐⭐⭐⭐⭐ (~100 KB) | 📈 FDA |
| Memory Usage | ⭐⭐⭐ (~4 MB) | ⭐⭐⭐⭐⭐ (<200 KB) | 📈 FDA |
| Setup Complexity | ⭐⭐⭐ (models required) | ⭐⭐⭐⭐⭐ (zero config) | 📈 FDA |
| Licensing | ⭐⭐⭐⭐⭐ (open-source) | ⭐⭐⭐ (proprietary) | 🤖 ME-rPPG |
| Motion Tolerance | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | 🤖 ME-rPPG |
| Lighting Tolerance | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | 🤖 ME-rPPG |
| First Result | ~3 seconds | ~5 seconds | 🤖 ME-rPPG |
| Optimal Accuracy | ~10 seconds | ~10 seconds | 🤝 Tie |
Use Case Recommendations
Healthcare & Medical Applications
Recommended: FDA Estimator
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.Fda,
earlyEstimation: false, // Wait for full accuracy
minDuration: 10,
minConfidence: 0.7, // High threshold
debug: false
}
});Reasons:
- Medical-grade accuracy
- Regulatory compliance friendly
- Deterministic results
- No external dependencies
- Instant initialization
Fitness & Wellness Apps
Recommended: ME-rPPG Estimator
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.MeRppg,
earlyEstimation: true,
minDuration: 3,
minConfidence: 0.3,
debug: false
}
});Reasons:
- Excellent motion tolerance (users may be active)
- Robust to varying lighting
- Fast initial results
- State-of-the-art AI accuracy
- Open-source licensing
Mobile Apps (iOS/Android)
Recommended: ME-rPPG Estimator
Reasons:
- Users often move devices
- Lighting varies (indoor/outdoor)
- Modern phones have good connectivity
- Memory is generally available
- Users expect AI-powered features
Alternative: FDA Estimator (for medical apps or limited connectivity)
Embedded Systems & IoT
Recommended: FDA Estimator
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.Fda,
earlyEstimation: true,
minDuration: 5,
minConfidence: 0.5,
debug: false
}
});Reasons:
- Minimal memory footprint
- No model downloads required
- Instant initialization
- Works offline immediately
- Smaller bundle size
Research & Development
Recommended: Both (for comparison)
// Test both estimators
const meRppgCamera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.MeRppg,
debug: true
}
});
const fdaCamera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.Fda,
debug: true
}
});Reasons:
- Compare AI vs signal processing approaches
- Analyze different algorithm behaviors
- Understand trade-offs empirically
- Access to signal data from both
Progressive Web Apps (PWA)
Recommended: ME-rPPG Estimator (with FDA fallback)
async function createEstimator() {
// Try ME-rPPG first
try {
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.MeRppg,
debug: true
}
});
// Wait for models to load
await new Promise(resolve => setTimeout(resolve, 2000));
return camera;
} catch (error) {
console.warn('ME-rPPG failed, falling back to FDA:', error);
// Fallback to FDA
return createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.Fda,
debug: true
}
});
}
}Performance Comparison
Initialization Time
Processing Performance
| Metric | ME-rPPG | FDA |
|---|---|---|
| Frame Processing | 10-30ms | 5-10ms |
| First Result | ~3 seconds | ~5 seconds |
| Optimal Accuracy | ~10 seconds | ~10 seconds |
| CPU Usage | Medium-High | Medium |
| Memory Usage | ~4 MB | <200 KB |
Accuracy Under Different Conditions
| Condition | ME-rPPG | FDA |
|---|---|---|
| Ideal (Still, Good Light) | ±2 BPM | ±2 BPM |
| Slight Motion | ±2-3 BPM | ±3-5 BPM |
| Moderate Motion | ±3-5 BPM | ±5-10 BPM |
| Poor Lighting | ±2-4 BPM | ±4-8 BPM |
| Talking | ±3-5 BPM | ±5-10 BPM |
Migration Guide
Switching from FDA to ME-rPPG
Step 1: Add Model Files
# Copy ME-rPPG models to public directory
cp -r node_modules/ts-vital-sign-camera/public/models/me-rppg public/models/Step 2: Update Configuration
// Before (FDA)
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.Fda,
minDuration: 10,
minConfidence: 0.6
}
});
// After (ME-rPPG)
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.MeRppg,
minDuration: 3, // Can be faster
minConfidence: 0.3, // Can be lower
modelPath: 'models/me-rppg/model.onnx',
statePath: 'models/me-rppg/state.json',
welchPath: 'models/me-rppg/welch_psd.onnx',
hrPath: 'models/me-rppg/get_hr.onnx'
}
});Step 3: Handle Async Initialization
// ME-rPPG requires async initialization
camera.on('ready', () => {
console.log('ME-rPPG models loaded and ready');
enableStartButton();
});
camera.on('error', (error) => {
console.error('Failed to load ME-rPPG:', error);
// Fallback to FDA or show error
});Switching from ME-rPPG to FDA
Step 1: Update Configuration
// Before (ME-rPPG)
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.MeRppg,
minDuration: 3,
minConfidence: 0.3,
modelPath: 'models/me-rppg/model.onnx',
// ... other model paths
}
});
// After (FDA)
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: RealtimeEstimatorType.Fda,
minDuration: 10, // Longer for stability
minConfidence: 0.6 // Higher threshold
}
});Step 2: Remove Model Files (optional)
# Remove ME-rPPG models to reduce bundle size
rm -rf public/models/me-rppgStep 3: Update User Guidance
// FDA is more sensitive to motion
const instructions = [
"Stay completely still", // More important for FDA
"Don't talk during measurement", // Critical for FDA
"Ensure good, even lighting", // More important for FDA
"Wait for full 10 seconds" // FDA needs more time
];Runtime Switching
You can switch estimators at runtime by recreating the camera:
let currentEstimator: RealtimeEstimatorType = RealtimeEstimatorType.MeRppg;
let camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: currentEstimator
}
});
function switchEstimator(newType: RealtimeEstimatorType) {
// Clean up current camera
camera.destroy();
// Create new camera with different estimator
currentEstimator = newType;
camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType: currentEstimator
}
});
console.log(`Switched to ${newType} estimator`);
}
// Usage
switchEstimator(RealtimeEstimatorType.Fda);Decision Checklist
Use this checklist to make your decision:
Choose ME-rPPG if you answer "Yes" to most:
- [ ] Users may move during measurement
- [ ] Lighting conditions are uncontrolled
- [ ] You can download ~10 MB of models
- [ ] Open-source licensing is required
- [ ] You want AI-powered features
- [ ] Target devices are modern (2020+)
- [ ] Network connectivity is good
- [ ] You prioritize accuracy in challenging conditions
Choose FDA if you answer "Yes" to most:
- [ ] Medical-grade accuracy is required
- [ ] Instant initialization is critical
- [ ] Bundle size must be minimal
- [ ] Offline capability is essential
- [ ] Users can stay still during measurement
- [ ] Lighting can be controlled
- [ ] Regulatory compliance is needed
- [ ] You prefer deterministic algorithms
Hybrid Approach
For maximum flexibility, implement both and let users or conditions decide:
function selectEstimator(conditions: {
lighting: 'good' | 'poor';
motion: 'still' | 'moving';
connectivity: 'online' | 'offline';
priority: 'speed' | 'accuracy';
}): RealtimeEstimatorType {
// Offline or poor connectivity → FDA
if (conditions.connectivity === 'offline') {
return RealtimeEstimatorType.Fda;
}
// Poor lighting or motion → ME-rPPG
if (conditions.lighting === 'poor' || conditions.motion === 'moving') {
return RealtimeEstimatorType.MeRppg;
}
// Speed priority → FDA (instant init)
if (conditions.priority === 'speed') {
return RealtimeEstimatorType.Fda;
}
// Default to ME-rPPG for best overall experience
return RealtimeEstimatorType.MeRppg;
}
// Usage
const estimatorType = selectEstimator({
lighting: detectLightingConditions(),
motion: detectMotionLevel(),
connectivity: navigator.onLine ? 'online' : 'offline',
priority: 'accuracy'
});
const camera = createVitalSignCamera({
realtimeEstimationConfig: {
estimatorType
}
});Summary
| Scenario | Recommended | Reason |
|---|---|---|
| Medical Apps | FDA | Regulatory compliance, deterministic |
| Fitness Apps | ME-rPPG | Motion tolerance, AI robustness |
| Mobile Apps | ME-rPPG | Varying conditions, modern devices |
| Embedded Systems | FDA | Minimal resources, instant init |
| PWAs | ME-rPPG + FDA fallback | Best experience with safety net |
| Research | Both | Compare approaches |
| Offline-First | FDA | No model downloads |
| Open-Source Projects | ME-rPPG | Licensing requirements |
Next Steps
Review Detailed Guides:
Configure Your Estimator:
Optimize Performance:
Handle Edge Cases: