tiangexiang's picture
Code link: the GitHub repository
0ff0dfd verified
|
Raw History Blame Contribute Delete
14.8 kB
---
pretty_name: Generalist Vision Bench
license: other
task_categories:
- image-to-image
size_categories:
- 10K<n<100K
tags:
- benchmark
- few-shot
- in-context-learning
- dense-prediction
- image-restoration
viewer: false
---
# Generalist Vision Bench
**Paper:** [arXiv:2612.04585](https://arxiv.org/abs/2612.04585) ·
**Project page:** [vgi.stanford.edu](https://tiangexiang.github.io/vgi/) ·
**Code:** [github.com/tiangexiang/vgi_code](https://github.com/tiangexiang/vgi_code)
Generalist Vision Bench was introduced in
Probing Pretrained Image Generators for Universal Vision Tasks<br>
Tiange Xiang<sup>1,2</sup>, Kristine Lu<sup>2</sup>, Ehsan Adeli<sup>1</sup>, Li Fei-Fei<sup>1</sup><br>
<sup>1</sup>Stanford University&emsp;<sup>2</sup>MIT
## Why this benchmark
Image generators and other generalist models are increasingly asked to solve vision tasks such as depth,
segmentation, keypoints and restoration by producing an image. Each study turns the source datasets into images its
own way, with its own crops, target encodings, demonstrations and metrics, so results are rarely comparable.
Generalist Vision Bench fixes these choices once, for thirteen established tasks posed as image in, image out:
- **Fixed processors.** Each dataset and task has one predefined, fixed processor that turns the source data into
256 × 256 input and target images. The released images are its output, so every method sees the same inputs and is
scored against the same targets.
- **Fixed episodes.** Every query's demonstrations are drawn with a fixed seed.
- **Fixed scoring.** One metric per task, normalised from copying the input (0) to the ground truth (100), so all
thirteen tasks average into one score.
- **Evaluation only.** We believe training a generalist model should not be task-specific, so the bench is not meant
for training or fine-tuning. A method sees only the demonstrations each query provides.
| split | packs | images | use |
|---|---:|---:|---|
| `validation` | 13 (one dataset per task) | 221 (17 per task) | development |
| `test` | 26 (two datasets per task) | 17,511 | final evaluation |
A **pack** is one task on one dataset. Every image of a pack is the query once, with demonstrations drawn from the
other images of the same pack.
## Tasks
| task | input | target |
|---|---|---|
| `saliency_detection` | photo, framed around the salient object | the salient object(s) white on black |
| `human_pose_2d` | photo, framed around the person | a filled disc (radius 5 px) at each of the 12 limb joints (ankles, knees, hips, wrists, elbows, shoulders), one colour per joint, on black |
| `face_landmarks` | photo, framed around the face | a filled disc (radius 5 px) at each of the 68 landmarks, one colour per landmark, on black |
| `semantic_segmentation` | photo | one flat colour per class; black = unlabelled |
| `instance_segmentation` | photo | one flat colour per object (colours carry no class); black = background |
| `edge_detection` | photo | grey boundary strength on black |
| `relative_depth` | photo | grey inverse depth, normalised per image: codes 1 (far) to 255 (near); 0 = no measurement |
| `surface_normals` | photo | RGB = (n + 1) / 2 · 255, camera frame (x right, y up, z toward the camera); black = no measurement |
| `colorization` | grey photo (BT.601 luma) | the colour photo |
| `denoising` | noisy photo (SIDD: real noise; CBSD68: Gaussian, σ 25 or 50) | the clean photo |
| `deblurring` | blurred frame (real camera and motion blur) | the sharp frame |
| `inpainting` | photo with black free-form strokes (about 12 % of the tile) | the intact photo |
| `super_resolution` | photo downsampled ×4 (bicubic) and upsampled back (bilinear) | the original photo |
Colour-coded targets (segmentation, pose, faces) use one fixed palette of 1,024 colours, black first (see
[Decoding targets](#decoding-targets)).
| task | validation (17 images) | test (images) |
|---|---|---|
| `saliency_detection` | `dut_omron` | `ecssd` (1,000), `pascal_s` (845) |
| `human_pose_2d` | `mpii` | `lsp_test` (1,000), `flic_test` (926) |
| `face_landmarks` | `300w` | `300w_test` (600), `cofw68_test` (507) |
| `semantic_segmentation` | `ade20k` | `camvid_test` (233), `nyuv2_test_40` (654) |
| `instance_segmentation` | `nyu_depth_v2` | `nyuv2_test` (654), `voc2012_val` (1,449) |
| `edge_detection` | `bsds500` | `bsds500_test` (200), `nyudv2_test_hed` (654) |
| `relative_depth` | `nyu_depth_v2` | `nyuv2_test` (654), `diode_val` (771) |
| `surface_normals` | `diode` | `diode_val` (771), `nyuv2_test_geonet` (654) |
| `colorization` | `div2k` | `div2k_val` (100), `ade20k_val` (2,000) |
| `denoising` | `sidd` | `sidd_val` (1,280), `cbsd68` (68) |
| `deblurring` | `gopro` | `gopro_test` (1,111), `realblur_j_test` (980) |
| `inpainting` | `div2k` | `div2k_val` (100), `urban100` (100) |
| `super_resolution` | `div2k` | `div2k_val` (100), `urban100` (100) |
Each test pack is the complete official evaluation split of its dataset, or the whole dataset when it has none
(PASCAL-S keeps 845 of its 850 images, as its own benchmark does).
## Download
```bash
hf download stanford-vision-lab/GeneralistVisionBench --repo-type dataset --local-dir GeneralistVisionBench
# only the validation split:
hf download stanford-vision-lab/GeneralistVisionBench --repo-type dataset --local-dir GeneralistVisionBench --include "validation/*"
```
## Files
```
validation/<task>/<dataset>/000000.tar
test/<task>/<dataset>/000000.tar, 000001.tar, ...
```
The shards are uncompressed tar files in the [WebDataset](https://github.com/webdataset/webdataset) layout. Image 42
of a pack is three files, for every task:
| file | content |
|---|---|
| `0042.input.png` | the input, RGB, 256 × 256 |
| `0042.target.png` | the target, RGB, 256 × 256 |
| `0042.json` | the metadata (below) |
| `json` field | content |
|---|---|
| `task`, `dataset` | the pack |
| `record_id` | the image in its source dataset |
| `official_split` | the source dataset's split |
| `source_metadata` | details from the source dataset (file names, scenes, noise level, ...) |
| `gt` | ground truth some metrics need beyond the target image; empty for most tasks |
`gt` holds, by task:
| task | `gt` field | content |
|---|---|---|
| `relative_depth` | `depth_range` | [lo, hi]: the inverse depths of codes 1 and 255 |
| `human_pose_2d`, `face_landmarks` | `points` | every keypoint's exact position (`x`, `y` in tile pixels), `slot`, `name`, and whether it is `drawn`, `inside_tile` and `visible_in_raster` |
| `instance_segmentation` | `void` | mask of the source's unlabelled pixels (ignored when scoring) |
| `inpainting` | `hole` | mask of the strokes |
| `edge_detection` (BSDS500) | `annotators` | one mask per human annotator: their thinned boundaries |
Masks are run-length codes in the COCO uncompressed format: `{"size": [256, 256], "counts": [...]}`, run lengths in
column-major order, starting with a run of zeros.
## Loading
Python with NumPy and Pillow:
```python
import io, json, tarfile
from pathlib import Path
import numpy as np
from PIL import Image
def read_pack(pack_dir):
"""Yield (input, target, meta) for every image of a pack, in order."""
for shard in sorted(Path(pack_dir).glob("*.tar")):
with tarfile.open(shard) as tar:
files = {}
for member in tar: # each image's three files are consecutive
files[member.name.split(".", 1)[1]] = tar.extractfile(member).read()
if len(files) == 3:
yield (np.array(Image.open(io.BytesIO(files["input.png"]))), # uint8 [256, 256, 3]
np.array(Image.open(io.BytesIO(files["target.png"]))), # uint8 [256, 256, 3]
json.loads(files["json"]))
files = {}
def rle_decode(rle):
"""A COCO uncompressed run-length code -> bool mask [H, W]."""
h, w = rle["size"]
return np.repeat(np.arange(len(rle["counts"])) % 2 == 1, rle["counts"]).reshape(w, h).T
pack = list(read_pack("GeneralistVisionBench/validation/inpainting/div2k"))
x, y, meta = pack[0]
hole = rle_decode(meta["gt"]["hole"])
```
Any WebDataset reader works too: an image's key is its index (`0042`) and its files are `input.png`, `target.png` and
`json`.
## Evaluation protocol
**Episodes.** Every image of a pack is a query once. Its 16 demonstrations are other images of the same pack, drawn
with a fixed seed; a method that uses P < 16 demonstrations takes the first P. For query `q` of a pack of `n` images:
```python
import zlib
import numpy as np
def demonstrations(task, q, n, p=16):
"""The indices of query q's demonstrations (never q itself), in draw order."""
rng = np.random.default_rng([42, zlib.crc32(task.encode()) & 0xFFFF, q, p])
return [int(i) for i in rng.choice([i for i in range(n) if i != q], size=p, replace=False)]
```
**Colours of an episode.** For the colour-coded tasks (semantic and instance segmentation, pose, faces), the targets
of an episode are recoloured together before use: their labels take palette colours 1, 2, 3, ... in order of first
appearance (row by row, over the 16 demonstrations in draw order, then the query). Demonstrations are shown, and
predictions scored, in this coding.
**Metrics.** One per task, computed on the 256 × 256 prediction:
| task | metric |
|---|---|
| saliency | max F-beta (β² = 0.3) over 256 thresholds ↑ |
| human pose | PCK at 0.2 × the torso diagonal ↑ |
| face landmarks | NME (inter-ocular; COFW-68 inter-pupil), a missed landmark counts 0.5 ↓ |
| semantic segmentation | class-agnostic mIoU: predicted colour regions matched one-to-one to the target's segments ↑ |
| instance segmentation | panoptic quality (IoU > 0.5), `gt.void` ignored ↑ |
| edge detection | OIS F, matching within 0.75 % of the diagonal (NYUv2: 1.1 %); BSDS500 against each annotator ↑ |
| relative depth | δ1 after a per-image least-squares scale and shift in inverse depth ↑ |
| surface normals | mean angular error in degrees; black (no prediction) counts 180° ↓ |
| colorization, denoising, deblurring, super-resolution | LPIPS (AlexNet) ↓ |
| inpainting | LPIPS of the prediction inside `gt.hole` composited onto the input ↓ |
**Score.** For each pack, the **gap closed** is 100 · (o(pred) − o(copy)) / (o(target) − o(copy)), where o is the
pack's mean metric (negated when lower is better), "copy" returns the input unchanged and "target" is the ground truth
itself. Copying scores 0 and a perfect answer 100. A task's score is the mean over its packs (one on validation, two on
test), and the bench score is the mean over the 13 tasks.
**Reference scorer.** The [code](https://github.com/tiangexiang/vgi_code) implements this protocol: its loader yields
every query with its demonstrations, and its scorer (`python -m vgi.eval`) scores a folder of predictions from any
method. Use it rather than reimplementing the metrics, so that your numbers stay comparable.
## Decoding targets
<details>
<summary>The palette, and what its indices mean</summary>
In the stored targets (before an episode's recolouring) a palette colour's index is the label: the class id
(NYUv2-40: 1-40, ADE20K-150: 1-150, CamVid: 1-11), the instance number, the MPII joint slot + 1 (pose) or the iBUG-68
landmark index + 1 (faces). Index 0 is black. The palette:
```python
import numpy as np
def srgb_to_lab(rgb):
c = rgb.astype(np.float64) / 255.0
c = np.where(c <= 0.04045, c / 12.92, ((c + 0.055) / 1.055) ** 2.4)
m = np.array([[0.4124564, 0.3575761, 0.1804375], [0.2126729, 0.7151522, 0.0721750],
[0.0193339, 0.1191920, 0.9503041]])
xyz = c @ m.T / np.array([0.95047, 1.0, 1.08883])
f = np.where(xyz > 0.008856, np.cbrt(xyz), 7.787 * xyz + 16.0 / 116.0)
return np.stack([116.0 * f[:, 1] - 16.0, 500.0 * (f[:, 0] - f[:, 1]), 200.0 * (f[:, 1] - f[:, 2])], axis=1)
def palette(size=1024, levels=16):
"""Black, then a farthest-point sequence in CIELAB over a 16-level RGB grid (colours with a channel > 40)."""
g = np.linspace(0, 255, levels).round().astype(np.uint8)
cand = np.array([[r, gg, b] for r in g for gg in g for b in g], np.uint8)
cand = cand[np.any(cand > 40, axis=1)]
lab = srgb_to_lab(cand)
d = np.linalg.norm(lab - srgb_to_lab(np.zeros((1, 3), np.uint8))[0], axis=1)
chosen = [int(np.argmax(d))]
mind = np.minimum(np.linalg.norm(lab - lab[chosen[0]], axis=1), d)
while len(chosen) < size - 1:
chosen.append(int(np.argmax(mind)))
mind = np.minimum(mind, np.linalg.norm(lab - lab[chosen[-1]], axis=1))
return np.concatenate([np.zeros((1, 3), np.uint8), cand[chosen]], axis=0) # uint8 [1024, 3]
```
</details>
## Notes
- **Framed inputs.** Saliency, pose and face inputs are cropped around the subject using its annotation, so these tasks
are subject-conditioned. The saliency crop can cut off part of a large object.
- **Keypoint targets.** Discs are drawn in order, so close keypoints can hide one another; `gt.points` keeps every
keypoint's exact position.
- **Ground-truth sources.** NYUv2 edges use HED's ground truth and NYUv2 normals GeoNet's. BSDS500 edge targets are the
annotators' soft consensus; the annotators' own boundaries are in `gt.annotators`.
- **Validation and test overlap.** Validation images come from the same evaluation splits as the test packs (170 of the
221 also appear in test), except GoPro (training split), MPII (the standard validation subset) and DUT-OMRON (whole
set). Develop on validation and report test.
- **Scenes.** GoPro, SIDD, DIODE, CamVid, RealBlur-J and NYUv2 hold many frames per scene, and demonstrations are drawn
without regard to scene.
- **Not a native leaderboard.** Tiles are 256 × 256, restoration is scored with LPIPS and segmentation is
class-agnostic, so scores are not comparable with the source datasets' own leaderboards. The super-resolution
degradation is applied to the tile, not DIV2K's official protocol.
## Source datasets and terms
The tiles are derived from these public datasets: 300-W, ADE20K, BSDS500, CamVid, CBSD68, COFW-68, DIODE, DIV2K,
DUT-OMRON, ECSSD, FLIC, GoPro, LSP, MPII Human Pose, NYU Depth v2, PASCAL-S, PASCAL VOC 2012, RealBlur, SIDD and
Urban100. Each keeps its own licence and terms of use, which apply to its tiles here; this collection grants no further
rights. Please cite the source datasets you use.
## Citation
If you use Generalist Vision Bench, please cite the paper:
```bibtex
@article{xiang2026probing,
title = {Probing Pretrained Image Generators for Universal Vision Tasks},
author = {Xiang, Tiange and Lu, Kristine and Adeli, Ehsan and Fei-Fei, Li},
journal = {arXiv preprint arXiv:2612.04585},
year = {2026}
}
```