VIMA is a spatial-intelligence prototype for egocentric construction video.
The current local demo path is a spatial-memory pipeline: raw hardhat footage is too ambiguous for a vision-language model to answer reliably on its own, so VIMA first turns frames into auditable memory:
Yolodex/Codex labels
-> optional Gemini Robotics-ER semantic boxes
-> merge boxes by class + IoU
-> SAM-style box-prompt masks
-> Depth Anything or proxy depth
-> object-event episodic memory
-> cited Gemini answer from retrieved evidence
The demo question this repo is built around is:
Was there masonry work happening near the wall?
Live verification:
- Dashboard: https://vimaspatial.tech/demo
- Temporal eval: https://vimaspatial.tech/eval
Check deployed API numbers directly:
curl -s https://vimaspatial.tech/api/cii/summary | jq
curl -s https://vimaspatial.tech/api/cii/frames | jq 'length'
curl -s https://vimaspatial.tech/api/spatial/zones | jqExpected hosted-demo values: 30 frames, 86.7% wrench time, 0.893 mean confidence, and 118 temporal episodes in the eval workspace.
From the repo root, print the complete wrapped spatial-memory pipeline without writing files:
python3 backend/vima_cli.py run \
"Was there masonry work happening near the wall?" \
--use-robotics \
--merge-dry-run \
--dry-runAnswer from the bundled episodic-memory artifact:
python3 backend/vima_cli.py ask \
"Was there masonry work happening near the wall?"ask uses Gemini by default and falls back to the local heuristic answer if a
Gemini key is not available. For live Gemini calls, copy .env.example to
.env and set either GEMINI_API_KEY or GOOGLE_API_KEY.
Run the FastAPI backend locally:
cd backend
uv run api.py
# -> http://localhost:8765Important deployed endpoints:
GET /health- status checkPOST /analyze/frame- upload JPG, get CII classification and spatial JSONPOST /analyze/timestamp?timestamp=30.0- analyze from video at timestampPOST /analyze/batch- batch eventsGET /demo- masonry-footage events when the source video is presentGET /cii/summary- wrench-time summaryGET /cii/frames- per-frame classificationsGET /spatial/zones- zone attribution with spatial narrativeGET /eval- cached or live temporal evidence with proof-frame citationsPOST /temporal/run?n=8- live temporal reasoning, cooldown protectedGET /temporal/frame/{frame_index}- frame files referenced by/eval
Use the hosted VIMA API from any agent shell without cloning the full backend:
uvx --from "git+https://github.com/philip-chen6/vima.git#subdirectory=packages/vima-agent" vima doctor
uvx --from "git+https://github.com/philip-chen6/vima.git#subdirectory=packages/vima-agent" vima analyze --sample masonry-p --json
uvx --from "git+https://github.com/philip-chen6/vima.git#subdirectory=packages/vima-agent" vima skill install --agent autoFor local backend development:
VIMA_API_URL=http://localhost:8765 uvx --from "git+https://github.com/philip-chen6/vima.git#subdirectory=packages/vima-agent" vima doctorThe package source lives in packages/vima-agent/. It is intentionally a thin
HTTP client around the deployed API, not a wrapper around the local SAM/depth
memory pipeline.
Remote agents can connect directly to the hosted MCP endpoint:
https://vimaspatial.tech/mcp
It exposes the same thin API surface as the CLI: doctor, frame analysis,
baseline comparison, CII summary/frames, spatial zones, and temporal eval.
The source lives in packages/vima-mcp/; production runs it as a small compose
service next to the frontend and backend.
Mintlify docs live in docs.json and docs/*.mdx. Start with:
docs/devpost-submission.mdxdocs/quickstart.mdxdocs/onboarding.mdxdocs/mcp.mdxdocs/cicd.mdx
CI runs a docs-drift check whenever the public API, CLI, MCP server, or routing
changes. The report-only agent prompt for docs updates lives at
docs/AGENT_DOCS_AUDIT.md.
Most code that matters for the spatial-memory pipeline lives in backend/.
Important demo artifacts still live in demo/:
demo/gemini_robotics_boxes.jsondemo/mask_track_memory.jsondemo/depth_track_memory.jsondemo/episodic_memory.jsondemo/memory_answer_gemini.json
The default hardhat run directory is:
tools/yolodex/runs/vima-hardhat
Some checkouts only include derived demo/ artifacts and dashboard sample
assets, not the full Yolodex run directory. Commands that rebuild masks, depth,
or exports need that run directory to exist.
Run only Gemini Robotics-ER boxes for one frame:
python3 backend/vima_cli.py robotics-boxes \
--image tools/yolodex/runs/vima-hardhat/frames/frame_000001.jpgDry-run a Robotics-ER merge into YOLO labels:
python3 backend/vima_cli.py merge-boxes --merge-dry-runBuild mask tracks, depth memory, and episodic memory from an existing labeled Yolodex run:
python3 backend/vima_cli.py memory \
--run-dir tools/yolodex/runs/vima-hardhat \
--depth-backend auto \
--query "worker laying blocks near wall"Use the deterministic proxy-depth backend when model weights are unavailable:
python3 backend/vima_cli.py memory \
--run-dir tools/yolodex/runs/vima-hardhat \
--depth-backend proxyPackage a shareable artifact bundle:
python3 backend/vima_cli.py export --name vima_share --limit 12Run a full video through Yolodex collection, labeling, memory, answer, and export:
scripts/run_full_video.sh data/video01.mp4 vima-full \
"Was there masonry work happening near the wall?" \
0.1 geminiThe standalone dashboard is the quickest way to inspect the current sample run:
python3 -m http.server 8787 --directory dashboardOpen http://localhost:8787. It shows the sample frame, mask/depth previews,
retrieved episodes, and answer artifact without touching the Next.js frontend.
The tiny eval compares raw Gemini frame answers against memory-augmented answers
for the questions in configs/eval_questions.json:
python3 backend/eval_memory.py --limit 5Outputs:
demo/eval_results.jsondocs/eval_results.md
This is a lightweight sanity check for demo and paper examples, not a benchmark.
| Path | Purpose |
|---|---|
backend/vima_cli.py |
Main wrapper for the VIMA memory pipeline |
backend/gemini_robotics_boxes.py |
Gemini Robotics-ER semantic boxes |
backend/merge_robotics_boxes.py |
Class + IoU merge into YOLO labels |
backend/mask_track_memory.py |
Box-prompt masks and persistent tracks |
backend/depth_memory.py |
Depth Anything or proxy depth over tracks |
backend/episodic_memory.py |
Object-event episodes for retrieval |
backend/answer_from_memory.py |
Cited answer from retrieved episodes |
backend/eval_memory.py |
Tiny raw-frame vs memory eval |
dashboard/ |
Static sample dashboard |
frontend/ |
Next.js product/marketing frontend |
packages/vima-agent/ |
Hosted API CLI package |
packages/vima-mcp/ |
Hosted API MCP server |
paper/ |
Mini-paper source and figures |
tools/yolodex/ |
Vendored frame collection and labeling tools |
The scripts are plain Python entry points. A fresh machine should have Python 3.11+ and the lightweight image/data dependencies available:
python3 -m pip install pillow numpyOptional model-backed stages need additional packages and downloaded weights:
- SAM mask backend:
torch,transformers,facebook/sam-vit-base - Depth Anything backend:
torch,transformers,depth-anything/Depth-Anything-V2-Small-hf - Gemini legacy SDK path:
google-generativeai
The REST Gemini path only needs an API key.
- The local Qwen-VL harness is in
backend/qwen_frame_qa.py, but model downloads stalled on this machine. Do not depend on Qwen for demo-critical flow. - Generated JSON artifacts may reference historical timestamps and sample labels. Treat them as demo artifacts, not final benchmark results.
- Older FastAPI, CII, raffle, and Solana files still exist in the repo from a previous product direction. The active local demo path is the spatial-memory pipeline above.
- The project name is VIMA. Do not add new VINNA references.
VIMA is a Hacktech 2026 Spatial Intelligence Track submission by Lucas He, Stephen Hung, Philip Chen, and Joshua Lin.