You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Count highly similar shots as duplicates; Bursts and Duplicates tabs in albums - #38
What changed: two shots of one scene now count as alike when their visual (CLIP) embeddings are at least similar_clip percent similar. Before, their perceptual hashes had to be within stack_hamming bits. The hash test is still kept, so shots not yet visually analysed are covered.
Why: a subject shot again a little reframed, like the painting and the crane in "20261118-Out-Around", now stacks.
The setting: default 93, allowed 80–99, 0 turns it off. It is on the Settings page and in archivis settings.
Duplicates are redefined. A set is identical images (the same phash) found anywhere in the catalogue, joined with the stacks, i.e. the highly similar shots of a scene. If an identical copy of a stacked shot exists elsewhere, it joins that stack's set. A photo is still in only one set, so dup_id, the photo page's list (now headed "Duplicates") and the Duplicates page keep working as before.
Bursts and Duplicates inside albums.
Every album (and iPhone) gets Photos · Bursts · Duplicates tabs.
/bursts and /duplicates accept the album's dir/iphone. They then list only groups with a photo in that album or its subfolders, and show just those photos. They keep the album's filters, crumbs and way back, and Reset stays inside the album.
For a small album (under 200k photos), the groups are found from its photos through the path index.
Regrouping.groupsVersion is now 7 and groups_similar is stamped, so every catalogue regroups once in the background after updating, and again whenever the setting changes.
Notes
Scope. Similarity is only compared within a scene: one camera's shots, each within the scene gap of the last, in chunks of at most 1000 shots, which is the same window stacks already use. So the cost stays bounded. Exact copies are still matched across the whole catalogue by phash.
Comparison. Each shot is compared with its stack's best shot, best first, so a slow pan doesn't chain into one stack. Embeddings are loaded per chunk from photo_clip and scaled to unit length.
Timing. On a synthetic catalogue of 100k photos with embeddings, a first regroup took about 5 s with the setting on (0.9 s with it off). That puts the first regroup of a 263k-photo catalogue at about 13 s.
Effect on the Duplicates page. Every stack now also shows on the Duplicates page, as you chose ("same rule"). To make stacks and duplicates stricter, raise similar_clip.
Tests (each checked to fail without its change):
TestStackFramesBySimilarity: shots stack by similarity though their hashes are far apart; at 99%, or with the setting off, only hashes count; without an embedding, the hash is the fallback.
TestSimilarShotsAreDuplicates: the painting/crane album. Each three stack and form one duplicate set. An identical copy joins its set; a like shot from another scene does not. Changing the setting regroups, and with it off only the exact copy is left.
TestSimilarGroupsMatchReference: a randomized catalogue with embeddings matches the in-memory reference, which now merges stacks with exact copies.
TestAlbumBurstsAndDuplicates: the tabs carry the album and its filters. The album's Bursts and Duplicates pages list only its groups, with crumbs, an on-tab, a Reset that stays in the album, and filters still applied.
TestSimilaritySetting, and the store and CLI settings tests: the setting is saved, and out-of-range values are refused.
DEPLOY.md (Settings, Stacks, "Bursts and duplicates") and the README are updated.
…in albums
Shots of one scene now count as one picture when they look alike by
their CLIP embeddings (the new similar_clip setting, 93% by default,
80-99, 0 off), not only when their perceptual hashes are close, so a
subject shot again a little reframed stacks. The same rule makes
duplicates: a set is the identical images (same phash) anywhere,
joined with the stacks, so an identical copy of a stacked shot joins
its stack's set. Groups are worked out again once (groups version 7)
and whenever the setting changes.
Each album gets Photos, Bursts and Duplicates tabs. /bursts and
/duplicates take the album's dir (or iphone), keep its filters and
crumbs, and list only the groups with a photo in it, with just those
photos; a small album's groups are found from its photos.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WwontTm7iEMh1uyZbQbJ9d
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An active performance finding notes that grouping computes unnecessary 512-component dot products even when perceptual hashes already satisfy the grouping rule.
alike accepts a pair when either rule does, so testing the cheap hash
rule first gives the same stacks and skips the 512-component dot
product whenever the hashes already match (identical copies, RAW and
JPEG pairs). A chunk of 1000 identical copies now stacks in about
107 us instead of about 460 us.
TestAlikeEitherRule checks alike against both rules on random pairs
covering every combination; BenchmarkStackFramesCopies measures the
copies case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WwontTm7iEMh1uyZbQbJ9d
Skip visual stacking for photos with unknown cameras
internal/store/groups.go:626
Dated photos with no camera metadata share the same scene key, and this now loads embeddings for them too. Unrelated exports minutes apart can therefore be stacked and hidden solely on visual similarity, despite the one-camera scene rule. Skip the visual comparison for unknown cameras while retaining the hash fallback.
Preserve album search when switching group tabs
internal/web/albums.go:436
Switching from an album search to Bursts or Duplicates drops q because carried excludes it, so clicking Photos again shows the unsearched album. Preserve the search text in the tab links as navigation state; the group handlers can continue ignoring it when listing groups.
…lbum search across tabs
CLIP sees only the centre square of a frame, so a match on looks alone
(hashes far apart) now also needs both shots' sizes known, neither
wider than 2:1 (the crop covers at least half of each frame) and their
shapes within 10% of each other, whichever way up. Panoramas, mixed
shapes and shots of unknown size stack by their hashes only.
Dated photos without a camera share one "scene", so exports and scans
minutes apart no longer stack on looks; their hashes still may, and
exact copies are still duplicates anywhere. Groups version 8 regroups.
An album's search text now rides along on its Bursts and Duplicates
tabs, their filter form and Reset, so the Photos tab brings the search
back; the group pages still ignore it when listing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WwontTm7iEMh1uyZbQbJ9d
On review 6013195542. Its two "previously missed" points have no threads, so I'm answering them here. Both were real, and both are fixed in 5942da6.
Photos without a camera stacking on looks (groups.go:626): dated photos with no make or model are keyed as one camera, so exports or scans minutes apart shared a "scene". chunkDetails now drops their embeddings before stacking. Their hashes still stack them as before, and exact copies are still duplicates anywhere. TestSimilarShotsAreDuplicates adds two camera-less shots a minute apart with like embeddings; they stay apart. The test fails without the change, as does TestSimilarGroupsMatchReference.
Album search lost across tabs (albums.go:436): the tabs now carry the album's search text to Bursts and Duplicates. Those pages still ignore it when listing groups, but keep it in their filter form, Reset link and Photos tab, so coming back restores the search. TestAlbumBurstsAndDuplicates covers the trip and checks the search doesn't narrow the sets. It fails without the change.
The high-severity centre-crop point is answered on its thread.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changeset
similar_clippercent similar. Before, their perceptual hashes had to be withinstack_hammingbits. The hash test is still kept, so shots not yet visually analysed are covered.archivis settings.dup_id, the photo page's list (now headed "Duplicates") and the Duplicates page keep working as before./burstsand/duplicatesaccept the album'sdir/iphone. They then list only groups with a photo in that album or its subfolders, and show just those photos. They keep the album's filters, crumbs and way back, and Reset stays inside the album.groupsVersionis now 7 andgroups_similaris stamped, so every catalogue regroups once in the background after updating, and again whenever the setting changes.Notes
photo_clipand scaled to unit length.similar_clip.TestStackFramesBySimilarity: shots stack by similarity though their hashes are far apart; at 99%, or with the setting off, only hashes count; without an embedding, the hash is the fallback.TestSimilarShotsAreDuplicates: the painting/crane album. Each three stack and form one duplicate set. An identical copy joins its set; a like shot from another scene does not. Changing the setting regroups, and with it off only the exact copy is left.TestSimilarGroupsMatchReference: a randomized catalogue with embeddings matches the in-memory reference, which now merges stacks with exact copies.TestAlbumBurstsAndDuplicates: the tabs carry the album and its filters. The album's Bursts and Duplicates pages list only its groups, with crumbs, an on-tab, a Reset that stays in the album, and filters still applied.TestSimilaritySetting, and the store and CLI settings tests: the setting is saved, and out-of-range values are refused.Related issues/PRs
Generated by Claude Code