You're viewing the readable version of this site. The interactive extras (search, diagrams, read-aloud) need JavaScript and a current browser. Enable JavaScript; if it is already enabled, update your browser.

Learn · Pictures Are Not Words

budding

Same Bytes, Same Scene, Same Meaning

Choose the relation before choosing the fingerprint.

search, images, duplicate-detection, perceptual-hash, sift, geometric-verification, learn

“This paper presents a method for extracting distinctive invariant features from images.”

— David G. Lowe, Distinctive Image Features from Scale-Invariant Keypoints

This is the twenty-ninth chapter in a book about search from first principles. You will distinguish byte identity, transformed duplication, repeated-instance matching, and semantic relevance; prove that byte identity is an equivalence relation; construct a nontransitive thresholded perceptual relation; derive the false-match versus missed-copy trade; and use local correspondences plus geometric verification for viewpoint changes. The next chapter builds a semantic geometry only after the desired relation is named.

One photograph, four questions

Begin with a photograph of a red chair. Produce five items:

  1. the original file;
  2. a byte-for-byte copy;
  3. a recompressed and cropped copy;
  4. a new photograph of the same physical chair; and
  5. a drawing of a red chair.

Different questions select different pairs:

Requested relation Positive examples Suitable evidence
exact content identity 1 and 2 cryptographic digest plus byte verification
transformed-media duplication 1 and 3 calibrated perceptual fingerprint
same physical instance or scene 1 and 4 local matches plus geometric consistency
semantic relevance 1 and 5 task-specific representation and judgments

Calling every row “similar” erases the contract. The system can then pass a duplicate benchmark and be advertised as an object recognizer, or pass a semantic benchmark while failing to find a recompressed copy reliably.

Prediction — name the relation before the tool.

Byte identity forms clean classes

Define (x\equiv_b y) when the finite byte sequences of files (x) and (y) are equal. Then:

  • reflexivity: (x\equiv_b x);
  • symmetry: (x\equiv_b y\Rightarrow y\equiv_b x); and
  • transitivity: (x\equiv_b y\land y\equiv_b z\Rightarrow x\equiv_b z).

Thus byte identity is an equivalence relation and partitions files into disjoint classes. A cryptographic content digest is an efficient candidate key for those classes, but a digest match is not a mathematical proof that two arbitrary byte strings are equal. Hash functions have finite outputs and their domains are larger, so collisions exist. For adversarial or load-bearing identity, compare the bytes after a digest match or use a threat model that explicitly accepts the residual risk.

A cryptographic digest deliberately changes unpredictably after a tiny edit. That property makes it poor at recognizing recompressed or cropped copies.

A perceptual threshold is not identity

Let (h(x)\in\{0,1\}^n) be a perceptual fingerprint and let (d_H) be Hamming distance. A system may declare a candidate transformed copy when

xτyiffdH(h(x),h(y))τ. x\sim_\tau y \quad\text{iff}\quad d_H(h(x),h(y))\leq\tau.

This relation is reflexive and symmetric, but it need not be transitive. With three two-bit hashes

h(a)=00,h(b)=01,h(c)=11 h(a)=00,\qquad h(b)=01,\qquad h(c)=11

and (\tau=1), (a\sim_\tau b) and (b\sim_\tau c), yet (a\not\sim_\tau c). Thresholded proximity therefore does not create the same kind of stable quotient as byte identity. Connected-components clustering would add matches the pairwise rule itself rejected.

Increasing (\tau) catches more transformations but admits more unrelated pairs. For labeled positive pairs (P) and negative pairs (N), define

FNR(τ)=|{(x,y)P:dH(h(x),h(y))>τ}||P| FNR(\tau)=\frac{|\{(x,y)\in P:d_H(h(x),h(y))>\tau\}|}{|P|}

and

FPR(τ)=|{(x,y)N:dH(h(x),h(y))τ}||N|. FPR(\tau)=\frac{|\{(x,y)\in N:d_H(h(x),h(y))\leq\tau\}|}{|N|}.

Choose (\tau) from the declared loss and workload, not from a folklore value. Compression, crop, text overlays, screenshots, and adversarial edits deserve separate slices because their distance distributions differ.

Reveal — find the failed law.

Another view needs local evidence

