Ricardodeazambuja DTW Save Abandoned

Dynamic Time Warping in Python / C (using ctypes)

Project README

DTW - Dynamic Time Warping in Python / C (using ctypes)

The Dynamic Time Warping (DTW)[1,2] is a time-normalisation algorithm initially designed to eliminate timing differences between two speech patterns. This normalisation, or correction, is done by warping the time axis of one time series to match the other. The correction (time warping) makes it easier to compare two signals in a similar way to the method human beings use[3].

DTW example Example of 2D trajectory-matching generated by the DTW method. Although looking perfect in the figure on the left, the cardioid was modified to have a constant value zone from time step $50$ to $150$. The DTW correctly matches the values as can be seen as a straight blue line in the Accumulated Distance plot (right).

Above is presented an example where a cardioid is compared to a circle. The cardioid also had a time delay inserted (values were kept constant). The DTW calculates the distance (here the Euclidean one) between all the points of the two time series and, then, generates another matrix with the accumulated distances. The total distance defined by the path formed with the minimum values of the accumulated distance (right-hand side of the figure) can be easily applied to compare different shapes.

This version of the algorithm uses a C kernel, supporting multidimensional arrays and Euclidean distance, to speed up the calculations with a Python wrapper as the user interface. More details and sample code can be found in this Jupyter notebook:

if you are not happy with my explanations above, one of the best explanations about how the DTW works I've found on a presentation by Elena Tsiporkova.

How to install:

  1. Clone the repository, or download it as a zip file and unzip it.
  2. Inside the directory dtw_python execute make.
  3. Now, to install the library and make it accessible to all users you need to execute sudo make install.
  4. After that you don't need the dtw_python directory anymore and you can test it using the jupyter notebook.

References:

  1. Sakoe, H., and S. Chiba. “Dynamic Programming Algorithm Optimization for Spoken Word Recognition.” IEEE Transactions on Acoustics, Speech and Signal Processing 26, no. 1 (February 1978): 43–49.
  2. Meinard Müller. “Dynamic Time Warping.” In Information Retrieval for Music and Motion, ch. 4, 69-82. New York: Springer-Verlag, 2007.
  3. Ratcliff, Roger. “Continuous versus Discrete Information Processing: Modeling Accumulation of Partial Information.” Master Thesis, Radboud University Nijmegen, 2004.

Other projects you may like to check:

  • colab_utils: Some useful (or not so much) Python stuff for Google Colab notebooks
  • ExecThatCell: (Re)Execute a Jupyter (colab) notebook cell programmatically by searching for its label.
  • Maple-Syrup-Pi-Camera: Low power('ish) AIoT smart camera (3D printed) based on the Raspberry Pi Zero W and Google Coral EdgeTPU
  • The CogniFly Project: Open-source autonomous flying robots robust to collisions and smart enough to do something interesting!
  • Bee: The Bee simulator is an open source Spiking Neural Network (SNN) simulator, freely available, specialised in Liquid State Machine (LSM) systems with its core functions fully implemented in C.

http://ricardodeazambuja.com/

Open Source Agenda is not affiliated with "Ricardodeazambuja DTW" Project. README Source: ricardodeazambuja/DTW
Stars
26
Open Issues
0
Last Commit
2 years ago

Open Source Agenda Badge

Open Source Agenda Rating