DTW Dynamic Time Warping

I was wondering if Edge Impulse supports Dynamic Time Warping (DTW) algorithm for TinyML edge inference?

If not, is there a similar algorithm or training method with Edge Impulse that can be used to achieve a similar embedded ML inference performance to DTW?

DTW is used for time series data. More can be learned here:


and here:


This is to be ran on the nR52 DK embedded system.

Hi Mark,

Could you shed some more light on the general use case? We do not support this algorithm, but it seems the use cases it is designed to address have already been tackled by our NN and anomaly detection blocks or a combination of both.

1 Like

An example use case is gait analysis, for example stride segmentation.

1 Like

I’ve pinged our ML wizards @dansitu and @matkelcey for an answer here :slight_smile:

1 Like

Hey @markdheilong, nice to see you on here :slight_smile:

As I understand it, DTW is a relatively straightforward algorithm—given two time series, it will return a score that indicates their similarity.

It’s not something we provide in the Edge Impulse SDK. That said, it’s easy to bring your own signal processing algorithms to Edge Impulse Studio by creating custom processing blocks. This might be helpful if you wanted to use an input’s similarity to a reference signal as a feature to train a machine learning model.

For example, you could use your custom DTW block to search for several known signals in your input, resulting in several similarity scores. You could then train a classification model to identify an activity based on the relative values of the similarity scores.

It sounds like there are multiple C++ implementations available that could perhaps be portable to an embedded system. Here are a couple I found:

Hopefully this is helpful!


1 Like

Thanks Dan! I’m glad to be here. :slight_smile:

Thank you @janjongboom and @dansitu for following up on this and for your response with a couple of references. The C++ code sample looks pretty straight forward to compare two time series data sets and comparing the euclidean distance between them in succession with DTW (Dynamic Time Warping).

Also, I see “stride segmentation” is another good use case example I will look further into. Thank you Joeri Verbiest

I will talk to the prospect hopefully this week to learn more about their TinyML project on the nRF N5 2832 and I hope that Edge Impulse can help Quantuity Analytics deliver a simple and effective solution for the prospect all the way in Singapore.

I will provide updates here when more information becomes available.

Thanks again!

Mark Donaldson
Consultant, Quantuity Analytics Inc.