Skip to content

Repository files navigation

English | 简体中文

LocalLens

An offline visual search engine for local image and video collections. Indexes directories into ChromaDB using vision embedding models to enable natural language queries and reverse image search, with added duplicate detection.

LocalLens UI Screenshot

Quick Setup

1. Download

  • Portable Package (Recommended): Download the portable build from Releases.
    • Windows: No requirements.
    • Linux / macOS: Requires Python 3.10+ and Git.
  • From Source:
    git clone https://github.com/meangrinch/LocalLens.git
    cd LocalLens
    python -m venv venv
    .\venv\Scripts\activate # or source venv/bin/activate (Linux/macOS)
    pip install torch==2.12.0+cu130 torchvision==0.27.0+cu130 --extra-index-url https://download.pytorch.org/whl/cu130 # or pip install torch==2.12.0 torchvision==0.27.0 (macOS)
    pip install -r requirements.txt

For additional information, see Installation.

2. Index

  • Web UI: In Database Management, enter a directory path and click Add Folder.
  • CLI:
    python build_db.py --model_path "google/siglip2-so400m-patch16-512" --db_path "img_db/siglip2_so400m" --add "path/to/images"
  • Sync Changes: Click Update/Sync in the Web UI, or pass --update via CLI to rescan indexed folders for additions or deletions.

3. Search

  • Text Search: Enter a description (e.g., "an orange and black butterfly") to retrieve matching media ranked by similarity.
  • Reverse Image Search: Upload an image to find visually similar files, or combine text and image inputs to refine results.
  • Find Duplicates: In the Find Duplicates tab, select an indexed folder and set a similarity threshold to surface duplicate pairs.
  • Access Restriction (Optional): By default, the Gradio gallery can display images from any indexed directory. Set LOCALLENS_ALLOWED_PATHS in your environment to restrict accessible directories.

Features

  • Indexing: Recursive directory indexing and incremental sync (ChromaDB)
  • Search: Natural language text, image, and combined text + image queries
  • Reverse Search: Find visually similar media from an uploaded image
  • Duplicates: Locate duplicate and near-duplicate image pairs by similarity threshold
  • Models: Vision embedding backbones (SigLIP 2, MetaCLIP, DFN-CLIP, CLIP)
  • Formats: Image and video support (jpg, png, webp, mp4, mkv, etc.)
  • Interfaces: Web UI (Gradio) and CLI

Documentation


Support the Project

LocalLens is open-source and free. If it saves you time finding photos or cleaning up duplicate images, consider supporting its development!

Support on Ko-fi


License & Credits

ML Models and Libraries

About

Local image search engine powered by AI

Topics

Resources

Stars

19 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages