[HN Gopher] pHash - An open source perceptual hash library (2013)
___________________________________________________________________
pHash - An open source perceptual hash library (2013)
Author : tosh
Score : 53 points
Date : 2021-08-21 11:51 UTC (11 hours ago)
(HTM) web link (www.phash.org)
(TXT) w3m dump (www.phash.org)
| ek_throwaway wrote:
| This is one of the authors:
| https://everipedia.org/wiki/lang_en/evan-klinger
| OrvalWintermute wrote:
| I don't think it is relevant to link to doxxing information,
| however reprehensible the racist comments made by both parties
| in the fracas are.
| nacs wrote:
| It's not really doxxing -- the guy's name is right on the
| linked phash homepage.
| tambourine_man wrote:
| One of the most fun times I ever had coding was implementing a
| simple but quite fast and reasonably efficient image hash.
|
| Loosely based on this algorithm:
|
| https://benhoyt.com/writings/duplicate-image-detection/
|
| Highly recommended fun exercise.
| etaioinshrdlu wrote:
| I use this a lot for image hashing. How does it compare to
| Apple's NeuralHash?
|
| I would expect that Apple probably did a very good job at their
| implementation, and pHash is quite old tech.
| blacktulip wrote:
| Does it pronounce 'P-Hash' or 'Fash'?
| inglor wrote:
| It's interesting to note that conceptually stuff like pHash
| (which is very useful) is similar to dimensionality reduction as
| we see it in machine-learning/data-science scenarios.
| igorkraw wrote:
| It's not just similar, learning a classifier is 100% identical
| to finding a perceptual hash onto your classes that aligns with
| human sensibilities
| edge17 wrote:
| Kind of. The only point of phash is to make comparing images
| fast and cheap... meaning from a practical standpoint there
| isn't a ton of useful information in the hash. All you really
| care about is the final hamming distance between two hashes.
| vortico wrote:
| I've been looking for something like this to write a custom
| solution for finding near duplicates in image libraries. Will
| give it a spin!
| mceachen wrote:
| Note that pHash is GPL (if you're thinking of including it in a
| library or product).
|
| I evaluated a ton of different images hashing algorithms for
| PhotoStructure, and saw similar accuracy from pHash, dhash, and
| mhash. I found that an mhash triplet rendered against a L*a*b*
| space (rather than just looking at a brightness channel) was
| best.
|
| I also found too many false negatives _and false positives_
| when aggregating duplicates until I also included file metadata
| heuristics. Pesky camera manufacturers are surprisingly
| inconsistent in how they encode the same metadata across, say,
| RAW and JPG images. I'm up to a gig of exemplar pairs that CI
| tests use to verify a litany of weirdnesses, like
| inconsistently encoding exposure information (in looking at
| you, Google Pixels), or GPS (iDevices), or even make, model,
| and serial number (several dSLR and other flagship phone
| manufacturers).
|
| I wrote this up with some more details if you're interested:
| https://photostructure.com/faq/what-do-you-mean-by-deduplica...
| vortico wrote:
| I don't need to release the software, just using for my
| personal internet archive server with a few TB of images.
| Specifically interested in finding images that are a subset
| of others, or recompressed with JPG, or slightly discolored
| or rotated, or with text overlaid.
|
| Interesting software!
| charles_f wrote:
| You'll probably be interested in these links which describe
| algorithms in simple words:
| http://hackerfactor.com/blog/index.php?/archives/432-Looks-L...
| and http://hackerfactor.com/blog/index.php?/archives/529-Kind-
| of...
| [deleted]
| DerekBickerton wrote:
| Glad it's on Github here: https://github.com/aetilius/pHash
|
| Github repos tend to outlive the homepage of some projects. I got
| worried when I read this:
|
| > Copyright (c) 2008-2010
| thrwyoilarticle wrote:
| Neural nets are just locality-sensitive hashing functions, after
| all.
| motohagiography wrote:
| It's funny, but as a naive reader, I was reading through with
| the question of why you would use DCT whether it's
| significantly different from python's cosine_similarity, and
| why you would use that instead of say, pythagorean distance,
| edit distance, conditional entropy, and related methods. Is it
| a speed/accuracy trade off? Obviously I don't have depth on
| these as the answer would be trivial to someone who did, but
| I'm wondering if there a simple breakdown of what these and
| other information similarity methods optimize for.
| amitport wrote:
| ? Any references?
| wizzwizz4 wrote:
| When they convert a large number of inputs into a small
| number of outputs, they're acting like a hash function. (By
| this metric, lossy compression algorithms are all hash
| functions.)
| duffyjp wrote:
| I've been using this in a Rails app to detect duplicate image
| uploads for years. It works really well.
|
| https://github.com/westonplatter/phashion
| edge17 wrote:
| Yea, i've used phashs before to find duplicates in image
| datasets for training neural nets. Mainly as a high level
| method for cleaning up large image sets.
| dchuk wrote:
| at a high level, how did you implement this? Are you storing
| the phash of each image in the database and then when new
| images are uploaded, do you query the database to see if any
| matches return? If so, how does that query actually work?
|
| Or are you using this to ensure there's no duplicates in a
| batch of images being uploaded?
___________________________________________________________________
(page generated 2021-08-21 23:02 UTC)