Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sequences of vectors #9

Closed
ftfish opened this issue Nov 21, 2016 · 2 comments
Closed

Support for sequences of vectors #9

ftfish opened this issue Nov 21, 2016 · 2 comments

Comments

@ftfish
Copy link

ftfish commented Nov 21, 2016

Hi all,

It seems cdtw doesn't support running DTW with two sequences of feature vectors (e.g. MFCC). I get the following error:

Traceback (most recent call last):
  File "./s2f.py", line 161, in <module>
    d = U[b] - V
  File "./s2f.py", line 88, in __sub__
    compute_path = False)).get_dist()
  File "/my/path/to/python/python2.7/site-packages/cdtw/pydtw.py", line 12, in __init__
    cydtw.__init__(self, ref, query, settings)
  File "cdtw/cydtw.pyx", line 251, in cdtw.cydtw.cydtw.__init__ (cdtw/cydtw.c:4379)
  File "cdtw/cydtw.pyx", line 279, in cdtw.cydtw.cydtw._dtw (cdtw/cydtw.c:4989)
  File "/my/path/to/python/python2.7/site-packages/numpy/core/shape_base.py", line 278, in hstack
    return _nx.concatenate(arrs, 0)
ValueError: all the input arrays must have same number of dimensions

The code excerpt generating this error:

        return pydtw.dtw(this.stFeatures.T, that.stFeatures.T, pydtw.Settings(step = 'p0sym',     #Sakoe-Chiba symmetric step with slope constraint p = 0
                                window = 'palival', #type of the window
                                param = 2.0,        #window parameter
                                norm = False,       #normalization
                                dist='euclid',
                                compute_path = False)).get_dist()

this.stFeatures.T and that.stFeatures.T are numpy arrays and have shape (38, 13) and (65, 13) respectively.

Is this feature not supported or did I do something wrong?

Any help is appreciated, thank you!

@halachkin
Copy link
Owner

halachkin commented Nov 21, 2016

Hi @ftfish .
This is not supported, you need to write some wrapper for this. cdtw inputs should be two 1-dimensional array-like objects.

@ftfish
Copy link
Author

ftfish commented Nov 21, 2016

Thank you for confirming. I see no simple way to add such a wrapper and unfortunately I don't have time to investigate further now.

Thank you.

@ftfish ftfish closed this as completed Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants