worldveil / dejavu

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

The rate of hash used is low when recognizing #39

Closed suxianbaozi closed 10 years ago

suxianbaozi commented 10 years ago

According to the code, when making hash,choose two point and this two point has random delta of time,but as common ,we often recognize the sound which short of 10 seconds, so if the two point which have the delta of time are more than 10 second ,the hash would never be used,which cause too many unused hashes. if we can just choose the two point which has little delta of the time ? so when recognize a 10 second sound, all the hashes made will be affected in the database

worldveil commented 10 years ago

@suxianbaozi can you provide some information / graphs for you experiments with large sets of mp3 files? I'd be very interested to see the rates of hashes used.

suxianbaozi commented 10 years ago

Ok I'll try

suxianbaozi commented 10 years ago

Currently,I used this for radio song recognize ,the radio stream is HLS with many 10 seconds TS(AAC) file blocks,every 5 seconds ,I'll take one for recognizing . because of the song library was big,I have change song fingerprint algorithm to short the number of hash。

In "generate_hashes" method of fingerprint.py,I changed the peaks(list) to time-frequence(list) and sort it , every time I'll take one frequence(list) to make len(freqs[i]) * len(freqs[i + 1]) + len(freqs[i]) * len(freqs[i + 2]) number of hashes, and it works good. I don't know if it works for other recognize such as microphone. or some sound with noise.

hope you can read it!

Now I have 2000 songs in my database ,with about 20,000,000 number of hashes. One 10 seconds TS(ACC) file with about 250 hashes that will affect about 5000 hashes in database,and the confidence is 30-200 as common,and which would take about 3 seconds of time

CPU:Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz MEMERY:8G OS: Ubuntu 12.04

worldveil commented 10 years ago

Very cool! Is that change to the code in your personal branch? I'm not quite understanding from your description.

But yes, it stands to reason that different settings for microphone recognition and file recognition (with regards to memory and accuracy) have different settings that are optimal. Glad to see the project is of use to you!

suxianbaozi commented 10 years ago

Thanks for your project, I think it will take more convenience to more people

I make a mistake pullrequest and I don't how to delete it - -!

suxianbaozi commented 10 years ago

https://github.com/suxianbaozi/dejavu/blob/master/dejavu/fingerprint.py
you can find the change of generate_hashes method