feat: breathing bandpass filter for stationary presence detection - #112
feat: breathing bandpass filter for stationary presence detection#112PeterkoCZ91 wants to merge 5 commits into
Conversation
|
Thank you for contributing to ESPectre! We are glad to have your help. Before we can merge this pull request, please review the Contributor License Agreement. Missing signatures: @contributors-assistant[bot] Once you have read it, reply to this thread with the exact text below:
If you already signed in a previous PR, just comment |
|
I have read the CLA Document and I hereby sign the CLA |
|
Thanks for signing the CLA. I recorded your signature. If the check is still red, comment |
|
Thanks for the contribution and for the thoughtful idea. That said, I can’t merge this PR in its current state yet. Here is why, in detail:
If you want to continue this feature, please address the points above. |
|
recheck |
a6acdee to
21c9c6e
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
3b072bf to
843b39b
Compare
|
Hi Francesco, thanks for the detailed review. I've addressed all four points: 1. User-facing integration
2. Validation on real data
3. Technical correctness
4. Repository workflow alignment
The unrelated CI workflow version changes from the original PR have been cleaned up (resolved by rebasing on current develop). |
|
recheck |
|
Hey Francesco, the CLA check is failing but it's not related to my changes — the bot is trying to verify itself:
Looks like the CLA workflow config might need an update (also shows deprecation warnings for |
98275fc to
296d219
Compare
… detection Signed-off-by: Petr <pisakpetr@gmail.com>
Add breathing_filter_ to move constructor, move assignment operator, and clear_buffer() reset path. Without this, the filter carries stale state after detector move or buffer cold-restart. Signed-off-by: Petr <pisakpetr@gmail.com>
Add BreathingFilter class to filters.py with exact coefficient parity to C++ breathing_filter_apply(). Integrate into SegmentationContext via enable_breathing parameter, following the existing lowpass/hampel filter pattern. Add get_breathing_score() accessor and reset support. Signed-off-by: Petr <pisakpetr@gmail.com>
Add 14 tests covering BreathingFilter: - Initialization, reset, coefficient parity with C++ - DC rejection, step transient, score consistency - Frequency response: breathing band passes, fast/slow signals rejected - Numerical parity with C++ filter math - SegmentationContext integration: enable/disable, CSI data, reset Signed-off-by: Petr <pisakpetr@gmail.com>
- Add breathing_score to get_metrics() when filter is enabled - Add real-data validation tests across 5 chip datasets (C3, C5, C6, ESP32, S3): baseline stability (CV < 0.5), movement score finite/non-negative, metrics key presence - Fix test_filters.py docstring to include BreathingFilter Signed-off-by: Petr <pisakpetr@gmail.com>
296d219 to
d844d21
Compare
|
Hi @PeterkoCZ91. I removed the CLA check and simply moved to a DCO check, easier and enough for this project. At this stage, please remove the C++ core changes from this PR and focus only on the Micro-ESPectre side (Python), where this belongs as an experimental/research feature. Rationale:
Please keep in this PR:
Please remove from this PR:
Validation required before any future C++ port:
Once the Python/R&D track is merged and evidence is solid, I will take care of the C++ port in a dedicated follow-up PR. |
d2f9bd9 to
29e457a
Compare
|
This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you're still working on this, please leave a comment or push new commits. |
|
This PR has been automatically closed due to inactivity. Feel free to reopen if you'd like to continue working on it. |
Summary
Breathing bandpass filter for stationary presence detection. Isolates the 0.08-0.6 Hz band (5-36 BPM) from CSI amplitude sum using cascaded 1st-order Butterworth HP + LP filters, then estimates RMS energy via exponential moving average.
Elevated breathing_score indicates periodic amplitude variation consistent with human breathing -- useful for detecting stationary occupants (sitting, sleeping) who produce minimal motion variance.
Changes
C++ firmware (components/espectre/)
Python micro-espectre parity (micro-espectre/)
Tests
Filter design
Validation results (real CSI data)
All 5 chip datasets pass:
Baseline stability (low CV) confirms the filter does not produce false periodic signals in empty rooms. The absolute score scale depends on chip/amplitude, so downstream consumers should compare against a per-environment baseline rather than using fixed thresholds.
Test results