G-XR8P2XJ088

Perceptual Hashing: A Close Match Is a Candidate, Not a Verdict

An illustrator finds three versions of a product photograph in an archive. One is the source image, one is a compressed copy for the shop and one is a crop approved for a newsletter. The files have different names and sizes, but they look closely related. A fourth shows a different product photographed on the same cream backdrop. What should the archive call a duplicate? The answer depends on whether the job is to find related images, recover a missing original or decide which files to keep.

Perceptual hashing can help with the first job. It gives you a compact way to look for images that resemble one another under a particular comparison method. The result is a starting point for review. A good archive still needs to distinguish a disposable copy from a version that is doing useful work.

What the signature can tell you

A file hash calculated from the bytes is useful when you want to screen for byte-identical copies. Resaving a photograph can change its bytes without changing what you recognise in it. A perceptual hash is designed around what appears in the image, so visually similar files can have nearby signatures despite having different bytes. The two comparisons answer different questions, and you may want both in an archive audit.

For a concrete example, Facebook’s August 2019 announcement introduced its open-source PDQ image matching algorithm. The PDQ documentation describes a perceptual signature made up of 256 bits. Its matching notes describe searches based on Hamming distance: count how many corresponding bits differ. If two such signatures differ in eight positions, the distance is eight. Eight is an illustration of how to read the number, not a recommended threshold or a percentage of visual similarity.

PDQ is an example of an image processing method, rather than a system that knows what the image represents. A learned retrieval system, such as the one discussed in the MaryChuks guide to DINOv2 and image search, can be evaluated for a different job, such as finding photographs of the same item from different viewpoints. A method that finds two exports of one photograph may miss a second photograph of that item. Choose the comparison that fits the question.

Build a sample from the mistakes you care about

Start with a small set of pairs you can label by hand. For the illustrator’s archive, one pair might contain the source and the web export. A second might contain the original and its approved newsletter crop. A third might contain the two different products photographed on the same backdrop. Decide which should appear together in a review list and which must remain separate when you organise the files. Those are two different decisions: you can want to see the crop next to the source while keeping both.

  • Include versions that really belong together. Choose several ordinary exports the archive receives, including resized or recompressed versions. Record the source image where you know it.
  • Include misleading neighbours. Compare artwork built on the same template or similarly framed products. A test made only of obviously different images will tell you little about the pairs a reviewer is likely to struggle with.
  • Keep some examples for a second check. If you adjust a threshold to suit your first set, run the revised rule on other images before assuming it works across the archive.

A more permissive distance limit sends more candidates to review; a stricter one sends fewer. Neither saves time if the chosen rule routinely misses the versions you need to find or buries them in unrelated suggestions. On the sample, count both the missed pairs and the unrelated pairs flagged. Also note how long it takes to resolve the difficult cases. A workable threshold for a small archive is partly a question of how much review the owner can do.

Keep the decision tied to the file’s job

When a pair is flagged, put the actual images side by side. Look for cropping, retouching, changed text and detail that is visible at the intended display size. Then inspect the records that explain where the files are used. A web export and a print master can look alike in thumbnails while serving different purposes. A smaller file might also be the only copy of the approved crop. Neither a low distance nor a large file size tells you which version a colleague or customer needs.

If a group was built by linking adjacent matches, check the far ends too. A can be close to B and B close to C without A and C falling within the same distance limit. Treat a chain of suggestions as a group to review, rather than evidence that every member is interchangeable.

Start with a report that lists candidate pairs, their paths and the reason they were flagged. Keep automatic deletion out of that first pass. If the reviewer confirms that two files really serve the same purpose, record which copy to retain and check for references to the other. If the files have different uses, mark them as related versions so the next review starts with useful information. The success of the search is that you find the right pair faster; the success of the archive is that the version you need is still there.

Sources

Leave a Reply

Discover more from Marychuks.com AI, Psychology, Business & CreativeVerse

Subscribe now to keep reading and get access to the full archive.

Continue reading