Video Based Seizure Detector – Attempt #2

I have started work on a video based seizure detector that will use an Artificial Neural Network to distinguish between ‘Normal’ and ‘Odd’ behaviour to attempt to spot partial seizures.

Unfortunately at the moment the best I can do is get something to tell me that Benjamin is ‘Normal’ and I am ‘Odd’, so still a way to go!    A bit more info on this page.

Me Demonstrating ‘Odd’ Behaviour to attempt to train the Neural Network.

Progress with replacement for Pebble

It is ages since I updated everyone on where we are with a replacement for Pebble Watches (Note that Pebble watches are still available, and are the lowest cost device I have found to use as a seizure detector, so I’d get one while they are available!)

A brief update on each of the trials we have been doing over the last year below.   Note that Ben’s work means that Android Wear is well in the lead at the moment!

Custom Hardware

I got as far as a proof-of-concept for using an accelerometer chip with a small wifi enabled microcontroller (ESP8226).  (See Custom Hardware Seizure Detector)  But I struggled to get the power consumption down enough to get the battery life I needed.   I also realised that realistically, for most people to use it, I’d have to manufacture it and sell it, which is a bit much of an undertaking for me, so that is on hold for now.

Garmin IQ Watches

This is a possibility, but I have been a bit disappointed with the reliability and memory leaks – I could definitely get it working though with a few evenings work on it.   They are quite expensive compared to Pebbles though (£180 from amazon)….But Benjamin can tell it is not a Pebble and refuses to wear it, so I am using it for running at the moment!

Android Wear

I started on a proof-of-concept but didn’t get it properly connected up (I had some maths issues in the fourier transform library for android, which was not giving the same numbers as the one I use on pebble).

Ben Geisler has made great progress in getting the seizure detection working on Android Wear watches, and integrating it with the OpenSeizureDetector Alarm System.  He has also got heart rate monitoring working too.  His source code is on Github: https://github.com/mechanodroid/AndroidWear_SD/

So Ben’s work means that of all the alternatives I have looked at, Android Wear is looking like the closest to something we can release – over the next few weeks I will aim to incorporate Ben’s work into the main OpenSeizureDetector app and release it for testing.

Pebble Battery Life

We recently noticed that the battery life of our original Pebble was reducing, and it was becoming borderline if it would make it through the night (we need it to run from about 19:00 to 08:00 the next day – 13 hours).

I was surprised to find that increasing the “Data Transfer Period” from 20 seconds that I was using to 30 seconds made a huge difference to battery consumption – it easily lasts over night now with significant margin.

I think this must be because the gap between bluetooth transmissions is now long enough to allow bluetooth to go to sleep in between, which it was not doing previously, but I don’t know enough about bluetooth to know if that is true or not.

So, if you are having trouble with battery life, change Data Transfer Period (in pebble settings) to 30 seconds.

I would only do this once you are happy that the system is working properly, because it means that the data on the phone display will only update every 30 seconds, which is a long time to wait if you are testing it.  It also means that initial start-up will take longer, because the system waits on the start-up screen until it receives a routine data update.

Changing the Data Transfer Period does not affect the alarm response though – if the watch detects a warning or alarm condition it sends data immediately, irrespective of the Data Transfer Period setting.

Hope that Helps!

Graham.

Release of V2.5.5 of OpenSeizureDetector

I have just released a beta test version of V2.5.5 of OpenSeizureDetector on Google Play Store.

The only change in this version is improvements to logging of network connections to help with de-bugging issues with the Network Data Source function, that allows you to monitor OpenSeizureDetector remotely via wifi.

This has been produced because we are having issues with fault warning pips sounding every now and then, and are not sure why.   By running this version on both the main phone and the device running with the network data source, we will be able to tell which one is disconnecting from the network.

Release of V2.5.4 of OpenSeizureDetector

I have just made the current Beta test version of OpenSeizureDetector (V2.5.4) the main release – this adds an option to use MP3 alarm sounds rather than computer generated ones, as some users have reported problems with the tone generated ones not working on some phones.

You should not notice any change unless you enable MP3 alarm sounds – please let me know if you do! (graham@openseizuredetector.org.uk)

Problems with Samsung Tablet

We use a Samsung Tab A that we use in ‘network datasource’ mode to raise alarms from Benjamin’s watch using wifi (it connects to the phone in his bedroom that is connected to the pebble watch).

When we first started to use it the ‘power saving’ feature used to shut down the OpenSeizureDetector background process that caused it to fail silently, but Sandie found the option to disable this.

There was a software update yesterday that upgraded it to Android 7.1.1, which broke it again.   If the device is running on battery and the screen is switched off, OpenSeizureDetector starts to give fault warning pips after 6-8 minutes.  I am pretty sure it is the wifi going to sleep, because as soon as you put the screen on, OpenSeizureDetector changes to OK and the fault pips stop.

The Wifi Advanced settings are set to always on, so it should have been ok, but it turns out there is now a more specific setting….

