Skip to main content

Argus Lens

PyPI Python License: MIT CI dragonhound.dev Docs Live demo

Captions built for how they will be used. Argus Lens runs a tagger and a vision model over an image, then assembles their output into structured caption variants for LoRA training, dataset curation and zero-shot generation, and reports everything it removed and why.

The model is only an input. The work is in the assembly pipeline that runs after it, which every backend's output goes through.

See it run: Lightbox is a live demo with real captions, every variant, and what each step removed.

One photo, in and out

A lake at dusk with a small island, a hill on the horizon and lit buildings on the far shore

What the models said (hybrid:ram+florence2):

Tags: lake, water, mountain, island, sunset, dusk, calm, sky, cloudy, twilight, night view

Prose: The image is a landscape photograph of a lake at sunset. The sky is a beautiful orange and pink color, with the sun setting in the background. The lake is calm and still, reflecting the colors of the sky. [...] The mountains in the distance are silhouetted against the sky, creating a stunning view. The overall mood of the photograph is peaceful and serene.

What Lens made of it, for an SDXL target (60 CLIP tokens):

Variant Caption
training dusk, sunset, sky, mountain, water, island, calm, cloudy
training_prose A landscape photograph of a lake at sunset. The sky is a beautiful orange and pink color, with the sun setting in the background.
lighting sunset, dusk, twilight, night view, water, island
setting lake, mountain, sky, the sky is a beautiful orange and pink color, with the sun setting in the background, water, island, calm

And what it reported removing: the opener ("The image is"), the editorial lines ("creating a stunning view", "The overall mood of the photograph is peaceful and serene"), and each prose clause that only repeated a tag.

This is one of the 240 captions in the eval fixture, from a CC0 photo, with no LLM rewrite. There are nine variants per image: one per category (identity, wardrobe, pose and composition, setting, lighting, action) plus training, training_prose and zeroshot.

Quick start

pip install "argus-lens[openai]"
from argus_lens import ArgusLens

engine = ArgusLens(backend="openai", api_key="sk-...")
result = engine.caption("photo.jpg", trigger_word="sks_person")

print(result.final_caption)
print(result.caption_variants["training"])
print(result.removed_phrases)
pip install "argus-lens[cli,local]"
argus-lens caption ./images/ --backend hybrid --format txt   # one .txt sidecar per image

Local backends need a GPU or a patient CPU; cloud and self-hosted OpenAI-compatible backends (Ollama, vLLM, LM Studio) need neither. Installation lists the extras and Usage has more examples.

What the assembly pipeline does

  1. Classify. Every tag and prose clause goes into a bucket: identity, wardrobe, pose and composition, setting, lighting or action.
  2. Filter. Prose that mostly repeats the tags (over 50% overlap), filler openers ("The image shows...") and training noise (rating tags, meta tokens) are removed.
  3. Specialise. The training variant leaves out identity traits, because a LoRA learns those from the pixels and stating them fights the base model's prior. The zero-shot variant puts identity first, because no LoRA will supply it.
  4. Budget. Fragments are assembled under the target's token limit: 60 for SDXL (CLIP), 200 for Flux and SD3 (T5). Framing tags are never dropped, and short generic tags go first.
  5. Diversify. Across a dataset, omission cycles leave out a different bucket per image, so a concept is not tied to one phrasing.
  6. Enrich. Compound nouns found only in the prose ("gray sweater", "wooden door") are added last, to use what budget remains.

Every removed phrase and every compaction decision is in the result (removed_phrases, compaction_notes), so a caption can be audited. The caption result reference documents each field.

What else it does

