AI CPR Analyzer
Combines computer vision, signal processing and machine learning to quantify CPR training performance (compression rate, count and interruptions) and generate interpretable feedback.
Built with: Computer vision · OpenCV · MediaPipe · Streamlit
Read the written prototype development document
Project Overview
We are developing an AI-powered CPR Analyzer prototype as part of the Emergency Medicine AI Research Initiative (EMARI). The project focuses on combining computer vision, signal processing, and machine learning to analyze CPR performance, quantify compression patterns, identify interruptions, and generate data-driven feedback for CPR training and research.
The system is being designed with a modular architecture that separates currently implemented functionality from planned capabilities and future research objectives.
1. Current Prototype Capabilities
The following describes the initial development scope and intended baseline functionality.
Features should be marked as implemented only after they have been built and tested.
- Python-based development: Establishing the software foundation for video processing, data analysis, and model integration.
- Video-processing pipeline: Developing the ability to ingest CPR training footage and extract video frames for analysis using OpenCV.
- Computer vision integration: Evaluating pretrained models, including MediaPipe, for detecting relevant body landmarks and movement patterns.
- Compression-cycle analysis: Developing algorithms to identify repeated movement patterns, estimate compression timing, count compressions, and detect potential interruptions.
- Performance metrics: Establishing a framework for calculating compression rate and summarizing observed CPR activity.
- Streamlit interface: Developing a dashboard for displaying analysis results, performance metrics, and session summaries.
2. Planned Capabilities
The following capabilities are planned for subsequent development and are not assumed to be operational in the current prototype.
- Real-time CPR analysis: Process live webcam footage and provide feedback during simulated CPR training.
- Sensor integration: Connect to a sensor-equipped training manikin to obtain reference measurements for compression depth, recoil, and other physical parameters.
- Validated depth assessment: Compare video-derived movement estimates with sensor measurements to investigate whether compression depth can be assessed reliably.
- Hand-placement assessment: Develop and validate computer vision models that identify hand positioning relative to the recommended compression area.
- Expanded performance analysis: Calculate interruption duration, compression consistency, and the proportion of compressions meeting defined training criteria.
- Automated feedback engine: Generate structured, evidence-based feedback based on measured performance and established CPR training guidance.
- Confidence and uncertainty reporting: Distinguish reliable measurements from uncertain estimates and identify when additional sensors or improved camera positioning are needed.
- Session history and trend analysis: Track performance across multiple training sessions and visualize changes in measured metrics.
- Research evaluation: Test the system against reference equipment under controlled conditions and document measurement accuracy, reliability, and limitations.
3. Technical Architecture
The proposed architecture consists of five major components:
- Input layer: Recorded CPR videos, with live webcam input planned.
- Computer vision layer: Video-frame processing, landmark detection, and movement analysis.
- Measurement layer: Compression-cycle detection, timing calculations, and future sensor-based depth and recoil measurements.
- Analysis layer: Comparison of validated measurements against applicable adult CPR training targets.
- Presentation layer: A Streamlit dashboard for displaying results, uncertainty, performance trends, and feedback.
4. Initial Performance Metrics
The system is being designed to evaluate the following metrics, subject to measurement feasibility and validation:
| Metric | Measurement approach |
|---|---|
| Compression rate | Estimate compressions per minute from detected cycles |
| Compression count | Count detected compression cycles |
| Interruptions | Identify pauses and calculate their duration |
| Compression depth | Planned sensor-based measurement and validation |
| Chest recoil | Planned sensor-based measurement and validation |
| Hand placement | Planned computer vision assessment |
| Performance summary | Summarize measured metrics and their confidence |
The reference target for adult CPR is generally 100–120 compressions per minute and a compression depth of approximately 5–6 cm. The system must be validated against appropriate reference measurements before its estimates are treated as accurate.
5. Development Roadmap
Phase 1 — Baseline Prototype
Develop the video-processing workflow, compression-cycle detection, initial rate estimates, interruption detection, and dashboard.
Phase 2 — Measurement Validation
Compare the system's output against reference measurements from CPR training equipment and quantify its limitations.
Phase 3 — Expanded Capabilities
Investigate real-time analysis, sensor integration, hand-placement detection, recoil assessment, and automated feedback.
Phase 4 — Research and Evaluation
Conduct controlled testing, document results, assess performance across recording conditions, and determine which capabilities warrant further development.
6. Intended Outcome
Our objective is to develop a research-oriented AI CPR Analyzer that can quantify CPR training performance and provide interpretable, evidence-based feedback. The immediate focus is on building a reproducible prototype and validating its measurements before expanding into real-time analysis or more advanced clinical applications.
Development status distinction: Current capabilities refer to features actually implemented and tested. Planned capabilities describe proposed work and must not be represented as completed functionality. The prototype is intended for research and educational use and is not a clinically validated medical device.