Comments (4)
The classical DTW requires that the template and the test timeseries are fully known (the starting and the ending point must be known, but not necessarily equal).
This is an example of how DTW works when having a full template and noisy test time series. The cost matrix is also shown, with the blue part indicating the optimal path used to align the two time series.
The alignment works very well and we might use classical DTW to provide a real-time feedback after the exercise is finished (and marked as finished).
However, during the exercise, we do not have the full test sequence a-priori (instead, we might have the full template). Therefore, if we want to provide real-time feedback during the exercise, a variant of DTW has to be used:
-
The open-begin-end DTW (OBE-DTW) allows for open-begin and open-end matches.
A R package is available here: https://github.com/cran/dtw.
http://dirk.eddelbuettel.com/code/rcpp.html might also be useful to interface R and C++. -
The online DTW (oDTW) aligns the time series incrementally (only the template sequence must be known in its entirety).
The C++ library is available here: https://github.com/RVirmoors/RVdtw-/tree/master/oDTW
from assistive-rehab.
Given we know the duration of the exercise (D) and the number of repetitions (nrep) of a movement, we can evaluate the signals every n*(D/nrep) seconds, in order to have a template containing n repetitions of the movement, with defined starting and ending points.
The DTW distance (normalized by the length of the vector) between segmented template and test is an indicator of how well the movement is being performed, in terms of speed. If the normalized DTW distance is below a threshold, we can assume template and test are mostly synchronized (i.e. they move at the same speed). Otherwise, a difference in speed can be detected.
The expected situations are described below. The examples show the 1D case for simplicity, considering the x position of the hand during an abduction exercise. However, this analysis has to be extended to the whole skeleton, using the multivariate DTW.
In the following examples, the full signals are shown and segmented signals (template is segmented in order to have n = 4 repetitions of the movement) with the corresponding DTW distance.
DTW distance is typically lower when template and test move at same speed.
- Template and test moving at same speed:
DTW dist = 0.078 | DTW dist = 0.081 |
---|---|
![]() |
![]() |
- Test moving slower than the template:
DTW dist = 0.10 | DTW dist = 0.11 |
---|---|
![]() |
![]() |
- Test moving faster than the template:
DTW dist = 0.10 | DTW dist = 0.12 |
---|---|
![]() |
![]() |
- Test moving randomly / not moving:
DTW dist = 0.36 | DTW dist = 0.51 |
---|---|
![]() |
![]() |
from assistive-rehab.
That's super cool @vvasco!
Thus, DTW
seems to be the tool we were seeking for!
from assistive-rehab.
The same analysis was repeated by considering all the joints (the z component was not used, since, at the moment, it is not reliable (#76, #77)). The multivariate DTW was used, by computing the cost matrix for each x and y component of each joint, and the sum of each DTW distance was considered as final distance.
The table below summarizes the results. Each row reports the DTW distance for different parts of the template and test signals.
As desired, DTW distance is typically lower when template and test move at same speed.
Same speed | Slower test | Faster test | Not moving / randomly moving test |
---|---|---|---|
DTW dist = 0.40 | 0.62 | 0.61 | 3.44 |
DTW dist = 0.48 | 0.65 | 0.70 | 4.31 |
DTW dist = 0.46 | 0.63 | 0.68 | 4.17 |
DTW dist = 0.45 | 0.68 | 0.69 | 4.01 |
from assistive-rehab.
Related Issues (20)
- Remember to update CI for VCPKG Ports name HOT 1
- Update YARP portmonitor initialization HOT 5
- Use `depthimage_compression_zlib` pormonitor HOT 1
- Dependencies for cornerRefinementMethod HOT 2
- `lineDetector` and `skeletonRetriever` are to rely on I/F to get depth camera's params HOT 2
- CI fails because of `curl` build error HOT 4
- Setup and test the TUG demo on R1SN003 HOT 41
- Develop the connection Navigation ➡️ GRACE HOT 2
- Refine and test speech failure detection on R1SN003
- Host docker images on `ghcr.io/robotology` HOT 3
- Update kinematics for use with top camera
- Test the TUG metrics accuracy with and without human planes projection HOT 3
- Expose the available TUG metrics to the end user HOT 8
- Investigate the possibility to replace the Wi-Fi buttons HOT 3
- General upgrades to assistive-rehab docker image HOT 1
- Release `v0.8.0`
- Update website
- Improve the peak finding algorithm for gait estimation HOT 5
- Investigate possible race condition in `googleSpeech` module
- Improve handling of questions by `managerTUG` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assistive-rehab.