cbrnr / sleepecg

Sleep stage detection using ECG
BSD 3-Clause "New" or "Revised" License
90 stars 23 forks source link

Feature Enhancement #140

Closed likith012 closed 1 year ago

likith012 commented 1 year ago

Hi,

I would like to try out architectures that don't require hrv calculation but directly use the ECG signal for example (but not limited to) over here (still requires r peak calculation) and add it to this library if they are working. And would also like to extend the task to sleep apnea detection as SHHS also comes with apnea labels. Need your comments on whether these approaches are feasible.

cbrnr commented 1 year ago

Great! I think the first addition should fit really nicely into the package. You basically skip the existing feature extraction and add your own (R peak locations? RRI?). We are currently classifying windows of data (typically 30 seconds), so you need to make sure that your approach is compatible, but this should be possible. Since we are already using Tensorflow, maybe you could also use it and choose a suitable neural network.

Regarding sleep apnea detection, this requires a little more discussion if and how it fits into SleepECG. But I'm certainly open to adding it if it is feasible.

Maybe @hofaflo has some thoughts as well?

hofaflo commented 1 year ago

Hey, thanks for reaching out and contributing! :)

Using a binary mask of R peak locations or RRI should work fine by creating a new group in feature_extraction._FEATURE_GROUPS and implementing a function which is called by extract_features. Features based on the ECG directly (instead of R peak locations) would require changing the parameters to extract_features or creating a separate interface.

With apneas and hypopneas being independent of the commonly used 30s interval used for sleep stages, apnea detection doesn't fit too well into the SleepRecord data structure, so we would have to create a workflow independent of the sleep scoring one, but I don't see any critical issues with that (for now :D).

likith012 commented 1 year ago

Thanks for the response @cbrnr and @hofaflo. As @hofaflo suggested I will first work on implementing the sleep staging task and deal with the apnea task later on. I shall get acquainted with the library and will work on this.

likith012 commented 1 year ago

@hofaflo @cbrnr I tried reproducing the paper but couldn't do so, I am not sure where I was making a mistake. For now, I am closing this issue, will reopen it later if I could fix it.

cbrnr commented 1 year ago

Alright, let us know if you need help.