Skip to content

integrate openvocab search #229

Description

@cmosig

https://github.com/cmosig/deadtrees-search-modular

What to build

  • New queue task type

    • Add an “embedding” task type to the processor queue (settings tables, enums, API/processor models).
    • When a COG upload completes (after cog + metadata), enqueue an embedding task for that dataset/orthophoto.
  • Processor pipeline step

    • In processor/src/processor.py, add a handler that runs the patch embedder on the COG in processing_path using the local OpenCLIP ViT-H/14 weights (similar to deadwood model placement).
    • Output: list of patch embeddings + bounding boxes in pixel coords, tied to the dataset/orthophoto ID.
  • Supabase schema

    • Add a table/column for patch embeddings (e.g., v2_patch_embeddings with dataset_id, patch_bbox, embedding vector, model_id, created_at).
    • Use pgvector for the embedding column; enforce FK back to the dataset/orthophoto record.
    • Add minimal indexes (ivfflat/lsm) for cosine search on the embedding vector.
  • Backend API (FastAPI)

    • Add an endpoint to run text encoding on CPU via the modular TextEmbedder (load weights locally once).
    • Endpoint takes text + dataset/orthophoto filter, returns top patches via Supabase/pgvector similarity.
    • Reuse existing Supabase client + auth/token verification patterns.
  • Frontend wiring

    • Hook search UI to the new endpoint (send text).
    • Display patch hits (orthophoto ID + bounding box). No webserver in the embedding package itself.
  • Ops/Config

    • Place OpenCLIP weights alongside existing models under /assets/models, and add env/config entries for the path.
    • Ensure processor image/conda env includes deadtrees-search-modular and pgvector client deps.
    • Logging: follow existing UnifiedLogger/SupabaseHandler; update status flags for the embedding task.

Acceptance criteria

  • Upload completes → queue contains embedding task → processor runs embedder on the COG → embeddings + bboxes stored in Supabase with FK to dataset/orthophoto.
  • Text query endpoint returns pgvector-ranked patches for a given dataset/orthophoto filter.
  • CPU-only text encoding; GPU for patch embedding (if available).
  • Tests: unit test for enqueue flow, processor handler call, and pgvector query stub/integration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions