Live data from Hacker News

How Perceptual Hashes Work

hackerfactor.com

41–50 of 77 posts

Re: How Perceptual Hashes Work

#41

Wow, I had no idea it was so easy. Could this in fact be used to combat copyright infringement for the likes of The Oatmeal on large scale, given someone (Google) with the requisite computing power?

For that specific situation, this wouldn't help too much, seeing as the up-loaders are already removing source info, so it's reasonable to assume they will fudge the image somehow to change the hash value.

Re: How Perceptual Hashes Work

#42
post #32
post #14

Earlier quoted context omitted.

The article explicitly mentions Hamming distance, which is also what I mean by bit distance.

Yes, but his remarks suggests that hamming distance is not very nice for pictures after his transformation (d(i1, i2) == 5 -> small, d(i1, i2) == 10 -> big). As I am not familiar with image signals, I don't know if this can be somehow mitigated with other techniques. Of course, the only way to be sure would be to actually test it, but I would not bet much on it. Another issue I forgot to mention is that each "point"…

In the case of Hamming distance there is much more information to work with than in a bare metric. You can dump all the bitstrings into a suffix array, break the query into K pieces and search for an exact match for each piece. The resulting list of matches is usually small enough to just compute the Hamming distance against each element. I've used this on a corpus of 2m LaTeX strings withbgood results. See my above post for more details.

Re: How Perceptual Hashes Work

#43

The two main problems with this approach is it is not rotation-invariant and it does not work well if the image is damaged or added to. A more robust system (that, admittedly, will take longer) is to use one of the affine-invariant feature detection algorithms pioneered by SIFT. SURF is a faster, open-sourced version of SIFT that has many implementations. Essentially it scans chunks of the image at different scales a…

As a followup (and this is rather unrelated to the original post), you can combine a feature detector with a statistical clustering algorithm to automatically identify the generic visual properties of objects in an unsupervised manner . One of the first papers attempting this is http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.... but many have followed it. From what I understand these still simply check f…

I went to a talk by Yann LeCun [1] a few months back, "Learning Feature Hierarchies for Vision." The current state of the art in this field is mind-blowing to an outsider. The final demo was a program that he trained in a matter of seconds to recognize and distinguish faces of various random audience members, in real time, from different viewing angles.

[1] http://yann.lecun.com/

Re: How Perceptual Hashes Work

#44

I've always wondered how services like Shazam work. I'm amazed that they can do this kind of perceptual hash against ANY 10 second portion of a song. How do they search against something like that when they don't know the start or end time of the segment that is being input?

I do research in music information retrieval. See the ISMIR 2003 paper below. In short, it searches for landmarks in the spectrogram, hashes those landmarks, then compares those hashes against database hashes for temporal continuity. http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf A seminal paper on audio fingerprinting is the one by Haitsma and Kalker. http://ismir2002.ismir.net/proceedings/02-fp04-2.pdf

Thanks!

Re: How Perceptual Hashes Work

#45

I have a feeling there is a deep connection between perceptual hashes and compressed sensing. Could someone more familiar with the latter weigh in?

Kinda sorta not really. Compressed sensing and sparse coding show that, under certain sparsity assumptions, you can perfectly reconstruct your original data with fewer bits than previously thought. It is a coding principle. Perceptual hashes (or hashes in general) are used for fast indexing and retrieval. You cannot recreate the original data from a hash, pretty much by definition. So hashes and coding algorithms bot…

The key thing here is that compressed sensing is an attempt to throw away redundant data as early as possible in the process. Any data which is redundant in the actual data stream, or can be inferred from prior knowledge about the stream does not need to be measured.

Perceptual hashing is instead an attempt to make the matching problem easier by throwing away data that is seen as irrelevant. In the case of the described algorithm, low frequencies are chosen as relevant and high frequencies as irrelevant. As you point out, this involves losing the ability to recover the original signal and adds the risk of mismatching in cases where data thought to be irrelevant to the task is actually relevant.

Re: How Perceptual Hashes Work

#46

This reminds me of OpenSSH's fingerprint visualization support ("VisualHostKey yes"): $ ssh A.B.C.D Host key fingerprint is b0:c9:c9:96:fb:fd:ac:a4:ff:70:8f:1b:35:f4:f9:2e +--[ECDSA 256]---+ | | | | | . . | | o * . ..| | O S o..| | . . . ..| | . o o .| | . + + +E. | | o.++*....| +-----------------+ me@A.B.C.D's password: Original article introducing this feature: http://www.undeadly.org/cgi?action=article&sid=2008061…

I can't be the only one who thinks "This looks like the visualization algorithm is nethack"

Re: How Perceptual Hashes Work

#47

I've always wondered how services like Shazam work. I'm amazed that they can do this kind of perceptual hash against ANY 10 second portion of a song. How do they search against something like that when they don't know the start or end time of the segment that is being input?

A Matlab implementation and tutorial to give you an idea can be found here: http://labrosa.ee.columbia.edu/~dpwe/resources/matlab/finger...

Re: How Perceptual Hashes Work

#48
post #43

Earlier quoted context omitted.

As a followup (and this is rather unrelated to the original post), you can combine a feature detector with a statistical clustering algorithm to automatically identify the generic visual properties of objects in an unsupervised manner . One of the first papers attempting this is http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.... but many have followed it. From what I understand these still simply check f…

I went to a talk by Yann LeCun [1] a few months back, "Learning Feature Hierarchies for Vision." The current state of the art in this field is mind-blowing to an outsider. The final demo was a program that he trained in a matter of seconds to recognize and distinguish faces of various random audience members, in real time, from different viewing angles. [1] http://yann.lecun.com/

Is any of that software available?

Re: How Perceptual Hashes Work

#49
Tineye must take this so much further, one image I looked up was about half of one of the pictures returned, I think it was in a page of a book.

From the reddit link further down - "A Fourier transform takes a signal in the time domain and breaks it down into its frequency components. Simplified, it takes a CD and produces sheet music.", "To be clear, OP says this is a matching algorithm - it's not what tineye uses, because matching the signature from the searched-for image with the database of previous signatures which is probably a nightmare."

Re: How Perceptual Hashes Work

#50

I've always wondered how services like Shazam work. I'm amazed that they can do this kind of perceptual hash against ANY 10 second portion of a song. How do they search against something like that when they don't know the start or end time of the segment that is being input?

For pop/rock/rap music it probably doesn't matter. For classical, I'm not sure.

I think you just suggested that classical music is all the same.
Post reply on HN