82
loading...
This website collects cookies to deliver better user experience
Detecting gestures from time-series data with ESP32, accelerometer, and MicroPython in near real-time.
"MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments." [Link]
period=5
but the readings were inconsistent with readings between 5-7ms. Hitting the first limitation of the stack. Nonetheless, 10ms (100Hz) was more than enough.How to overcome this?
Tabularizing(reducing) data
In this case each time point is considered a feature and we lose order of data in time. There's no dependency of one point on the previous or next in the series.
Feature extraction
In case of feature extraction time-series data is used to calculate mean, max, min, variance and other, time-series specific, variables which are then used as features for model training. We moved away from the time-series domain and operate in the domain of features.
Baseline dataset
Dataset used for training and validation contained movements as collected and labeled.
Centered X and Y move signals
'Circle' movement takes up the whole span of 1000ms and cannot be manipulated by moving it along the time axis. However 'X' and 'Y' have shorter execution at around 400-600ms and allow for flexibility. I tried to center the movement of the signal in the center of the 1000ms window to see if the model will perform better with this setup.
Centered X and Y move signals + Augmentation
Similarly as in previous case 'X' and 'Y' movements were in the center of the 1000ms window. Additionally, a sort of augmentation was introduced. Since labelling the movements is not 'exact' some signals might have a misaligned start. To make up for this, and possibly achieve a better generalization I added a shift - meaning I used a range of small shifts.
For 'X' and 'Y' movements the center is at -20 steps . For augmentation a range between -20 and -15 was used. Where one step is 10ms.
For 'circle' a range between -2 and 2 was used.
Example: If the original label starts at 0 and the augmented dataset was shifted by -1 step - the augmented dataset will have its start at 0-10ms step.
Centered X and Y move signals + SMOTE
Simlarly, as previous two cases 'X' and 'Y' are centerd but additional synthetic oversampling is used (SMOTE) and an equal amount of labels is create for the training dataset.
X and Y signal at the end of the window
In this case the 'X' and 'Y' movements are put at the end of the 1000ms sampling window.
Label | Equation |
---|---|
Cirle | cirle_error = X+Y / (X+Y+Circle) |
X | x_error = Circle+Y / (X+Y+Circle) |
Y | y_error = Circle+X / (X+Y+Circle) |
Optimizing the number of estimators
Number of estimators must be kept low - ideally between 3-5 because of time constraints.
Optimizing the number of collected inputs
X,Y,Z acceleration signals must be collected for a different part of the application. I considered to create a combination of acceleration and 1 or 2 angular velocity signals.
Optimizing sampling rate
Sampling rate of 100Hz might be an overkill for the application. And based on evaluation results it doesn't offer any benefit over 50Hz or 20Hz sampling rate. On the other hand 10Hz might be too slow. Therefore for experiments I will be using 20, 25 and 50Hz sampling rates.