DA3-BASE / README.md
bigshanedogg's picture
Upload DA3-BASE (transformers port, original code)
a549181 verified
|
Raw History Blame Contribute Delete
3.94 kB
---
license: apache-2.0
library_name: transformers
base_model: depth-anything/DA3-BASE
tags:
- depth-anything-3
- depth-estimation
- multi-view-geometry
pipeline_tag: image-to-3d
---
# DA3-BASE — transformers format
Unofficial transformers port of **Depth Anything 3** `DA3-BASE` (any-view model; relative depth, camera pose, pose conditioning). Loads with
`trust_remote_code`; the `depth_anything_3` package is not needed. `model.safetensors` holds the tensors of
`depth-anything/DA3-BASE`, unchanged (re-saved by `save_pretrained`; every tensor checked equal).
> **Not an official release.** Depth Anything 3 was created by Haotong Lin, Sili Chen, Jun Hao Liew, Donny Y. Chen,
> Zhenyu Li, Guang Shi, Jiashi Feng and Bingyi Kang (ByteDance Seed) — https://github.com/ByteDance-Seed/depth-anything-3,
> paper *"Depth Anything 3: Recovering the Visual Space from Any Views"* (arXiv 2511.10647).
## What it is
`DepthAnything3ForDepthEstimation.model` is the package's network, built from the checkpoint's own object graph (`config.json` →
`da3_config`, identical to the package's `configs/da3-base.yaml`) the way `depth_anything_3.cfg.create_object`
builds it; `forward` runs the network's `forward` and returns its outputs as a `DepthAnything3Output` (`ModelOutput`;
the network's `depth` is named `predicted_depth`, the other keys keep their names). The network code is the official code
(ByteDance-Seed/depth-anything-3 @ 3d835ec1) vendored into flat files (`da3_*.py`); the only edits are imports and one
renamed logger. `DepthAnything3Processor` (`processing_depth_anything_3.py`, `processor_config.json`) wraps
`DepthAnything3ImageProcessor`, which runs the package's `InputProcessor`.
Verified against the official package (same process and seeds, V100, 4 images): preprocessing and every output of the
plain, pose-conditioned and ray-pose forward are **bit-identical** (also as a tuple), in fp32 and under the package API's autocast.
## Usage
```python
import torch
from PIL import Image
from transformers import AutoModelForDepthEstimation, AutoProcessor
model = AutoModelForDepthEstimation.from_pretrained("DA3-BASE", trust_remote_code=True).eval().cuda()
processor = AutoProcessor.from_pretrained("DA3-BASE", trust_remote_code=True)
inputs = processor(images=[Image.open(p) for p in paths], return_tensors="pt").to("cuda") # pixel_values (1, N, 3, H, W)
dtype = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16 # the package API's autocast
with torch.no_grad(), torch.autocast("cuda", dtype=dtype):
outputs = model(**inputs) # outputs.predicted_depth (1, N, H, W), outputs.depth_conf, ...
```
- `AutoModel` loads the same class; `return_dict=False` returns a tuple. Depth is at the processed resolution, as the
package API returns it.
- Backbone features: `export_feat_layers=[i, ...]` returns them in `outputs.aux`.
- Pose conditioning: pass `extrinsics` (1, N, 4, 4) / `intrinsics` (1, N, 3, 3) — give them to the processor with the images so the intrinsics follow the resize. `use_ray_pose=True` decodes poses from the ray head.
- Some outputs use random sampling as in the original (sky handling samples depths): seed torch for reproducible runs.
- Runtime packages beyond torch / transformers: `addict`, `omegaconf`, `einops`, `opencv-python` (as the original).
## Licensing
- Code and weights: **Apache-2.0** — [`LICENSE`](LICENSE) (ByteDance-Seed/depth-anything-3), as published on `depth-anything/DA3-BASE`.
- Attribution, sources and the changes made here: [`NOTICE`](NOTICE).
## Citation
If you use this model, please cite the original work, as its authors ask:
```bibtex
@article{depthanything3,
title={Depth Anything 3: Recovering the visual space from any views},
author={Haotong Lin and Sili Chen and Jun Hao Liew and Donny Y. Chen and Zhenyu Li and Guang Shi and Jiashi Feng and Bingyi Kang},
journal={arXiv preprint arXiv:2511.10647},
year={2025}
}
```