question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

librosa.dtw : question on allowable input data dimensions

See original GitHub issue

I’m getting a column dimension error when they are both (1) (12, 1) (3, 1) Is this shape input allowed?

-> dtwval, path = librosa.dtw(siga, sigb, subseq=True)
(Pdb) siga
array([[  4.],
       [ 30.],
       [ 52.],
       [ 32.],
       [ 54.],
       [ 22.],
       [ 28.],
       [ 22.],
       [ 12.],
       [ 30.],
       [ 16.],
       [ 18.]])
(Pdb) sigb
array([[ 46.],
       [  6.],
       [ 14.]])
ValueError: XA and XB must have the same number of columns (i.e. feature dimension.)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
stefan-balkecommented, Aug 15, 2017

dtw() returns the accumulated cost matrix D and the warping path.

The alignment cost is stored in the entry D[-1, -1].

1reaction
stefan-balkecommented, Aug 15, 2017

Yeah, sure, it’s already in there: https://github.com/librosa/librosa/blob/master/librosa/core/dtw.py#L189

But we then plug it into scipy.cdist as the transposed version thus messing up dimensions for the 1d case. If we catch the ValueError and exchange “columns” against “rows” should help the users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for librosa.sequence
ndarray [shape=[n, 2]] Specifies allowed step sizes as used by the dtw. weights_add : np.ndarray [shape=[n, ]] Additive weights to penalize certain step...
Read more >
Getting the error "dtw() got an unexpected keyword ...
I am attaching the code below. import librosa import librosa.display y1, sr1 = librosa.load('sample_data/Abir_Arshad_22.wav') y2, sr2 = librosa.
Read more >
Dynamic Time Warping
DTW has been applied to temporal sequences of video, audio, and graphics data — indeed, any data that can be turned into a...
Read more >
Temporally Guided Music-to-Body-Movement Generation
The skeleton and music data are available at the project link (see Section 6). 3.2 Audio feature extraction. We apply librosa, a Python...
Read more >
Performance Evaluation of Offline Speech Recognition on ...
The model is trained with a LibriSpeech, 960 hr, labeled training data set. Unlike Wav2Vec, which takes raw audio samples as input, this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found