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.

numba's DTW segfaults on NaN similarity

See original GitHub issue

Description

The example code plot_music_sync.py from https://librosa.github.io/librosa/auto_examples/plot_music_sync.html#sphx-glr-download-auto-examples-plot-music-sync-py runs fine with sir_duke_fast.mp3 and sir_duke_slow.mp3. But encounter segmentation fault when using other mp3 files.

Steps/Code to Reproduce

  1. Replace
x_1, fs = librosa.load('audio/sir_duke_fast.mp3')

to

x_1, fs = librosa.load('audio/BFJazz_-_Stargazer_from_Texas.mp3')

in plot_music_sync.py.

  1. Run plot_music_sync.py again and segmentation fault occurs.

  2. The exception seems to be thrown from this line:

D, wp = librosa.sequence.dtw(X=x_1_chroma, Y=x_2_chroma, metric='cosine')

Expected Results

Python should exit without Segmentation fault: 11

Actual Results

/Users/igneus/.pyenv/versions/3.7.4/lib/python3.7/site-packages/librosa/core/audio.py:146: UserWarning: PySoundFile failed. Trying audioread instead. warnings.warn(‘PySoundFile failed. Trying audioread instead.’) /Users/igneus/.pyenv/versions/3.7.4/lib/python3.7/site-packages/librosa/core/audio.py:146: UserWarning: PySoundFile failed. Trying audioread instead. warnings.warn(‘PySoundFile failed. Trying audioread instead.’) Segmentation fault: 11

Versions

Darwin-19.0.0-x86_64-i386-64bit Python 3.7.4 (default, Sep 26 2019, 17:15:53) [Clang 10.0.1 (clang-1001.0.46.4)] NumPy 1.17.3 SciPy 1.3.1 librosa 0.7.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:23 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
00sapocommented, Nov 26, 2019

The same happens with ‘braycurtis’

2reactions
igneus-laucommented, Nov 18, 2019

I converted the mp3 files to wav, and removed all plotting code. But the same segmentation error is still thrown from the dtw line.

Now the code is very simple:

from __future__ import print_function
import librosa

x_1, fs_1 = librosa.load('audio/sir_duke_fast.wav')
x_2, fs_2 = librosa.load('audio/BFJazz_-_Stargazer_from_Texas.wav')

n_fft = 4410
hop_size = 2205

x_1_chroma = librosa.feature.chroma_stft(y=x_1,
                                         sr=fs_1,
                                         tuning=0,
                                         norm=2,
                                         hop_length=hop_size,
                                         n_fft=n_fft)
x_2_chroma = librosa.feature.chroma_stft(y=x_2,
                                         sr=fs_2,
                                         tuning=0,
                                         norm=2,
                                         hop_length=hop_size,
                                         n_fft=n_fft)

# dtw line is where segmentation fault happens
D, wp = librosa.sequence.dtw(X=x_1_chroma, Y=x_2_chroma, metric='cosine')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Anticipatory DTW for Efficient Similarity Search in Time Series ...
As DTW is computationally expensive, ecient algorithms for fast computation are crucial. In this paper, we propose a novel lter-and-rene DTW ...
Read more >
Segmentation fault with g++ (when using to_string twice on ...
When commenting out the second to_string (i.e. //std::to_string(x); ) or when changing x to a non-nan value (i.e. x = 10; ) or...
Read more >
Data_of_US_Airline_tweets | Kaggle
Problem Statement¶. Objective. You are given a data of US Airline tweets and their sentiment. The task is to do sentiment analysis about...
Read more >
Advances in Knowledge Discovery and Data Mining
Nan Li. Alibaba, China. Peipei Li. Hefei University of Technology, China ... Similarity-Aware Deep Attentive Model for Clickbait Detection .
Read more >
lai time series: Topics by Science.gov
Analysis on Difference of Forest Phenology Extracted from EVI and LAI Based on ... The model incorporates a number of site/region specific parameters, ......
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