Coder Social home page Coder Social logo

Comments (4)

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Hi PartyTrix,

The false negatives are a result of the approach. I've designed it so that it will usually err on the cautious side. This means any peak for which HeartPy isn't very confident, will be marked rejected and excluded from the analysis (you can read a little about why this is favourable to allowing false positives here: https://python-heart-rate-analysis-toolkit.readthedocs.io/en/latest/heartrateanalysis.html#on-the-accuracy-of-peak-position)

However, in the overview plot you give the majority of peaks seem detected alright. The poor segments (marked red) are also excluded from the analysis if you use the latest version of HeartPy.

The results here should be an approximation of the heart rate. Variability is of course more sensitive to outliers (especially false positives, of which I think I see two or three, so these are rare), so you should be ok. The sidenote is of course that the signal quality of ppg extracted from a webcam is far from ideal, and a lot worse than even cheap PPG sensors.

If you only want BPM consider getting a periodogram and finding the dominant frequency:

from scipy.signal import periodogram

frq, psd = periodogram(data, fs=30.0)

bpm = frq[np.argmax(psd)] * 60.0

print("hr is: %f" %bpm)

hr is: 60.298051

On a sidenote I'm also working on remote heart rate extraction in my PhD project. When there's a little time available after the paper I'm writing now I'll update heartpy accordingly. If you have time to wait, we can share findings then. I'm expecting June/July for the update.

from heartrate_analysis_python.

PartyTrix avatar PartyTrix commented on July 30, 2024

Thanks for your very quick and elaborate reply!

How about a situation like this where it has false positives and false negatives closely together, exclude the section?
afbeelding

I am interested in HRV indeed, so the link you provided applies to my situation (i.e. a conservative criterion is preferable over less misses but more false positives).
The downside of (cheap) PPG sensors is that they're obtrusive and (for example the empatica E4) get distorted by muscle flexing/movement of the sensor. Or at least, that's my experience so far.
And I found the plane orthogonal surface approach (Algorithmic Principles of Remote-PPG) by W. Wang (2017) to be quite usable - even when doing no face detection and just applying a virtual green screen over the video stream.

As you're very familiar with the techniques, is there an obvious downside to use pattern-matching (for example a sinusoidal, as done in this approach https://blog.orikami.nl/exploring-heart-rate-variability-using-python-483a7037c64d?)

I'd be very interested to share findings, my project ends around august/september, and I'm located in the Netherlands as well - so if there is some presentation, let me know ;)

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Yes better to exclude such a section entirely. This will happen when extracting from video I'm afraid.

I've toyed with the pattern matching and wavelet transform in the past but found that the morphology of the wave is too variable in PPG. This occurs to some extent when using cheap sensors (but not a lot), but in PPG extracted wirelessly from webcam this was too much of an issue to be usable.

Where in the Netherlands are you located? What institution? We might meet up for a coffee.

Cheers,
Paul

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Let's continue the discussion over e-mail as we discussed, as it is becoming too detailed and specific for here.

from heartrate_analysis_python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.