8000 feat(search): find photos by what they show, with anytopdf's CLIP plugin by adeelahmad · Pull Request #230 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(search): find photos by what they show, with anytopdf's CLIP plugin - #230

Merged
adeelahmad merged 3 commits into
mainfrom
claude/project-thread-kgtpxt
Oct 7, 2026
Merged

adeelahmad merged 3 commits into
mainfrom
claude/project-thread-kgtpxt

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: search found photos only by words on them (OCR) or detected objects.

After: with Settings › Search › Search photos by what they show on (embeddings.photos, off by default), a search like "a bus on a city street" also shows the photos most like it, in a strip above the moments, limited to the namespaces and collections the person can see. GET /api/v1/search/photos serves it.

Motivation and Context

Last part of Phase 3 of the anytopdf integration (CLIP image search). Follows #229.

How: anytopdf.PLUGINS now keeps anytopdf-plugin-clip, and a plugins/.asked marker refetches once when Lens keeps more plugins. A clip component fetches the CLIP ViT-B/32 model (about 600 MB, into data_dir/models/clip) for the embed step only when the switch is on. The embed step gives each image resource one CLIP vector (photo_vector, once per file, offline, network blocked), kept apart from search by meaning's passages. It is removed with the recording. Queries use brute-force cosine. The floor is 0.24 with a 0.05 spread: measured with the real model, a plain blue picture scores 0.21 to 0.24 against most queries, while a bus photo scored 0.30 for "a bus on a city street".

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project.
  • I added or updated tests (tests/api/test_photos.py with a fake plugin; a real-model test under LENS_TEST_ANYTOPDF + LENS_TEST_CLIP_DATA, passed locally).
  • I have updated docs/ accordingly.
  • I wrote it under ## Unreleased in CHANGELOG.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_018GMFApXZSk7XERM3J5gNTy


Generated by Claude Code

Settings › Search › Search photos by what they show (embeddings.photos,
off by default). Lens keeps anytopdf's CLIP plugin beside the program and
fetches its model (about 600 MB) as a component for the embed step, which
then gives each image resource a CLIP vector, once per file, offline. GET
/api/v1/search/photos compares a query with the photos the person may see,
and the search page shows the best matches above the moments.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018GMFApXZSk7XERM3J5gNTy
@adeelahmad adeelahmad self-assigned this Oct 7, 2026
claude added 2 commits October 7, 2026 12:24
The node answered without reading the request, so on some runners the
connection was reset before Lens saw the answer was too long.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018GMFApXZSk7XERM3J5gNTy
@adeelahmad
adeelahmad merged commit 66d9879 into main Oct 7, 2026
7 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-kgtpxt branch October 7, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0