visru 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- visru-0.0.1/.gitignore +232 -0
- visru-0.0.1/LICENSE +21 -0
- visru-0.0.1/PKG-INFO +289 -0
- visru-0.0.1/README.md +255 -0
- visru-0.0.1/pyproject.toml +63 -0
- visru-0.0.1/visru/__init__.py +1 -0
- visru-0.0.1/visru/agent/__init__.py +1 -0
- visru-0.0.1/visru/agent/context.py +276 -0
- visru-0.0.1/visru/agent/loop.py +184 -0
- visru-0.0.1/visru/agent/prompts/system.md +89 -0
- visru-0.0.1/visru/agent/subagents.py +116 -0
- visru-0.0.1/visru/agent/trajectory.py +183 -0
- visru-0.0.1/visru/backends/__init__.py +40 -0
- visru-0.0.1/visru/backends/anthropic.py +136 -0
- visru-0.0.1/visru/backends/base.py +29 -0
- visru-0.0.1/visru/backends/openai_compat.py +274 -0
- visru-0.0.1/visru/backends/replay.py +74 -0
- visru-0.0.1/visru/cli.py +148 -0
- visru-0.0.1/visru/config.py +90 -0
- visru-0.0.1/visru/evidence/__init__.py +3 -0
- visru-0.0.1/visru/evidence/ledger.py +364 -0
- visru-0.0.1/visru/evidence/report.py +111 -0
- visru-0.0.1/visru/geometry.py +52 -0
- visru-0.0.1/visru/models.py +145 -0
- visru-0.0.1/visru/servers/__init__.py +0 -0
- visru-0.0.1/visru/servers/vision_mcp.py +140 -0
- visru-0.0.1/visru/tools/__init__.py +122 -0
- visru-0.0.1/visru/tools/annotate.py +138 -0
- visru-0.0.1/visru/tools/navigate.py +182 -0
- visru-0.0.1/visru/tools/registry.py +367 -0
- visru-0.0.1/visru/tools/search.py +474 -0
- visru-0.0.1/visru/tools/verify.py +460 -0
- visru-0.0.1/visru/workspace/__init__.py +3 -0
- visru-0.0.1/visru/workspace/artifacts.py +142 -0
- visru-0.0.1/visru/workspace/index.py +191 -0
- visru-0.0.1/visru/workspace/registry.py +218 -0
- visru-0.0.1/visru/workspace/video.py +99 -0
visru-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
personals/
|
|
2
|
+
.visru/
|
|
3
|
+
visru.toml
|
|
4
|
+
.claude/
|
|
5
|
+
CLAUDE.md
|
|
6
|
+
|
|
7
|
+
# Byte-compiled / optimized / DLL files
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[codz]
|
|
10
|
+
*$py.class
|
|
11
|
+
|
|
12
|
+
# C extensions
|
|
13
|
+
*.so
|
|
14
|
+
|
|
15
|
+
# Distribution / packaging
|
|
16
|
+
.Python
|
|
17
|
+
build/
|
|
18
|
+
develop-eggs/
|
|
19
|
+
dist/
|
|
20
|
+
downloads/
|
|
21
|
+
eggs/
|
|
22
|
+
.eggs/
|
|
23
|
+
lib/
|
|
24
|
+
lib64/
|
|
25
|
+
parts/
|
|
26
|
+
sdist/
|
|
27
|
+
var/
|
|
28
|
+
wheels/
|
|
29
|
+
share/python-wheels/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
.installed.cfg
|
|
32
|
+
*.egg
|
|
33
|
+
MANIFEST
|
|
34
|
+
|
|
35
|
+
# PyInstaller
|
|
36
|
+
# Usually these files are written by a python script from a template
|
|
37
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
38
|
+
*.manifest
|
|
39
|
+
*.spec
|
|
40
|
+
|
|
41
|
+
# Installer logs
|
|
42
|
+
pip-log.txt
|
|
43
|
+
pip-delete-this-directory.txt
|
|
44
|
+
|
|
45
|
+
# Unit test / coverage reports
|
|
46
|
+
htmlcov/
|
|
47
|
+
.tox/
|
|
48
|
+
.nox/
|
|
49
|
+
.coverage
|
|
50
|
+
.coverage.*
|
|
51
|
+
.cache
|
|
52
|
+
nosetests.xml
|
|
53
|
+
coverage.xml
|
|
54
|
+
*.cover
|
|
55
|
+
*.py.cover
|
|
56
|
+
*.lcov
|
|
57
|
+
.hypothesis/
|
|
58
|
+
.pytest_cache/
|
|
59
|
+
cover/
|
|
60
|
+
|
|
61
|
+
# Translations
|
|
62
|
+
*.mo
|
|
63
|
+
*.pot
|
|
64
|
+
|
|
65
|
+
# Django stuff:
|
|
66
|
+
*.log
|
|
67
|
+
local_settings.py
|
|
68
|
+
db.sqlite3
|
|
69
|
+
db.sqlite3-journal
|
|
70
|
+
|
|
71
|
+
# Flask stuff:
|
|
72
|
+
instance/
|
|
73
|
+
.webassets-cache
|
|
74
|
+
|
|
75
|
+
# Scrapy stuff:
|
|
76
|
+
.scrapy
|
|
77
|
+
|
|
78
|
+
# Sphinx documentation
|
|
79
|
+
docs/_build/
|
|
80
|
+
|
|
81
|
+
# PyBuilder
|
|
82
|
+
.pybuilder/
|
|
83
|
+
target/
|
|
84
|
+
|
|
85
|
+
# Jupyter Notebook
|
|
86
|
+
.ipynb_checkpoints
|
|
87
|
+
|
|
88
|
+
# IPython
|
|
89
|
+
profile_default/
|
|
90
|
+
ipython_config.py
|
|
91
|
+
|
|
92
|
+
# pyenv
|
|
93
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
94
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
95
|
+
# .python-version
|
|
96
|
+
|
|
97
|
+
# pipenv
|
|
98
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
99
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
100
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
101
|
+
# install all needed dependencies.
|
|
102
|
+
# Pipfile.lock
|
|
103
|
+
|
|
104
|
+
# UV
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# uv.lock
|
|
109
|
+
|
|
110
|
+
# poetry
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
112
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
113
|
+
# commonly ignored for libraries.
|
|
114
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
115
|
+
# poetry.lock
|
|
116
|
+
# poetry.toml
|
|
117
|
+
|
|
118
|
+
# pdm
|
|
119
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
120
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
121
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
122
|
+
# pdm.lock
|
|
123
|
+
# pdm.toml
|
|
124
|
+
.pdm-python
|
|
125
|
+
.pdm-build/
|
|
126
|
+
|
|
127
|
+
# pixi
|
|
128
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
129
|
+
# pixi.lock
|
|
130
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
131
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
132
|
+
.pixi/*
|
|
133
|
+
!.pixi/config.toml
|
|
134
|
+
|
|
135
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
136
|
+
__pypackages__/
|
|
137
|
+
|
|
138
|
+
# Celery stuff
|
|
139
|
+
celerybeat-schedule*
|
|
140
|
+
celerybeat.pid
|
|
141
|
+
|
|
142
|
+
# Redis
|
|
143
|
+
*.rdb
|
|
144
|
+
*.aof
|
|
145
|
+
*.pid
|
|
146
|
+
|
|
147
|
+
# RabbitMQ
|
|
148
|
+
mnesia/
|
|
149
|
+
rabbitmq/
|
|
150
|
+
rabbitmq-data/
|
|
151
|
+
|
|
152
|
+
# ActiveMQ
|
|
153
|
+
activemq-data/
|
|
154
|
+
|
|
155
|
+
# SageMath parsed files
|
|
156
|
+
*.sage.py
|
|
157
|
+
|
|
158
|
+
# Environments
|
|
159
|
+
.env
|
|
160
|
+
.envrc
|
|
161
|
+
.venv
|
|
162
|
+
env/
|
|
163
|
+
venv/
|
|
164
|
+
ENV/
|
|
165
|
+
env.bak/
|
|
166
|
+
venv.bak/
|
|
167
|
+
|
|
168
|
+
# Spyder project settings
|
|
169
|
+
.spyderproject
|
|
170
|
+
.spyproject
|
|
171
|
+
|
|
172
|
+
# Rope project settings
|
|
173
|
+
.ropeproject
|
|
174
|
+
|
|
175
|
+
# mkdocs documentation
|
|
176
|
+
/site
|
|
177
|
+
|
|
178
|
+
# mypy
|
|
179
|
+
.mypy_cache/
|
|
180
|
+
.dmypy.json
|
|
181
|
+
dmypy.json
|
|
182
|
+
|
|
183
|
+
# Pyre type checker
|
|
184
|
+
.pyre/
|
|
185
|
+
|
|
186
|
+
# pytype static type analyzer
|
|
187
|
+
.pytype/
|
|
188
|
+
|
|
189
|
+
# Cython debug symbols
|
|
190
|
+
cython_debug/
|
|
191
|
+
|
|
192
|
+
# PyCharm
|
|
193
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
194
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
195
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
196
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
197
|
+
# .idea/
|
|
198
|
+
|
|
199
|
+
# Abstra
|
|
200
|
+
# Abstra is an AI-powered process automation framework.
|
|
201
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
202
|
+
# Learn more at https://abstra.io/docs
|
|
203
|
+
.abstra/
|
|
204
|
+
|
|
205
|
+
# Visual Studio Code
|
|
206
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
|
207
|
+
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
208
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
|
209
|
+
# could uncomment the following to ignore the entire vscode folder
|
|
210
|
+
# .vscode/
|
|
211
|
+
# Temporary file for partial code execution
|
|
212
|
+
tempCodeRunnerFile.py
|
|
213
|
+
|
|
214
|
+
# Ruff stuff:
|
|
215
|
+
.ruff_cache/
|
|
216
|
+
|
|
217
|
+
# PyPI configuration file
|
|
218
|
+
.pypirc
|
|
219
|
+
|
|
220
|
+
# Marimo
|
|
221
|
+
marimo/_static/
|
|
222
|
+
marimo/_lsp/
|
|
223
|
+
__marimo__/
|
|
224
|
+
|
|
225
|
+
# Streamlit
|
|
226
|
+
.streamlit/secrets.toml
|
|
227
|
+
# eval run outputs (regenerate with python -m evals.baseline)
|
|
228
|
+
evals/runs/
|
|
229
|
+
# working question set (cp evals/questions.example.jsonl evals/questions.jsonl)
|
|
230
|
+
evals/questions.jsonl
|
|
231
|
+
# imported benchmarks (python -m evals.import_bench <name>)
|
|
232
|
+
bench/
|
visru-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael Chang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
visru-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: visru
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Agentic harness giving a vision-language model tools to search, zoom, measure, annotate, and verify over images and video
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: anthropic>=0.40
|
|
9
|
+
Requires-Dist: av>=12.0
|
|
10
|
+
Requires-Dist: jinja2>=3.1
|
|
11
|
+
Requires-Dist: mcp>=2.2
|
|
12
|
+
Requires-Dist: numpy>=1.26
|
|
13
|
+
Requires-Dist: openai>=1.40
|
|
14
|
+
Requires-Dist: pillow>=10.3
|
|
15
|
+
Requires-Dist: typer>=0.12
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
18
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
19
|
+
Provides-Extra: kernel
|
|
20
|
+
Requires-Dist: ipykernel>=6.29; extra == 'kernel'
|
|
21
|
+
Requires-Dist: jupyter-client>=8.6; extra == 'kernel'
|
|
22
|
+
Provides-Extra: ocr
|
|
23
|
+
Requires-Dist: paddleocr>=2.8; extra == 'ocr'
|
|
24
|
+
Requires-Dist: paddlepaddle>=2.6; extra == 'ocr'
|
|
25
|
+
Provides-Extra: tools
|
|
26
|
+
Requires-Dist: accelerate>=0.34; extra == 'tools'
|
|
27
|
+
Requires-Dist: faiss-cpu>=1.8; extra == 'tools'
|
|
28
|
+
Requires-Dist: opencv-python-headless>=4.10; extra == 'tools'
|
|
29
|
+
Requires-Dist: timm>=1.0; extra == 'tools'
|
|
30
|
+
Requires-Dist: torch>=2.4; extra == 'tools'
|
|
31
|
+
Requires-Dist: torchvision>=0.19; extra == 'tools'
|
|
32
|
+
Requires-Dist: transformers>=4.56; extra == 'tools'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/engichang1467/VisRU/main/img/visru-logo-acronym.png" alt="VisRU" width="360">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
# Visual Reasoning and Understanding
|
|
40
|
+
|
|
41
|
+
**VisRU** (Visual Reasoning and Understanding) is an agentic harness that gives a vision-language model a workspace of images, video, and multi-view captures, plus tools to search, zoom, measure, annotate, and check its own conclusions. Every claim in its final answer links to the crop, mask, frame, or overlay that supports it.
|
|
42
|
+
|
|
43
|
+
The design borrows from coding agents. A codebase is too large to read in one pass, so a coding agent searches, opens the files it needs, edits, and runs tests. visru runs the same loop over pixels.
|
|
44
|
+
|
|
45
|
+
> Status: pre-alpha.
|
|
46
|
+
|
|
47
|
+
## A session
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
$ visru run ./rollouts/pick_place --task "Why did trial 14 fail?"
|
|
51
|
+
|
|
52
|
+
[1] list_assets(prefix="trial_14") -> 1 video, 1,812 frames, 30 fps
|
|
53
|
+
[2] sample_frames(trial_14.mp4, n=24) -> contact sheet a_0003
|
|
54
|
+
[3] sample_frames(trial_14.mp4, t=37.5..40.5, n=12) -> contact sheet a_0004
|
|
55
|
+
[4] view(frame_1164, box=[812,402,1240,690]) -> a_0005, scale 1.00
|
|
56
|
+
[5] segment(a_0005, points=[[1020,560]]) -> mask a_0006 (mark 1: mug handle)
|
|
57
|
+
[6] overlay(a_0006 + gripper track) -> a_0007
|
|
58
|
+
[7] cross_check(c_1, via=["segment", "detect"]) -> agree, IoU 0.84
|
|
59
|
+
[8] coverage(trial_14.mp4) -> 14% of frames inspected at native scale
|
|
60
|
+
[9] submit_report(...)
|
|
61
|
+
|
|
62
|
+
c_1 [verified] Gripper closed before reaching the handle at 38.8 s.
|
|
63
|
+
evidence: a_0005, a_0007 checks: cross_tool
|
|
64
|
+
c_2 [supported] Left finger occluded the handle from 38.4 s.
|
|
65
|
+
evidence: a_0004
|
|
66
|
+
Not inspected at native scale: frames 0 to 1100.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Architecture
|
|
70
|
+
|
|
71
|
+
```mermaid
|
|
72
|
+
flowchart TB
|
|
73
|
+
U[CLI session<br/>task + VISRU.md] --> L
|
|
74
|
+
subgraph H[Agent harness]
|
|
75
|
+
L[Agent loop] <--> C[Context manager<br/>pixel budget, coverage]
|
|
76
|
+
L <--> S[Subagents]
|
|
77
|
+
end
|
|
78
|
+
L <-->|tool calls| T
|
|
79
|
+
subgraph T[Vision tools, MCP server]
|
|
80
|
+
N[Navigate]
|
|
81
|
+
Q[Search]
|
|
82
|
+
M[Measure]
|
|
83
|
+
A[Annotate]
|
|
84
|
+
V[Verify]
|
|
85
|
+
end
|
|
86
|
+
T <--> W[(Workspace<br/>assets + index)]
|
|
87
|
+
T --> R[(Artifact store)]
|
|
88
|
+
T --> E[(Evidence ledger)]
|
|
89
|
+
E --> P[HTML evidence report]
|
|
90
|
+
L --> J[(Trajectory log)]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**CLI and project context.** A session starts in the terminal. Each workspace can carry a `VISRU.md` with domain context: camera intrinsics, class definitions, what counts as a defect, known failure modes, unit conventions. The harness loads it into the system prompt, the way Claude Code loads `CLAUDE.md`.
|
|
94
|
+
|
|
95
|
+
**Agent loop.** A tool-use loop. The model plans, calls tools, receives text, images, and artifact IDs, and repeats until it calls `submit_report`. Ending through a tool call forces the final answer into the ledger schema.
|
|
96
|
+
|
|
97
|
+
**Context manager.** Images dominate context cost, so the context manager keeps a fixed number of live images and replaces older ones with short text notes that carry artifact IDs. It also maintains a coverage map per asset: which regions or frames the model has viewed, and at what scale.
|
|
98
|
+
|
|
99
|
+
**Workspace.** An asset registry with content-hash IDs and metadata (resolution, fps, intrinsics when known), plus an embedding index built at ingest: one SigLIP embedding per image and per video keyframe, stored in FAISS.
|
|
100
|
+
|
|
101
|
+
**Artifact store.** Every derived image (view, mask, overlay, contact sheet, plot) is saved with its parent asset, the tool and parameters that produced it, and its coordinate transform. Any image the model saw can be regenerated from the log.
|
|
102
|
+
|
|
103
|
+
**Tool layer.** Tools run in an MCP server, so any MCP client can use them. Heavy models (detector, segmenter, depth, pointmaps) run in a GPU worker process that loads weights once and batches requests.
|
|
104
|
+
|
|
105
|
+
**Evidence ledger.** Claims with evidence IDs, the checks run against them, and a status. It renders to a static HTML report where each claim links to its artifacts.
|
|
106
|
+
|
|
107
|
+
**Trajectory log.** JSONL of every model turn, tool call, tool result, and artifact ID, usable as training data.
|
|
108
|
+
|
|
109
|
+
## Design decisions
|
|
110
|
+
|
|
111
|
+
**Tools ship as an MCP server.** Claude Code or any other MCP client can drive them directly; visru's own loop uses the same server.
|
|
112
|
+
|
|
113
|
+
**One coordinate frame: source-asset pixels.** The API returns coordinates relative to its own resized image, and every crop adds an offset and a scale. So all tool inputs and outputs use source-asset pixels, `view` resizes images itself to a size the API will not resize again, and detections are drawn as numbered marks (Set-of-Mark style) so the model can say "mark 3" instead of emitting coordinates.
|
|
114
|
+
|
|
115
|
+
**Images in context expire; artifacts persist.** After an image ages out it becomes a note such as `[a_0042 elided: close view of MRZ, OCR read "P<CAN..."]`. The model can call `view("a_0042")` to see it again.
|
|
116
|
+
|
|
117
|
+
**The ledger enforces verification.** Claims carry one of four statuses:
|
|
118
|
+
|
|
119
|
+
| Status | Requirement |
|
|
120
|
+
|---|---|
|
|
121
|
+
| `verified` | At least one evidence artifact and at least one passing independent check |
|
|
122
|
+
| `supported` | At least one evidence artifact |
|
|
123
|
+
| `contested` | Checks disagree |
|
|
124
|
+
| `hypothesis` | No evidence; reported in a separate section |
|
|
125
|
+
|
|
126
|
+
Two methods count as independent only if they do not share a model. A VLM count checked against a detector count qualifies. SAM masks prompted from detector boxes do not, because they inherit the detector's errors. `verified` comes only from the harness's `cross_check` tool, never from a check the model writes out itself.
|
|
127
|
+
|
|
128
|
+
**Model-agnostic backends.** The Anthropic API for Claude, and an OpenAI-compatible endpoint (vLLM) for open VLMs.
|
|
129
|
+
|
|
130
|
+
## Tools
|
|
131
|
+
|
|
132
|
+
| Group | Tool | Purpose | Default backing |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| Navigate | `list_assets` | Filter assets by name, type, metadata | Registry |
|
|
135
|
+
| | `view` | Render a region at the model's max resolution, optional source-pixel grid | Pillow |
|
|
136
|
+
| | `sample_frames` | Contact sheet of N frames over a time range | PyAV |
|
|
137
|
+
| Search | `search` | Text query over the embedding index; video hits merge into time windows | SigLIP |
|
|
138
|
+
| | `detect` | Open-vocabulary boxes, rendered as marks | OWLv2 or Grounding DINO |
|
|
139
|
+
| | `segment` | Masks from points, boxes, or marks | SAM 2 |
|
|
140
|
+
| | `track` | Propagate masks through a video from one frame; when an object is present | SAM 2 (video) |
|
|
141
|
+
| | `ocr` | Text with boxes | PaddleOCR |
|
|
142
|
+
| Measure | `python` | Sandboxed kernel with numpy, OpenCV, workspace mounted read-only | Jupyter kernel |
|
|
143
|
+
| | `depth` | Monocular depth | Depth Anything V2 |
|
|
144
|
+
| | `pointmap` | Multi-view pointmaps, poses, reprojection error | VGGT or DUSt3R |
|
|
145
|
+
| Annotate | `annotate` | Draw boxes, masks, labels, arrows | Pillow |
|
|
146
|
+
| | `note` | Append a finding to session notes | Harness |
|
|
147
|
+
| Verify | `overlay` | Render claimed geometry on the source and return it for re-inspection | Pillow |
|
|
148
|
+
| | `cross_check` | Answer the same question with independent methods and compare | Harness |
|
|
149
|
+
| | `coverage` | Viewed regions and frames, by scale | Context manager |
|
|
150
|
+
| Delegate | `delegate` | One subagent per time window of a video (visru loop only, not MCP) | Harness |
|
|
151
|
+
| Finish | `submit_report` | Submit claims with evidence IDs; rejects malformed claims | Ledger |
|
|
152
|
+
|
|
153
|
+
In fp16, OWLv2, SAM 2, SigLIP, and Depth Anything V2 fit on one 24 GB GPU. VGGT memory grows with the number of views.
|
|
154
|
+
|
|
155
|
+
## Quick start
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
git clone git@github.com:engichang1467/VisRU.git && cd visru
|
|
159
|
+
uv venv && source .venv/bin/activate
|
|
160
|
+
uv pip install -e ".[tools]"
|
|
161
|
+
|
|
162
|
+
# Build the registry and embedding index for a folder
|
|
163
|
+
visru index "$(pwd)/sample_data" --embed
|
|
164
|
+
|
|
165
|
+
visru run sample_data --task "In trial_01.mp4, when is the street-name sign legible?" --max-steps 30
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### With Claude Code
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
claude mcp add -s user visru -- "$(pwd)/.venv/bin/python" -m visru.servers.vision_mcp \
|
|
172
|
+
--workspace "$(pwd)/sample_data"
|
|
173
|
+
|
|
174
|
+
# Claude Code reads CLAUDE.md, so use the visru context file under that name
|
|
175
|
+
cp VISRU.md.example sample_data/CLAUDE.md
|
|
176
|
+
cd sample_data/ && claude
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Then ask something like:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
In the scene_b stills, read every storefront sign on the right side of the street,
|
|
183
|
+
citing the artifact ID of the view you read it from. In trial_01.mp4, find the frame
|
|
184
|
+
window where the street-name sign becomes legible. Tell me which assets you did not
|
|
185
|
+
inspect at native scale. Finish with submit_report.
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### With visru's own loop
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
visru run sample_data --task "What store name is on the tall vertical neon sign?" --max-steps 20
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
This uses the model in `visru.toml` (Anthropic by default; set `ANTHROPIC_API_KEY`). It prints the report and writes the trajectory, ledger, and an HTML report under `sample_data/.visru/`. Re-render a report with `visru report sample_data [session]`. Pass `--backend replay --script turns.json` to run the loop without API spend.
|
|
195
|
+
|
|
196
|
+
### Project context
|
|
197
|
+
|
|
198
|
+
`VISRU.md` carries whatever the model cannot see in the pixels:
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
# Workspace: warehouse inspection set
|
|
202
|
+
|
|
203
|
+
- 1,240 RGB images, 4032x3024, phone camera, no intrinsics.
|
|
204
|
+
- "Torn" means a visible tear through the printed area. Creases do not count.
|
|
205
|
+
- Labels are 10x15 cm. Anything smaller is a different sticker.
|
|
206
|
+
- Report findings per image ID. Measurements in pixels unless a ruler is visible.
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Configuration
|
|
210
|
+
|
|
211
|
+
Model image limits change between models, so they live in `visru.toml`:
|
|
212
|
+
|
|
213
|
+
```toml
|
|
214
|
+
[model]
|
|
215
|
+
backend = "anthropic" # or "openai_compatible"
|
|
216
|
+
name = "claude-sonnet-5"
|
|
217
|
+
max_edge = 2576
|
|
218
|
+
max_visual_tokens = 4784
|
|
219
|
+
patch = 28
|
|
220
|
+
max_upscale = 2.0
|
|
221
|
+
|
|
222
|
+
[context]
|
|
223
|
+
max_live_images = 16 # stays under the API's 20-image threshold
|
|
224
|
+
elide_batch = 8 # elide in batches to keep the cached prefix stable
|
|
225
|
+
compact_at_tokens = 150_000
|
|
226
|
+
|
|
227
|
+
[coverage]
|
|
228
|
+
inspected_scale = 1.0 # rendered px per source px that counts as "inspected"
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
See the [Claude vision docs](https://platform.claude.com/docs/en/build-with-claude/vision) for current limits.
|
|
232
|
+
|
|
233
|
+
## Evaluation
|
|
234
|
+
|
|
235
|
+
Three arms on the same questions: single pass on the downsized image, `view` only (zoom-only), and the full tool set.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
python -m evals.import_bench vstar # also: hrbench_4k, hrbench_8k, charades_sta
|
|
239
|
+
B=bench/vstar; Q=$B/questions.jsonl
|
|
240
|
+
|
|
241
|
+
python -m evals.baseline --workspace $B --questions $Q --sample 100
|
|
242
|
+
python -m evals.agent --workspace $B --questions $Q --sample 100 --arm zoom_only \
|
|
243
|
+
--out evals/runs/zoom_only_vstar.jsonl
|
|
244
|
+
python -m evals.agent --workspace $B --questions $Q --sample 100 --arm full \
|
|
245
|
+
--out evals/runs/full_vstar.jsonl
|
|
246
|
+
python -m evals.score --questions $Q evals/runs/baseline_*.jsonl \
|
|
247
|
+
evals/runs/zoom_only_vstar.jsonl evals/runs/full_vstar.jsonl
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
`--sample N --seed S` draws the same questions for every arm. Every arm accepts `--backend openai_compatible --config open.toml` to run against an open model. The scorer prints accuracy per arm and category, cost per question, and accuracy grouped by ledger status, which measures whether `verified` claims are actually more accurate than `supported` ones. Answers it cannot grade mechanically are marked `review`; settle them by adding `"correct": true` or `false` to the run file.
|
|
251
|
+
|
|
252
|
+
Custom question sets are JSONL:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{"id": "q01", "asset": "scene_b_1546479680612194.jpg",
|
|
256
|
+
"question": "What does the vertical neon sign on the right read?",
|
|
257
|
+
"answer": "TRADER JOE'S", "accept": ["trader joes"], "kind": "text"}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
`kind` is one of `text`, `count`, `localize`, `temporal` (answered as `start..end` seconds, with a `tolerance`). Validate a set with `python -m evals.suite questions.jsonl --workspace sample_data`. Charades-STA is licensed for non-commercial research use only.
|
|
261
|
+
|
|
262
|
+
## Open questions
|
|
263
|
+
|
|
264
|
+
- Do the checks predict correctness? If `verified` claims are no more accurate than `supported` ones, the verification layer needs redesigning.
|
|
265
|
+
- Where should looking happen: inside the model through learned token selection (LookWhere-style), or outside through tool calls? At what resolution or corpus size does the answer flip?
|
|
266
|
+
- Can trajectories ending in verified, correct claims train an open VLM (SFT, then RL) to reach the same answers with fewer visual tokens?
|
|
267
|
+
- What stopping rule tells the agent it has looked enough?
|
|
268
|
+
- How much of the gain comes from zoom alone?
|
|
269
|
+
|
|
270
|
+
## References
|
|
271
|
+
|
|
272
|
+
- Gupta and Kembhavi. [Visual Programming: Compositional Visual Reasoning without Training](https://arxiv.org/abs/2211.11559). CVPR 2023.
|
|
273
|
+
- Surís, Menon, Vondrick. [ViperGPT: Visual Inference via Python Execution for Reasoning](https://arxiv.org/abs/2303.08128). ICCV 2023.
|
|
274
|
+
- Hu et al. [Visual Sketchpad: Sketching as a Visual Chain of Thought for Multimodal Language Models](https://arxiv.org/abs/2406.09403). NeurIPS 2024.
|
|
275
|
+
- Wu and Xie. [V*: Guided Visual Search as a Core Mechanism in Multimodal LLMs](https://arxiv.org/abs/2312.14135). CVPR 2024.
|
|
276
|
+
- Yang et al. [Set-of-Mark Prompting Unleashes Extraordinary Visual Grounding in GPT-4V](https://arxiv.org/abs/2310.11441). arXiv 2023.
|
|
277
|
+
- Zheng et al. [DeepEyes: Incentivizing "Thinking with Images" via Reinforcement Learning](https://arxiv.org/abs/2505.14362). arXiv 2025.
|
|
278
|
+
- Fuller et al. [LookWhere? Efficient Visual Recognition by Learning Where to Look and What to See from Self-Supervision](https://arxiv.org/abs/2505.18051). arXiv 2025.
|
|
279
|
+
- Ravi et al. [SAM 2: Segment Anything in Images and Videos](https://arxiv.org/abs/2408.00714). ICLR 2025.
|
|
280
|
+
- Minderer et al. [Scaling Open-Vocabulary Object Detection (OWLv2)](https://arxiv.org/abs/2306.09683). NeurIPS 2023.
|
|
281
|
+
- Liu et al. [Grounding DINO](https://arxiv.org/abs/2303.05499). ECCV 2024.
|
|
282
|
+
- Zhai et al. [Sigmoid Loss for Language Image Pre-Training (SigLIP)](https://arxiv.org/abs/2303.15343). ICCV 2023.
|
|
283
|
+
- Yang et al. [Depth Anything V2](https://arxiv.org/abs/2406.09414). NeurIPS 2024.
|
|
284
|
+
- Wang et al. [DUSt3R: Geometric 3D Vision Made Easy](https://arxiv.org/abs/2312.14132). CVPR 2024.
|
|
285
|
+
- Wang et al. [VGGT: Visual Geometry Grounded Transformer](https://arxiv.org/abs/2503.11651). CVPR 2025.
|
|
286
|
+
- Wang et al. [Divide, Conquer and Combine (HR-Bench)](https://arxiv.org/abs/2408.15556). AAAI 2025.
|
|
287
|
+
- Zhang et al. [MME-RealWorld](https://arxiv.org/abs/2408.13257). ICLR 2025.
|
|
288
|
+
- Fu et al. [Video-MME](https://arxiv.org/abs/2405.21075). CVPR 2025.
|
|
289
|
+
- Wu et al. [LongVideoBench](https://arxiv.org/abs/2407.15754). NeurIPS 2024 Datasets and Benchmarks.
|