In Settings–>Apps–>[Three dots]–>Special Access–>Optimise Battery Usage. You can then select “All apps” and OpenSeizureDetector.  This prevents OpenSeizureDetector being ‘optimised’ for battery usage (from https://forum.vodafone.co.uk/t5/Android/S8-wifi-disconnects-on-sleep/td-p/2562811).

This ‘optimisation’ is a pain if you want something to just keep running!

Problems with Audible Alarms on Some Devices?

A user reported that audible alarm notifications were not working on a high end Samsung phone.

I have not been able to work out why, so I have just published a beta version (V2.5.4) which uses audio files to make the sounds rather than a tone generator. You can test it by signing up for beta testing here: https://play.google.com/…/testing/uk.org.openseizuredetector

Has anyone else seen this problem? Please feed back any issues.

Thanks!  graham@openseizuredetector.org.uk

Improved Alarm Reliability

When Benjamin had his seizure a couple of weeks ago I was surprised that OpenSeizureDetector re-set for a while after alarming – I had expected it to stay in alarm continuously until the shaking movements stopped.   I think that this was because he fell backwards and the algorithm saw that as a lot of movement outside of the shaking frequency range, so said it was ok.   This is not what I want to happen……

I have adjusted the algorithm slightly so that the system is in an ‘ALARM’ state in one analysis period, but the alarm thresholds are not met in the next one, it goes back to ‘WARNING’ rather than ‘OK’.   This means that if the next analysis period satisfies the alarm thresholds again it will go back to full ALARM.

In practice this means that the system will make beeping noises throughout rather than going quiet for 10 seconds or so.

I have put a video on the Facebook page.

This change is not as well tested as things that I usually publish, so I have not released another version of the Android App, but have made the watch app available here: DOWNLOAD Watch App V2.6.

To install,

  • access this post from the device running OpenSeizureDetector.
  • Click on the Download Link above (accept any warnings about downloading files).
  • When Download completes, open the file.  If given the option, select the Pebble app to open it.
  • Say Yes to the question about installing an external file.
  • The OpenSeizureDetector watch app should

Tonic Clonic Seizure Detected

Benjamin had a tonic-clonic seizure this morning, so I thought it would be useful to describe how OpenSeizureDetector performed in detecting it.

What Happened

  • Benjamin sat up and contorted in an unusual way – head looking up and to the left.
  • Sandie saw this on his video monitor and recognised it as a fit and set off up the stairs to check him.
  • When she found him, Benjamin was lying on his back with arms shaking, but not out stiff (his elbows were bent).
  • It was not one of his worst tonic-clonic seizures – he was not paralysed after it, just needed to sleep it off for a few hours.
  • OpenSeizureDetector alarmed as expected.

OpenSeizureDetector Performance

    • Sandie spotted the seizure using the video monitor from Benjamin’s odd behaviour before OpenSeizureDetector did – this is because OpenSeizureDetector needs the shaking associated with a seizure to detect it, but Sandie spotted the odd movement before the shaking started.
    • The first OpenSeizureDetector warning sounded about the time Sandie reached his bedroom.
    • The warning re-set unepectedly.  I think this was Benjamin falling bakwards, resulting in  a lot of low frequency movement, which the detection algorithm assumes is not seizure-like movement..
    • About 30 seconds later the warning re-initiated followed by full alarm.
    • When the full alarm sounded, Benjamin was lying on his back with arms shaking, but not out stiff (elbows bent).
    • Two full alarm initiations occurred before the seizure detector re-set as the movement subsided.
  • The spectra of the alarm and warning conditions are shown below.
  • The initial warning occurred at a peak frequency of 7 Hz. The full alarm occurred with peak movement at around 4-6 Hz.
  • These spectra are consistent with the type of movement OpenSeizureDetector is set up to detect – an excess of movement in the 3 to 8 Hz range compared to the rest of the spectrum.

Issues

  • It is encouraging that OpenSeizureDetector detected a tonic-clonic seizure as expected – the spectrum is consistent with the movement the system is designed to detect.
  • The re-set when Benjamin fell backwards is not what I had expected to happen.   I think we need to add some hysteresis so we have to see a reset condition for a few analysis periods before resetting the alarm.   This will increase the false alarm rate though…..

New Release of OpenSeizureDetector

A new release of OpenSeizureDetector (V2.5.1) will be available on Google Play Store shortly.   I recommend all users upgrade to this version and enable the ‘Latch Alarms’ option in settings.

This release introduces better support for short duration seizures – enabling the ‘Latch Alarms’ option means that when the system goes into alarm the alarm will continue to sound for a given period before resetting, even if the alarm condition clears quickly.

We have been testing this with Benjamin for a few months following his last seizure that was on the limit of detectability so only raised an alarm briefly – with this feature it will sound for at least 10 seconds (or whatever the user specifies in the settings) irrespective of how quickly the alarm condition clears.