Skip to main content

SightRAG Banner

SightRAG

See. Search. Retrieve.

PyPI License Python Open In Colab

A pluggable visual RAG system. Any detection model. Any embedding model. Any vector store. Three lines of code.


Quick Start

from sightrag import SightRAG

rag = SightRAG()
rag.index("./photos/")
results = rag.query("find empty shelf")
rag.show(results)

Install

pip install sightrag

For faster inference:

pip install sightrag[onnx]               # 2x faster (any CPU)

For v0.3 features:

pip install sightrag[grounding-dino]     # any domain detection
pip install sightrag[reid]               # person tracking
pip install sightrag[cli]                # terminal commands
pip install sightrag[qdrant]             # large scale store
pip install sightrag[all]                # everything

What's New in v0.3

  • Grounding DINO : detect ANY object by text description. No training, no COCO limitation. "find cracked solder joint" just works.
  • Person Re-ID : track same person across multiple cameras using body re-identification models.
  • CLI tool : sightrag index, sightrag query, sightrag serve from terminal. No Python needed.
  • Qdrant store : production-grade vector database for 1M+ images.
  • Re-ranking : cross-encoder re-ranks top results for better accuracy on large datasets.
  • Backward compatible : v0.1 and v0.2 code works unchanged.

What SightRAG Is

SightRAG is not a model. Not a wrapper. Not a framework plugin.

It is a complete visual retrieval system. You provide any detection model, any embedding model, any vector store. SightRAG handles the pipeline: load, detect, embed, index, retrieve.

All models and indexes are stored in ~/.sightrag/ : your project folder stays clean.

Project Structure

sightrag/
├── sightrag/
│   ├── core.py                  ← SightRAG main class
│   ├── backends/                ← auto-select fastest inference
│   │   ├── pytorch_backend.py   ← default (works everywhere)
│   │   ├── onnx_backend.py      ← 2x faster (any CPU)
│   │   ├── tensorrt_backend.py  ← fastest (NVIDIA GPU)
│   │   └── openvino_backend.py  ← Intel CPU optimized
│   ├── detectors/base.py        ← plug custom detection model
│   ├── embedders/base.py        ← plug custom embedding model
│   ├── store/                   ← SQLite (default) + ChromaDB
│   ├── visualizer.py            ← rag.show() with bounding boxes
│   ├── indexer.py               ← C++ core with Python fallback
│   ├── retriever.py             ← text + reference queries
│   └── api.py                   ← REST API (FastAPI)
│
├── cpp/                         ← C++ speed core (optional)
├── demo_sightrag/               ← demo scripts + test data
│   ├── sightrag_images.py       ← image folder demo
│   ├── sightrag_video.py        ← video indexing demo
│   ├── sightrag_livecam.py      ← webcam demo
│   ├── sightrag_restapi.py      ← REST API demo
│   ├── input_images/            ← sample images
│   └── reference_images/        ← reference query images
├── notebooks/                   ← Colab notebook
├── tests/                       ← unit tests
└── docs/                        ← documentation

How To Test

# Quick test
python test_sightrag.py

# Demo scripts
python demo_sightrag/sightrag_images.py
python demo_sightrag/sightrag_video.py
python demo_sightrag/sightrag_livecam.py

# Colab
Upload notebooks/SightRAG_v0.2_Demo.ipynb  Run All

# Unit tests
python -m pytest tests/ -v

Usage

Image Folder

rag = SightRAG()
rag.index("./shelf_photos/")
results = rag.query("find empty shelf")
rag.show(results)

Video File

rag = SightRAG()
rag.index("./cctv_footage.mp4")
results = rag.query("person near exit door")
rag.show(results, save="./evidence/")

Mixed Folder (images + videos)

rag = SightRAG()
rag.index("./my_data/")

Live Camera

rag = SightRAG()
rag.index(source="camera")
results = rag.query("find person")

Reference Image Query

results = rag.query(reference="./sample_shelf.jpg")
rag.show(results)

Custom Domain

rag = SightRAG(domain_hint="pcb defect solder joint")
rag.index("./circuit_boards/")
results = rag.query("find defective solder joint")

Visualize Results

results = rag.query("find person")

# Display on screen
rag.show(results)

# Save annotated images with bounding boxes
rag.show(results, save="./output/")

Grounding DINO : Any Domain (NEW in v0.3)

Detect ANY object by text description. No training needed.

rag = SightRAG(detector="grounding-dino")
rag.index("./circuit_boards/")
results = rag.query("find cracked solder joint")
rag.show(results)

Works on any domain: medical, industrial, satellite, retail : just type what to find.

Person Re-ID : Cross-Camera Tracking (NEW in v0.3)

Track same person across multiple cameras.

rag = SightRAG(embedder="reid")
rag.index("./camera_01/")
rag.index("./camera_02/")
results = rag.query(reference="./suspect.jpg")
rag.show(results)

Returns every camera and timestamp where that person appeared.

CLI Tool (NEW in v0.3)

pip install sightrag[cli]

sightrag index ./photos/
sightrag index ./video.mp4 --fps 2
sightrag query "find person near exit"
sightrag query --reference ./suspect.jpg --top-k 10
sightrag show --query "find person" --save ./output/
sightrag status
sightrag clear
sightrag serve --port 8000

Re-ranking : Better Accuracy (NEW in v0.3)

Improves result quality on large similar datasets.

rag = SightRAG(rerank=True)
rag.index("./100k_shelf_images/")
results = rag.query("find empty shelf", top_k=5)
# Fetches top 100, re-ranks to best 5