Read more
Backends WD14, RAM++, Florence-2 and BLIP-2 locally; OpenAI, Hugging Face, Replicate, NVIDIA NIM and any OpenAI-compatible server; hybrids that pair a tagger with a prose model Backends and prompts
Reconciliation Where prose and tags disagree on a colour, posture, headcount or a quoted name, a verifier decides: the tags, a vision model, OCR, or a measured pose Reconciliation
Refinement An optional LLM rewrite, accepted only if it passes the same checks as the deterministic caption Refinement
Evaluation A reference-free harness: tag and prose contradiction rate, token-budget adherence, redundancy, optional CLIPScore and a VLM faithfulness judge, and a flag that fails a run on regression Evaluation
CLI and server argus-lens caption, eval and serve; a FastAPI server with batch, streaming, folder and manifest endpoints and an OpenAI-compatible /v1 CLI reference, HTTP server
Photo libraries Captions and keywords pushed to Immich, or written as XMP sidecars that Immich, Lightroom and digiKam read Immich
Dataset export Captions as a relational dataset in Postgres or Supabase, with thumbnails, a change feed and pgvector search Dataset export
GPU sharing Lazy loading, idle unload, and a lease so several services take turns on one card GPU sharing
Replay Serve recorded captions with no model and no GPU, for demos Replay
Deployment A CUDA image and a standalone image on GHCR Docker

How it is checked

  • Tests. About 1,500, run twice in CI: without torch, and again with CPU torch so the model-gated tests run.

  • Rules with a named test. Each thing that must never happen (a batch overwriting a caption on a name collision, a fetch reaching an internal address, a failed OCR read silently dropping a claim) is listed in CLAUDE.md beside the test that enforces it.

  • Measured, not asserted. The caption eval scores a change against a baseline. A second eval asks whether an agent can answer questions about exported captions, in three arms over 40 checked tasks:

    Model Schema in the prompt Supabase MCP MCP + docs for agents
    Claude Haiku 5.5 76.7% 100% 100%
    Gemini 3.5 Flash-Lite 68.3% 93.3% 100%
    qwen3:8b (local) 56.7% 38.3% 68.3%

    The write-up covers the method, the noise floor, the arm that made a small model worse, and what building on Supabase was like (friction log). Two fixes found along the way are proposed upstream: supabase/postgres#2741 and supabase/vecs#123.

Security

  • The server binds to 127.0.0.1 by default. Its caption endpoints have no authentication, so expose it only on a network you trust. Cross-site writes are refused whatever the CORS setting.
  • URL fetches are fenced against internal addresses, and folder and manifest paths cannot leave the source root.
  • No Python from a model repository runs unless HF_TRUST_REMOTE_CODE=true is set.

Details are in HTTP server and Backends and prompts.

Part of the Argus suite

argus-quarry -> argus-curator -> argus-lens -> argus-forge -> your trainer -> argus-proof

Lens is the captioning stage. argus-studio is a web UI over it, and the suite's docs are at docs.dragonhound.dev.

License

MIT. The vendored RAM++ port in backends/_ram/ is Apache-2.0, with Microsoft's MIT-licensed Swin (LICENSE-RAM).

Metadata

Release files for argus-lens 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argus-lens 0.16.0
File Size Uploaded Provenance Actions
argus_lens-0.16.0.tar.gz 2.0 MB With provenance Details for argus_lens-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argus-lens 0.16.0
File Interpreter ABI Platform Actions
argus_lens-0.16.0-py3-none-any.whl Python 3 none any Details for argus_lens-0.16.0-py3-none-any.whl

Total release size: 2.3 MB

Release files / argus_lens-0.16.0.tar.gz

Download URL argus_lens-0.16.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d16c96ddff36ceb2b9a91a1c038cf9a5128863b1907db785e535f6f359280f9f
BLAKE2b-256 checksum
How to use checksums
e0b0b9eea6d730ff3649bed9bb12b8e8a529fbd7fb539c9bfcd1367ad6b7d8e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / argus_lens-0.16.0-py3-none-any.whl

Download URL argus_lens-0.16.0-py3-none-any.whl
Size 299.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
611e2e25ce2f1b4521262deba2144916c5bcb1e58030c3efc7e40fd4fb2d5992
BLAKE2b-256 checksum
How to use checksums
7e8a69b16b12470a9597f545843d4901e988da6f54164d54b0a072e0e75c6089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for argus-lens 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for argus_lens-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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