Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Real time machine learning and/or heavy tasks application suggestions

Hi everyone.

I'm thinking about performing some activity recognition for a specific research project from the raw accelerometer data. 

I know there is no such library that would provide me with the algorithms that I need in order to classify the activities and therefore I need to implement them myself, there is not easy/short way to do this.

I was just wondering if someone has any suggestion, mainly concerning the fact that, since i want to apply a real-time approach, i may run into resources-related problems. I will need to have a collection frequency of 10Hz plus the feature extractor on a 4 seconds window, and the machine learning algorithm running. I'm also thinking about writing the raw data to a file (which is easy to do but it might kill performances, not only because it is an I/O operation, but also because it is not asynchronous in fitbit APIs).

Have you had any experience with developing such heavy tasks on a fitbit ionic/fitbit versa? Do you think it is too ambitious? 

Thanks to anyone who will take some time to answer me.

Best Answer
0 Votes
4 REPLIES 4

I recommend doing some rough calculations on memory usage before you get too far into it. Consider using something like Int16Array for your numbers, because they take up about 1/4 of the memory and are quick and easy to flush to storage.

 

I'm nearly finished a fairly ambitious app. It displays a graph of an activity measure (calories, steps, HR, etc) for up to a whole day. The graph is zoomable and scrollable. The viewed activity measure can be changed by button press. I store readings of the currently-viewed measure (sampled every 15 seconds) in memory. Readings for the other five measures are stored in short memory buffers and flushed to storage every 90 seconds; this is because memory capacity isn't sufficient to keep everything in memory at once, and I figure that small frequent async saves are less likely to create responsiveness problems.

 

This seems to work in practice (ie, on a real device). The storage reads and writes seem very quick, even when reading a 10,000 value Int16Array (but note that this doesn't require a javascript loop; it can be done in one call).

 

The slowest part of my app is redrawing the whole graph, which can take a few seconds. Make sure you use setTimeout() to keep the OS message queue flowing, although this opens up the possibility of race conditions (etc) that you'll need to guard against.

 

The conservative approach would probably be to send the data to the companion for processing since the latter has more resources available to it. However, do some planning (with maths!) and proof-of-concept demos, and good luck!

Peter McLennan
Gondwana Software
Best Answer

Hi there,

 

I am currently working on a project that has a very similar requirements as the ones you were asking about. I need accelerometer readings to be fed to a RNN with a relatively high frequency in real time. So, did you find a good way to implement this feature or was it not applicable. I know this is an old post, but I would really appreciate your help.

Best Answer
0 Votes
No, at the moment I haven’t done what I was planning to do. More because of the project changing rather than actually trying and failing.
Best Answer
0 Votes

If you want to do real heavy lifting on data, I would look into implementing websockets (or another means) to pass data to a computer on the local network running your ML algo, and think of the fitbit mostly as just an input for your accelerometer data.

Best Answer
0 Votes