Pluggable Models

Custom Detector

from sightrag import SightRAG
from sightrag.detectors.base import DetectorBase

class MyDetector(DetectorBase):
    def __init__(self):
        self.model = load_my_model()

    def detect(self, image, confidence=0.25):
        preds = self.model.predict(image)
        return [
            {"bbox": [p.x1, p.y1, p.x2, p.y2],
             "label": p.label,
             "confidence": p.score,
             "crop": image.crop((p.x1, p.y1, p.x2, p.y2))}
            for p in preds if p.score >= confidence
        ]

rag = SightRAG(detector=MyDetector())

Custom Embedder

from sightrag.embedders.base import EmbedderBase
import numpy as np

class MyEmbedder(EmbedderBase):
    embed_dim = 768

    def embed_image(self, image):
        vec = self.model.encode_image(image)
        return vec / np.linalg.norm(vec)

    def embed_text(self, text, domain_hint=None):
        vec = self.model.encode_text(text)
        return vec / np.linalg.norm(vec)

rag = SightRAG(embedder=MyEmbedder())

Custom Store

from sightrag.store.base import VectorStoreBase

class MyStore(VectorStoreBase):
    def add(self, id, embedding, metadata): ...
    def search(self, query_vector, top_k): ...
    def count(self): ...
    def clear(self): ...

rag = SightRAG(store=MyStore())

Speed : Auto Backend Selection

SightRAG automatically picks the fastest available backend:

Backend Speed Hardware Install
PyTorch (default) baseline any pip install sightrag
ONNX ~2x faster any CPU pip install sightrag[onnx]
OpenVINO ~1.5x faster Intel CPU pip install sightrag[openvino]
TensorRT ~3-5x faster NVIDIA GPU pip install sightrag[tensorrt]

No configuration needed. SightRAG auto-detects what's installed and picks the fastest.

REST API

pip install sightrag[api]
sightrag-server
Method Endpoint Description
GET / API info
GET /status Index stats
POST /index/folder Index images/videos
POST /query/text Search with text
POST /query/reference Search with image
DELETE /index Clear index

Result Format

{
    "image_path":  "./photos/shelf_042.jpg",
    "score":       0.9134,
    "label":       "bottle",
    "confidence":  0.8721,
    "bbox":        [120, 45, 380, 290],
    "timestamp":   "",
    "source_type": "image"
}

Storage

Store Scale Install
SQLite (default) up to 100k images built-in
ChromaDB medium scale pip install sightrag[chroma]
Qdrant (NEW) 1M+ images pip install sightrag[qdrant]
Custom any implement VectorStoreBase
rag = SightRAG(store="sqlite")    # default, up to 100k
rag = SightRAG(store="chroma")    # medium scale
rag = SightRAG(store="qdrant")    # production, 1M+

Architecture

Input (images / video / camera)
        ↓
   C++ Core (fast load, resize, extract) : Python fallback
        ↓
   Detection:
   ├── YOLO (default : 80 COCO classes, fast)
   ├── Grounding DINO (any domain, no training) : NEW
   └── Custom detector (user's own model)
        ↓
   Embedding:
   ├── CLIP (default : general vision-language)
   ├── Person Re-ID / OSNet (cross-camera tracking) : NEW
   └── Custom embedder (user's own model)
        ↓
   Auto Backend (TensorRT > ONNX > OpenVINO > PyTorch)
        ↓
   Vector Store:
   ├── SQLite (default : up to 100k)
   ├── ChromaDB (medium scale)
   ├── Qdrant (1M+ production) : NEW
   └── Custom store (user's own)
        ↓
   Retrieval + Re-ranking (cosine → cross-encoder) : NEW
        ↓
   Visualization (rag.show : bounding boxes)
        ↓
Output (matched images, scores, bboxes, timestamps)

Docker

docker-compose up

API at http://localhost:8000/docs

Three Library Ecosystem

Library Purpose Status
SightRAG Visual RAG : See. Search. Retrieve. v0.3
adaptive-intelligence RL-based RAG orchestration v4.0
llmevalkit LLM evaluation (78+ metrics) Stable

Roadmap

Version Focus
v0.1 Core pipeline : image, video, camera, REST API
v0.2 Speed : C++ core, auto backends, pluggable models, rag.show()
v0.3 (current) Intelligence : Grounding DINO, Person Re-ID, CLI, Qdrant, re-ranking
v1.0 Production : edge deployment, compliance, enterprise

License

Apache 2.0

Author

Built by Venkatkumar Rajan

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sightrag-0.3.0.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sightrag-0.3.0-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file sightrag-0.3.0.tar.gz.

File metadata

  • Download URL: sightrag-0.3.0.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for sightrag-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e0e9ac83072a119f3f7bc93aeb82d42c3c71377b579d1ab28d1a9649bead37f8
MD5 c15a270c30cb30d8a7a51ae0d7e7e348
BLAKE2b-256 8800706468d9497679c86df7d2b596e327a5d79b5fcba02dbd51f04848cb6481

See more details on using hashes here.

File details

Details for the file sightrag-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: sightrag-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for sightrag-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed215c90b216097661672ae1d5b5dccbdf86cfd35cfd3c6b89ed08e1f7b13ddc
MD5 a6b0db1cf8646a36e2c1171d2905cc88
BLAKE2b-256 b1981e4fc0eb0b5ac7f798feeb945b6168e465153e95e8f06c2c0af299fa803e

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page