The Problem

Standard depth estimation models fail on equirectangular panoramas because they assume pinhole camera geometry, causing distortion at the poles and inconsistent scale across the field of view. This repo provides a foundation model trained specifically for panoramic depth estimation, handling the spherical-to-planar projection issues that break conventional approaches.

What This Does

DAP is the official implementation of "Depth Any Panoramas," a CVPR 2026 paper. It adapts the Depth-Anything-V2 architecture to panoramic input, with custom dataset loaders for equirectangular imagery (datasets/ contains 10+ dataset adapters including M3D.py, deep360.py, insta23k.py). The repo includes utilities for converting between equirectangular and cubemap projections (depth_anything_utils.py), plus depth-to-point-cloud (depth2point.py) and depth-to-normal (depth2normal.py) conversion scripts.

The core model lives in depth_anything_v2_metric/, which vendors the DINOv2 and DINOv3 backbones. The config/ directory holds inference and test configurations, while test/infer.py and test/eval.py are the primary entry points.

How It Is Wired

Execution starts at test/infer.py, which loads configuration from config/infer.yaml, instantiates the DPT head from depth_anything_v2_metric/depth_anything_v2/dpt.py, and runs inference using the DINOv2 backbone (dinov2.py). The dataset loaders in datasets/ handle equirectangular-to-cubemap conversion via functions like Equirec2Cube, cassini2Equirec, and spherical_uv_to_directions.

The import graph shows 124 edges across 189 modules with no circular dependencies. The most-connected modules are dinov3/hub/backbones (5 importers) and eval/detection/util/misc (7 importers). The depth_anything_v2_metric directory is effectively a second project—a vendored copy of the DINOv3 training/eval suite—that adds substantial complexity but is only loosely coupled to the main inference path.

How To Use It

git clone https://github.com/moses-y/DAP
cd DAP
pip install torch==2.7.1 torchvision==0.22.1
pip install -r requirements.txt
python test/infer.py

Configuration lives in config/infer.yaml (model weights path, input/output directories). The pretrained weights must be downloaded from Hugging Face (Insta360-Research/DAP-weights) and placed where the config expects. The training dataset is also on Hugging Face (Insta360-Research/DAP_data). Evaluation runs via python test/eval.py using config/test.yaml.

Real-World Use

For a 360° camera system needing real-time depth, you would load the pretrained model, feed it equirectangular frames, and get per-pixel metric depth. The depth2point.py utility converts output to 3D point clouds for downstream tasks like obstacle avoidance or 3D reconstruction. The model handles both indoor (Stanford2D3D, Matterport3D) and outdoor (Deep360) panoramic datasets.

Code Health & Issues

Static analysis found 34 issues across 6 categories:

  • High - Deep nesting (25 occurrences): datasets/util.py, dinov3/data/masking.py, and dinov3/eval/segmentation/models/utils/ops/modules/ms_deform_attn.py reach indentation depth 8, making control flow hard to follow.
  • High - Duplicated code: 1041 repeated 6-line blocks across 100 files, concentrated in datasets/ loaders. Shared helper extraction is overdue.
  • Medium - File opened without context manager (3 occurrences): dinov3/data/datasets/decoders.py, dinov3/logging/__init__.py, dinov3/thirdparty/CLIP/clip/simple_tokenizer.py.
  • Medium - Broad exception handling (3 occurrences): dinov3/checkpointer/checkpointer.py, dinov3/utils/utils.py, and the CLIP tokenizer.
  • Medium - Oversized file: dinov3/train/ssl_meta_arch.py at 679 lines.
  • Low - 7 TODO/FIXME markers in dinov3/eval/segmentation/models/heads/pixel_decoder.py.

No CI/CD pipeline, no lockfile, and no Dockerfile are present. The repo includes compiled .pyc files committed to source control, which should be gitignored. A license file exists.

The Bottom Line

This is a functional research implementation with a solid core inference path but heavy vendored dependencies. The depth_anything_v2_metric subtree is a full DINOv3 codebase that inflates the repo to 372 files and complicates maintenance. Use it if you need state-of-the-art panoramic depth estimation and can tolerate the research-code hygiene issues; expect to refactor the dataset loaders before production use.