A crop may remove the global arrangement that a perceptual fingerprint summarizes. A new viewpoint changes it further. Instance search instead finds local image features, matches distinctive descriptors, and asks whether enough correspondences agree on a plausible geometric transformation.

Suppose a candidate correspondence pairs point (p_i) in the query with (q_i) in the document. A geometric model (H) predicts (q_i\approx H(p_i)). An inlier satisfies

qiH(pi)ϵ. \|q_i-H(p_i)\|\leq\epsilon.

Several individually plausible descriptor matches become convincing only when one model explains them together. This is the same general pattern seen throughout search: cheap evidence generates candidates; a stricter shared constraint verifies them.

SIFT, introduced by David Lowe and developed in its 2004 journal formulation, constructs local descriptors designed to remain stable across scale and rotation and useful ranges of other image changes. It does not turn every viewpoint or object into a guaranteed match. Textureless surfaces, repeated patterns, occlusion, severe viewpoint changes, and domain shift remain hard.

Algorithm — relation-aware image matching

MATCH-IMAGE(QUERY, CANDIDATE, RELATION, POLICY)
Input:  two bounded images, named RELATION, calibrated POLICY
Output: relation-specific decision with evidence

if RELATION = BYTE-IDENTITY
    if DIGEST(QUERY)  DIGEST(CANDIDATE)
        return NO-MATCH
    return COMPARE-BYTES(QUERY, CANDIDATE)
if RELATION = TRANSFORMED-COPY
    distance  HAMMING(PERCEPTUAL-HASH(QUERY), PERCEPTUAL-HASH(CANDIDATE))
    return THRESHOLD-RECEIPT(distance, POLICY.copyThreshold)
if RELATION = SAME-INSTANCE
    pairs  MATCH-LOCAL-FEATURES(QUERY, CANDIDATE, POLICY.featureLimit)
    model  VERIFY-GEOMETRY(pairs, POLICY.errorBound, POLICY.trialLimit)
    return GEOMETRY-RECEIPT(model, pairs)
return UNSUPPORTED-RELATION

The algorithm refuses to silently substitute one relation for another. Every branch has its own judgments, parameters, costs, and evidence receipt.

Wrong turns

Use one fingerprint for everything

A digest is intentionally edit-sensitive. A perceptual hash summarizes global appearance. Local features seek repeatable parts. Semantic representations learn a task-shaped geometry. Their differences are not implementation noise; they are the point.

Turn threshold matches into equivalence classes

Nontransitivity makes this unsafe. A chain of mild transformations can connect endpoints too different to pass the declared pairwise threshold.

Calibrate on random negative images only

Easy negatives make false-match rates look artificially small. Near-duplicate templates, repeated logos, screenshots, and visually confusable items belong in the negative set when they occur in the real workload.

Call local-feature recurrence semantic understanding

Geometric consistency can show that image regions plausibly depict the same instance. It does not prove the images express the same idea or satisfy the same textual request.

Transfer — choose the evidence for a new viewpoint.

The remaining relation is meaning

Two pictures can be relevant to the same request without sharing bytes, transformations, or physical objects. A photograph of a chair and a drawing of a chair may both answer “red seating.” To retrieve that relation, the system must choose a representation whose training objective or hand-built features place those items near each other.

The next chapter begins there. It defines the feature map before asking for nearest neighbors, because changing the map changes what “near” means.

Lessons

  • Byte identity, transformed duplication, instance recurrence, and semantic relevance are different relations.
  • Byte equality is an equivalence relation; a digest is its candidate key, not a universal perception mechanism.
  • Thresholded perceptual distance need not be transitive.
  • A larger perceptual threshold trades fewer missed copies for more false matches.
  • Calibration requires representative transformations and hard negatives.
  • Local feature matches gain force through geometric consistency.
  • Instance evidence is not semantic relevance.
  • Every result should name the relation that admitted it.

Practice

  1. Prove byte equality is reflexive, symmetric, and transitive.
  2. Construct a three-hash nontransitivity example for threshold two.
  3. Explain why connected components change a pairwise threshold contract.
  4. Design positive and hard-negative slices for screenshot duplicate detection.
  5. Name a transformation that defeats a digest but should preserve duplication.
  6. Name a scene where global perceptual hashing beats local features, and one where local geometry wins.
  7. Give two semantically related images that share no instance.

References