Skip to content

Add hybrid CLIP+PDQ scoring to image-similarity plugin#111

Open
miriyalamani wants to merge 44 commits into
mainfrom
image-similarity-optimisation
Open

Add hybrid CLIP+PDQ scoring to image-similarity plugin#111
miriyalamani wants to merge 44 commits into
mainfrom
image-similarity-optimisation

Conversation

@miriyalamani

@miriyalamani miriyalamani commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator
  • Add PDQ perceptual hashing to catch re-uploads and recompressed copies where CLIP embeddings drift below threshold — PDQ is CPU-only and near-zero latency cost per image
  • Support three scoring modes: Combined (CLIP + PDQ), Semantic-only, Perceptual-only — each covers the other's weakness
  • Pluggable scorer interface (ClipScorer, PdqScorer, CombinedScorer) in new scorers.py
  • Extend ImageSimilarityEmbedding with pdq_hash column
  • Tests and docs updated to match
  • Fix LD_LIBRARY_PATH unbound variable in run_backend_server on macOS

Jai Kumar and others added 30 commits March 14, 2026 19:27
see README_UI.md for frontend details
update image_summary for batching
ui fixes
cuda,cudnn,pgvector,onnxruntime , update to version 3.0.0
Updated README to include references for backend and UI server scripts.
New `image_similarity` plugin finds visually similar images given a
query image, using CLIP embeddings and pgvector cosine similarity.
…e format

- Add "Similar Images" entry to chatbot tool menu (config.py)
- Add ImageSimilaritySearch schema and endpoint to tool_config.py
- Update poetry.lock with image-similarity package entry
Replace torch + transformers CLIPModel inference with onnxruntime,

The bundled ONNX vision model (clip-vit-base-patch32.onnx) is loaded
directly from onnx_models/ — no runtime export or torch dependency
needed for inference. Default model changed from Apple DFN CLIP to
openai/clip-vit-base-patch32.
- Add batched ONNX inference (_embed_images_batch) with dynamic batch
  detection to process multiple images per kernel launch instead of one
- Restructure _embed_and_store_images into three phases: discover new
  hashes, batch-embed all new images in one GPU pass, then persist
- Extract _cosine_similarity_search into its own function for clarity
- Add torchvision dependency to image-similarity and root pyproject
@miriyalamani miriyalamani changed the title Image similarity optimisation Add hybrid CLIP+PDQ scoring to image-similarity plugin Jul 2, 2026
@miriyalamani miriyalamani requested a review from nb950 July 2, 2026 18:46
@miriyalamani miriyalamani marked this pull request as ready for review July 2, 2026 18:46
Comment thread src/image-similarity/pyproject.toml Outdated
Comment thread src/image-similarity/image_similarity/main.py Outdated
…nd lint format

- Remove plugin-level threading locks (framework handles serialization)
- Remove unused torchvision dependency
- Widen Python requirement to >=3.11,<3.15 to match root project
- Run black on all modified files
- Regenerate poetry.lock to include pdqhash
- Fix LD_LIBRARY_PATH unbound variable in run_backend_server
@miriyalamani miriyalamani requested a review from nb950 July 2, 2026 20:46
@nb950

nb950 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

please run tests using images in this src-tauri\demo\search-images\inputs folder.
sent details via slack.

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