October, 2017

The MonBaby in Forbes!

https://www.forbes.com/sites/larrymyler/2017/10/16/b2b-strategies-can-help-b2c-companies-expand-sales/#2e8b112a19ba

Read More

The article in Entrepreneur magazine about MonBaby

https://www.entrepreneur.com/article/302205#

 

Read More

Improving classifier

Today I tried a simple improvement to classifier. I took a previous algorithm and enhanced the classifier categorization logic.  Previously I’ve required that the model leading coefficient (c[0]) should be more than noise threshold for every data point. This was my “goodness of fit” criteria. If the coefficient was too small for any of the sample points, the classifier would produce “no breathing signal” output. This have lead to a very unstable output oscillating between “signal” and “no signal”.

Instead I changed the criteria to require that within analyzed interval majority of points should have coefficient above noise threshold. Then the whole interval is marked as “breathing signal” and the output will be an averaged values.

Here is the code in python for aggregating classifier output:

    outSig = [freqNA] * (len(freqEstimate)+Nlen)
# do one more pass to determine if range has majority of records with the signal or majority without signal
for ii in range(len(freqEstimate)):
freqCnt, freqVal = 0, -1.0
for jj in range(Nlen):
# if frequency estimate is more than zero, that means classifier decided that the signal is good
if ii+jj > len(freqEstimate) – 1: break
#print(‘freqEstimate:{}’.format(freqEstimate[ii+jj]))
if freqEstimate[ii+jj] and freqEstimate[ii+jj] > 0:
freqCnt += 1
freqVal += freqEstimate[ii+jj]
if freqCnt > Nlen/2+1:
freqVal /= freqCnt
outSig[ii+Nlen] = freqVal

Here are the results of the new classifier that is based on a function of model coefficients f(c0,c1,c2).

majority_classifier_sample2

Compare that to a previous classifier output:

bokeh_plot (2)

As you can see the output signal (in black) is a lot more stable.

For comparison, I’m also showing the output of the modified classifier that is based on NMSE, rather than coefficients:

breath_plot_nmse

Here is the output from another bigger data sample with classifier based on coefficients:

majority_classifier_sample1

and same sample and NMSE classifier:

breath_plot_nmse2

One can conclude that this “smoothing” aggregation technique works a lot better.

Read More

Working on enhanced breathing algorithm

This is article covers an ongoing work on enhanced breathing algorithm for the MonBaby smart movement baby monitor. It utilizes a research framework pipeline, which is in essence a simplified MonBaby app.

  • The MonBaby smart button with latest MonBaby firmware
  • The test android app based on monbaby_sdk: https://github.com/varturas/monbaby_sdk
  • The python server running in a virtual environment with plugins to test different algorithm implementations

The MonBaby firmware sends XYZ accelerometer signals with sequence numbers to an Android app. Android app streams the accelerometer data stream via TCP socket to a server listening on an open IP port. An IP port is configured via the app UI.

Once data is consumed it could processed via the algorithm in near real time or saved to disc for further processing.

Here is an example of collected raw data visualized on jupyter python notebook. The data was recorded on a adult subject belly breathing:

  • initial normal (about 0.2Hz) breathing
  • followed by 20 second interruption in breathing, where subject was holding breath
  • followed by another breathing interval, where subject was catching the breath
  • followed by placement of the MonBaby button on a static surface
  • finally by an interval where the MonBaby is at rest

bokeh_plot

Here is the same data passed through IR lowpass filter:

bokeh_plot (1)

One can clearly see with the naked eye oscillation intervals of breathing and no breathing.

Here is an output of one of the test algorithms. Algorithm consist of an actual breathing rate detection and a classifier that uses output of breath rate detection to differentiate breathing from no-breathing.

The breathing rate detection finds leading frequency in the signal. For example, this is the graph of a filtered raw signal and a a candidate for a signal frequency.

raw_vs_signal

Breathing rate is calculated within the data interval of 15 seconds by choosing the frequency that fits the data best. This is done via FFT: D=fft(d), where d is filtered signal, then finding reverse frequency component in time-domain x=ifft(D(freq)) and finding most optimal solution to quadratic expansion of the signal y=c0+c1*x+c2*x*x. The most optimal solution can be solved via least-square method with minimal normalized standard error, NMSE = (y-d)^2/d^2.

Classifier is a second stage of the algorithm that finds best fitting parameters of the model based on the output of the breathing rate detection algorithm. The plot below is the output of the classifier that uses a function of coefficients of quadratic expansion, c0,c1 and c2 to determine goodness of fit. Black points are breathing frequency output that has passed through classifier and have been identified as breathing.

bokeh_plot (2)

One can see that generally the classifier and the algorithm output have a good correlation with the actual signal and noise, but not lined up ideally. This is work in progress and subject to improvement.

In comparison, the plot below is based on the classifier that uses NMSE, rather than coefficients.

rate_plot_nmse

The plot shows similar results but with greater variance of the rate value.

Read More