An Active Vision Agent for Concept-Driven Visual Exploration and Human-Like Scanpath Prediction
Alessandro D’Amelio · Sabrina Patania · Luca Annese · Giuseppe Boccignone
University of Milan, University of Milan-Bicocca
Overview · How It Works · Installation · Quickstart · Configuration · Citation
Example scanpath simulated by Eyegent on examples/ski.jpg for the query: “What color is the ski the letters are on?”
Eyegent is an active vision agent that performs concept-driven visual exploration on images. Given an input image and a natural-language query, Eyegent orchestrates an iterative perception-action loop of open-vocabulary segmentation, stochastic fixation prediction, and multimodal relevance evaluation to progressively focus on the regions most aligned with the query—producing a simulated, human-like visual scanpath.
This repository contains the official implementation accompanying the paper:
Eyegent: Visual Attention Orchestration on Concepts
Alessandro D’Amelio, Sabrina Patania, Luca Annese, and Giuseppe Boccignone
International Journal of Computer Vision (IJCV), 2026.
Eyegent operates through a recurrent perception cycle orchestrated by a Vision-Language Model (VLM):
- Concept-Based Segmentation (
segment_phrase) — A phrase-guided segmentation backend (CLIPSeg) generates candidate concept masks across the image. - Attention Map Construction — Candidate masks are combined and assigned dynamic weights representing their expected task relevance.
- Fixation Selection (
predict_foa) — The Spatial Drift-Diffusion Gaze Model (SDDGM /ScanDDM) samples the next Focus of Attention (FOA) and fixation duration from the weighted spatial map. - Mask Examination (
examine_mask) — The region at the current fixation is isolated, visualized, and evaluated by a Multimodal LLM for semantic alignment with the query. - Attention Update & Termination (
judge) — Relevance scores update the spatial priority map for subsequent fixations until a termination criterion fires (confidence threshold, simulated duration limit, or tool-call budget).
- Python:
3.11or3.12(commands below usepython3.12) - Hardware: CPU or CUDA-enabled GPU for CLIPSeg and ScanDDM; a CUDA GPU with sufficient VRAM for serving the VLM (e.g.,
Qwen/Qwen3-VL-8B-Instruct) - VLM Server: Any OpenAI-compatible multimodal server (e.g., vLLM)
- Network: Internet access on first run to automatically pull public CLIPSeg and Qwen checkpoints from Hugging Face
Clone the repository and install the package in a dedicated virtual environment:
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .Note
- PyTorch CUDA Builds:
pip install -e .installs standard PyTorch packages automatically. If your system requires a specific CUDA wheel, install PyTorch via the official PyTorch selector before runningpip install -e .. - Checkpoints: CLIPSeg weights download automatically on first use. Setting
HF_TOKENis optional and only needed for higher Hugging Face Hub rate limits. Recenttransformersversions may log two unexpected CLIPSegposition_idsbuffers during loading—these buffers are recreated by the model and are harmless.
We recommend running vLLM in a separate terminal and virtual environment so its dependencies remain isolated from the simulation environment:
python3.12 -m venv .venv-vllm
source .venv-vllm/bin/activate
python -m pip install --upgrade pip
python -m pip install vllm
vllm serve Qwen/Qwen3-VL-8B-Instruct \
--host 127.0.0.1 \
--port 8001 \
--tensor-parallel-size 1 \
--max-model-len 16384 \
--limit-mm-per-prompt '{"image": 3}'Important
Eyegent sends the original image along with up to two mask views in a single VLM request, so your server must allow at least 3 images per prompt (--limit-mm-per-prompt '{"image": 3}').
Verify that the server is live at the default endpoint (http://127.0.0.1:8001/v1):
curl http://127.0.0.1:8001/v1/modelsSee the vLLM serving guide and the Qwen3-VL-8B-Instruct model card for hardware tuning flags (--tensor-parallel-size, --gpu-memory-utilization, etc.).
With the VLM server running, activate your Eyegent environment and run a simulation using simulate.py (or the installed eyegent CLI command):
source .venv/bin/activate
python simulate.py \
--image examples/ski.jpg \
--query "What color is the ski the letters are on?" \
--output scanpath.png \
--seed 42Open scanpath.png to inspect the plotted scanpath with numbered fixations overlaid on the stimulus.
To run on your own stimulus and query, point --image to any Pillow-compatible image (PNG, JPEG, etc.) and set --output to .png, .pdf, .svg, or .jpg. Intermediate masks and VLM views are created in a temporary directory and cleaned up automatically when the run finishes.
python simulate.py \
--image my_image.jpg \
--query "Where is the red ball?" \
--base-url http://127.0.0.1:8001/v1 \
--model Qwen/Qwen3-VL-8B-Instruct \
--output ball_scanpath.pngYou can also invoke Eyegent directly from Python:
from eyegent.model import Eyegent
from eyegent.plot_scanpaths import save_scanpath
agent = Eyegent(config_path="config.yml", verbose=True)
result = agent.run("examples/ski.jpg", "What color is the ski the letters are on?")
print(f"Fixations: {len(result.scanpath)} | Stop reason: {result.stop_reason}")
save_scanpath("examples/ski.jpg", "What color is the ski the letters are on?", result, "scanpath.png")| Argument | Description | Default |
|---|---|---|
--image |
Path to the input stimulus image (required) | — |
--query |
Natural-language visual query (required) | — |
--output |
Output path for the rendered scanpath (.png, .pdf, .svg, .jpg) |
scanpath.png |
--config |
Path to a custom YAML configuration file | config.yml (if in root) |
--base-url |
OpenAI-compatible VLM server endpoint (including /v1) |
http://127.0.0.1:8001/v1 |
--model |
Model identifier exposed by the VLM server | Qwen/Qwen3-VL-8B-Instruct |
--device |
Compute device for CLIPSeg and ScanDDM (cpu or cuda) |
cuda |
--duration |
Maximum simulated scanpath duration in seconds | 2.9 |
--max-generations |
Maximum number of orchestrator tool calls | 10 (in config.yml) |
--seed |
Deterministic seed for local RNGs and greedy VLM decoding (temperature=0.0) |
None |
--verbose |
Print step-by-step agent actions and tool outputs | False |
Default hyperparameters are stored in config.yml. When invoked from the repository root, the CLI loads config.yml automatically; pass --config path/to/config.yml to override specific keys.
Precedence order (highest to lowest): CLI flags EYEGENT_BASE_URL, EYEGENT_MODEL, EYEGENT_API_KEY)
| Section | Purpose & Key Parameters |
|---|---|
segmentation |
CLIPSeg probability threshold (prob_threshold), minimum component area (min_area_ratio), ellipse fitting (use_ellipse), maximum masks per phrase (max_masks_per_prompt), and device. |
llm |
VLM model name, server_url, api_key, generation max_tokens / temperature, and per-stage thinking token budgets (orchestrator, examine, judge). |
inference |
Maximum orchestrator tool calls (max_generations), simulated duration cutoff (max_duration), judge_enabled, and termination_confidence_threshold. |
scanpath |
SDDGM (ScanDDM) parameters (fps, kappa, threshold, noise, eta, ffi) and device. |
Tip
- Tool Calls vs. Fixations:
inference.max_generationscounts completed orchestrator tool calls (segment_phrase,predict_foa,examine_mask,judge), not plotted fixations. Ajudgestep below the confidence threshold can also sample the next fixation within the same generation, so the final fixation count may differ from the number of tool calls. - VLM Thinking Compatibility: By default, VLM requests include
thinkingbudget fields. If your OpenAI-compatible server or model rejects those fields, setllm.thinking.enabled: falsein your YAML configuration.
If you find Eyegent useful in your research, please cite our paper:
@article{damelio2026eyegent,
author = {D’Amelio, Alessandro and Patania, Sabrina and Annese, Luca and Boccignone, Giuseppe},
title = {Eyegent: Visual Attention Orchestration on Concepts},
journal = {International Journal of Computer Vision},
year = {2026},
volume = {134},
number = {11},
pages = {493},
issn = {1573-1405},
doi = {10.1007/s11263-026-03042-4},
}