Unit 09.01: Similar, and what it is similar in
"Similar" means similar in whatever the embedding model was trained to distinguish.
Four pairs, and what actually drove each match
Same object, different objects in the same lighting, same object in different lighting, and a photograph of a photograph.
The code lists what each match was really responding to.
PAIRS = [
("two photos of the same carton", "high", "what you wanted"),
("two different cartons, same lighting", "high", "it matched the lighting"),
("the same carton, dim vs bright", "lower", "lighting dominates"),
("a carton and a printed picture of one", "high", "no notion of real vs printed"),
]
print(f"{'pair':40} {'similarity':>11} what it actually matched")
for pair, level, why in PAIRS:
print(f"{pair:40} {level:>11} {why}")
print("""
"Similar" is similar in whatever the embedding model was trained to
distinguish. A model trained on web photographs encodes lighting, background
and pose alongside object identity, and it cannot tell you which of them drove
a given match.
The consequence: check what your near-neighbours have in common before
concluding the system understands your objects.
""")
The last case is the sharpest. A carton and a printed picture of a carton score highly, because the embedding has no notion of a real object versus a depiction of one - that distinction is not in the training signal.
The practical consequence: look at what your top matches have in common before concluding the system understands your objects. Often it is the background.
The mistake this prevents
The mistake is assuming a general-purpose embedding encodes the property you care about. A model trained on web photographs encodes lighting, pose and background alongside identity, and cannot tell you which drove a match.
Takeaway
Similarity is in whatever the model was trained to distinguish. Inspect what your near-neighbours share before trusting the notion of similar.
