mono_eval / README.md
nosmall's picture
Upload ICLR mono-depth zero-shot benchmark
a099b24 verified
|
Raw History Blame Contribute Delete
8.19 kB
# ICLR Mono-Depth Zero-Shot Benchmark
Eight perspective (pinhole) depth test sets used for zero-shot evaluation of
monocular depth models. Mirrored from `code/iclr/zero-shot3` with the exact
relative layout its `eval/datasets.py` expects, so that loader only needs its
two roots repointed here.
> These are **perspective** images, not equirectangular panoramas. For the
> 360° suite use the sibling `Depth/datasets/benchmark/` instead.
- **Datasets:** 10
- **Total samples:** 21 087
- **Total size on disk:** ≈ 32 GB
- **Training-free:** all splits are the official *test* sets; no training data
---
## Datasets
Two layout families live side by side:
- **zero-shot3 layout** (`iBims-1` … `vkitti`, the first 8 rows): data under
`datasets/<name>/`, Gemini caption JSONs under `text/<name>/`.
- **RSA layout** (`NYU`, `KITTI`): an extra `NYU` / `KITTI` pair from the RSA
repo, used as an official sanity check. These keep the split `.txt` at the
dataset root and split RGB from ground truth into separate trees
(`rgb/` + `gt/` for KITTI). Their captions are one `.txt` per image and the
loader reads only its **first line** (RSA's eval runs with
`random_number=0`).
| key | N | scene | RGB | depth | depth → meters | min / max (m) | crop |
|-----------------|-------:|---------|--------|--------------|-----------------------|---------------|-------|
| `iBims-1` | 100 | indoor | png | png u16 | `v * 50 / 65535` | 0 / 10 | eigen |
| `SUN` | 5 050 | indoor | jpg | png u16 | `v / 10000` (0.1 mm) | 0.001 / 8 | eigen |
| `DDAD` | 3 950 | outdoor | png | png u16 | `v / 256` | 0.001 / 80 | garg |
| `DIML` | 500 | outdoor | png | png u16 | `v / 1000` (mm) | 2 / 80 | garg |
| `DIODE_indoor` | 325 | indoor | png | **npy f32** | already meters | 0.001 / 10 | eigen |
| `DIODE_outdoor` | 446 | outdoor | png | **npy f32** | already meters | 0.001 / 80 | garg |
| `hypersim` | 7 690 | indoor | png | png u16 | `v / 1000` (planar) | 0.001 / 80 | eigen |
| `vkitti` | 1 720 | synth | jpg | png u16 | `v / 100` (cm) | 0.001 / 80 | garg |
| `NYU` | 654 | indoor | jpg | png u16 | `v / 1000` (mm) | 0.001 / 10 | — |
| `KITTI` | 652 | outdoor | png | png u16 | `v / 256` | 0.001 / 80 | — |
Validity is derived per dataset (see the table in `_loader.py`); the
DIODE sets ship an explicit `*_depth_mask.npy` and iBims-1 ships
`mask_invalid` / `mask_transp` PNGs.
**DDAD is sparse by construction.** Its ground truth is upsampled LiDAR,
so only ~1.1% of pixels carry a return — expect a low valid fraction on
this set (the other outdoor sets, being dense stereo, sit near 80–100%).
The encoding itself is fine: `raw / 256` lands in 5–177 m, which matches
DDAD's sensor geometry.
**`crop`** is the standard evaluation crop applied to the *metric* region:
`eigen` = `[45:471, 41:601]` in a 480×640 frame; `garg` = the full frame at
`352×1216`. Pass `apply_crop=True` to `MonoDepthDataset` to get the cropped
tensor, or leave it off and crop at metric time (the zero-shot3 eval scripts
do the latter).
### Native resolutions
`iBims-1` 480×640 · `SUN` ~530×730 · `DDAD` 1216×1936 · `DIML` 1080×1920 ·
`DIODE` 768×1024 · `hypersim` 768×1024 · `vkitti` 375×1242 · `NYU` 480×640 ·
`KITTI` 375×1242 (KB-cropped to 352×1216 at load time, image and GT alike).
Eval-time resize (matching zero-shot3): `SUN`/`hypersim` → 480×640,
`DDAD` → 352×1216, `DIODE` short side → 480. Images only — GT depth keeps its
native resolution and the prediction is resized back for scoring.
`_loader.py` reproduces the reference preprocessing **bit-exactly**: verified
against `zero-shot3/eval/datasets.py` with the roots repointed here, all 10
datasets agree on `image` (0 diff), on depth over the common-valid region
(0 diff), on the validity mask (100 % of pixels), and — for NYU/KITTI — on the
caption string. The resize op matters —
PIL bilinear, `F.interpolate(align_corners=True)` and
`T.Resize(antialias=True)` disagree by up to 0.3 on a [0,1] scale, so the
loader dispatches to whichever one each dataset's reference loader uses, with
a PIL fallback when torch/torchvision are unavailable.
---
## Directory layout
```
iclr_benchmark/
├── datasets/
│ ├── iBims-1/{imagelist.txt, rgb/, depth/, mask_invalid/, mask_transp/}
│ ├── SUN/{test_images.txt, test_depths.txt, image/, depth/}
│ ├── DDAD/{test_images.txt, test_depths.txt, rgb/, depth/}
│ ├── DIML/HR/{outleft/, depthmap/}
│ ├── DIODE_indoors/<scene>/<scan>/{*.png, *_depth.npy, *_depth_mask.npy}
│ ├── DIODE_outdoor/... # note: data dir is plural, text dir singular
│ ├── hypersim/<scene>/{rgb_cam_*.png, depth_plane_cam_*.png}
│ └── vkitti/{test_images.txt, test_depths.txt, rgb/, depth/}
│ ├── NYU/{nyudepthv2_test_files_with_gt.txt, rgb/} # RSA layout
│ └── KITTI/{eigen_test_files_with_gt.txt, rgb/, gt/} # RSA layout
├── text/ # Gemini JSONs (8 sets) + RSA .txt captions
│ ├── iBims-1/, SUN/image/, DDAD/, DIML/HR/outleft/, hypersim/,
│ ├── DIODE_indoor/, DIODE_outdoor/, vkitti/
│ └── NYU/, KITTI/ # one .txt per image, first line used
├── _loader.py # MonoDepthDataset
├── benchmark.py # HuggingFace datasets BuilderConfig
├── _collect.py # (dev) regenerate from zero-shot3
└── README.md
```
Text JSONs carry the Gemini captions (`Global.objects` + `Global.description`)
that the text-conditioned models in this benchmark consume.
---
## Loading
```python
import sys
sys.path.insert(0, "/path/to/iclr_benchmark")
from _loader import MonoDepthDataset
ds = MonoDepthDataset(root="/path/to/iclr_benchmark", name="iBims-1")
s = ds[0]
# s["image"] float32 [3, H, W] in [0, 1] (no ImageNet normalisation)
# s["depth"] float32 [1, H, W] meters, invalid = 0
# s["valid"] bool [1, H, W]
# s["text"] str Gemini Global description
# s["rgb_path"] str path relative to the dataset root
```
HuggingFace:
```python
from datasets import load_dataset
ds = load_dataset("/path/to/iclr_benchmark", "iBims-1", split="test")
```
---
## Repointing the zero-shot3 evaluator
The original scripts hardcode:
```python
data_root = "/group/40006/jinggcao/code/iclr/zero-shot3/datasets"
text_root = "/group/40006/jinggcao/code/iclr/zero-shot3/datasets/text"
```
Point them at this folder instead:
```python
data_root = "/group/40006/jinggcao/code/Depth/datasets/iclr_benchmark/datasets"
text_root = "/group/40006/jinggcao/code/Depth/datasets/iclr_benchmark/text"
```
Nothing else changes — `build_dataset()` resolves the same relative paths.
---
## Source attribution
- **iBims-1** — Koch et al., *Evaluation of CNN-based Single-Image Depth
Estimation*, ECCV 2018.
- **SUN RGB-D** — Song et al., CVPR 2015 (ZoeDepth test split, 0.1 mm encoding).
- **DDAD** — Guizilini et al., *DDAD15M / 3D Packing for Self-Supervised
Monocular Depth Estimation*, CVPR 2020.
- **DIML** — Kim et al., *DIML/CVL RGB-D dataset*, 2018.
- **DIODE** — Vasiljevic et al., CVPR 2019 (indoor / outdoor splits).
- **Hypersim** — Roberts et al., ICCV 2021 (planar depth renders).
- **Virtual KITTI 2** — Cabon et al., 2020.
- **NYU Depth v2** — Nathan Silberman et al., ECCV 2012 (Eigen test split).
- **KITTI** — Geiger et al., 2013 (Eigen test split, KB-cropped).
Evaluation protocol follows **ZoeDepth** (Bhat et al., 2023) and **TR2M**;
please cite those along with whichever datasets you use.
---
## Regenerating
```bash
python _collect.py --dry-run # list what would be copied
python _collect.py # all 8
python _collect.py SUN DDAD # a subset
```
`_collect.py` is idempotent (skips files whose size already matches).