worldveil / dejavu

Audio fingerprinting and recognition in Python
MIT License
6.36k stars 1.43k forks source link

Fingerprinting fails because `numpy boolean subtract` deprecated #147

Open alanbernstein opened 6 years ago

alanbernstein commented 6 years ago

I'm trying to use dejavu for the first time (just djv.fingerprint_directory(audio_path, [".mp3"], 3)), and it seems to fail on all files. I see output like this:

$ python dejavu-scan.py
~/venvs/dejavu/lib/python2.7/site-packages/dejavu/database_sql.py:158: Warning: Table 'songs' already exists
  cur.execute(self.CREATE_SONGS_TABLE)
~/venvs/dejavu/lib/python2.7/site-packages/dejavu/database_sql.py:159: Warning: Table 'fingerprints' already exists
  cur.execute(self.CREATE_FINGERPRINTS_TABLE)
Fingerprinting channel 1/2 for ~/audio/file-1.mp3
~/venvs/dejavu/lib/python2.7/site-packages/dejavu/fingerprint.py:86: RuntimeWarning: divide by zero encountered in log10
  arr2D = 10 * np.log10(arr2D)
Fingerprinting channel 1/2 for ~/audio/file-2.mp3
Fingerprinting channel 1/2 for ~/audio/file-3.mp3
Failed fingerprinting
Traceback (most recent call last):
  File "~/venvs/dejavu/lib/python2.7/site-packages/dejavu/__init__.py", line 77, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 668, in next
    raise value
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.

The Failed fingerprinting and traceback repeat as long as I let the process go.

JPery commented 6 years ago

You should use numpy==1.13.3 to avoid this problem

alanbernstein commented 6 years ago

That seems to have worked. Should requirements.txt be updated?

JZT1299 commented 6 years ago

downgrade to 1.13.3, but I got another error: RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb ImportError: numpy.core.multiarray failed to import

ii64 commented 5 years ago
    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

jamesjasz commented 5 years ago
    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

really helpful, thanks a lot dude

ghostPath commented 5 years ago
    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

really helpful, thanks a lot dude

but I got another error 'numpy.ndarray' object is not callable

image

ii64 commented 5 years ago

at fingerprint.py maybe thats help

really helpful, thanks a lot dude

but I got another error 'numpy.ndarray' object is not callable

Pretty sure you call the array (numpy version related) change the arr2D(detected_peaks) with arr2D[detected_peaks]

or could you take a look to @DataWookie's fork? https://github.com/DataWookie/dejavu

madhavtummala commented 5 years ago

You should use numpy==1.13.3 to avoid this problem

This will solve it, no error.

sunravi commented 5 years ago
    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

Yes. That helped. Thanks a lot

sunravi commented 5 years ago

You should use numpy==1.13.3 to avoid this problem

This will solve it, no error.

I tried this. But for some reason, I was unable to downgrade numpy. Winpython was throwing lot of errors