DA3 Metric Large 是 ByteDance Seed Team 发布的 Depth Anything 3 系列中的度量深度模型,基于 DINOv2 ViT-L (1024 dim, 24 layers) + DPT head,参数量 0.35B,专用于单目度量深度估计,支持同步输出深度、置信度、天空分割、相机外参/内参及 3D 点云。模型权重托管于 depth-anything/DA3METRIC-LARGE (model.safetensors 1.3GB),官方实现为 depth-anything-3 (Apache-2.0),pipeline_tag depth-estimation。
DepthAnything3Net (net: DINOv2 vitl out_layers [4,11,17,23], head: DPT dim_in 1024 features 256)depth (1,1,H,W) float32 米制深度, sky (1,1,H,W) 天空置信, aux 辅助字典本仓已在单卡 Ascend910B (npu:0) 上完成真实权重加载与推理验证,兼容 CPU 回退。
working/models/depth-anything-DA3METRIC-LARGE (model.safetensors 1336734448 bytes, 1.245 GiB)检测命令:
npu-smi info
python -c "import torch; import torch_npu; print(torch.npu.is_available()); print(torch.npu.get_device_name(0))"pip install -r requirements.txt
# 额外源码 (已内置于推理脚本的 mock 兼容)
git clone https://github.com/ByteDance-Seed/depth-anything-3 /tmp/da3
export PYTHONPATH=/tmp/da3/src:$PYTHONPATH关键依赖: torch, torch_npu, torchvision, numpy<2, pillow, opencv-python, einops, omegaconf, addict, safetensors, huggingface_hub
python inference.pynpu:0,若不可用回退 CPUworking/models/depth-anything-DA3METRIC-LARGE),打印模型、设备、输入、深度统计、耗时、PASS/FAILpython inference.py --mode validate # 仅一致性校验 + 推理
python inference.py --mode benchmark # 性能压测PIL.Image 或 np.ndarray H×W×3 uint8,process_res=504,upper_bound_resize + 14 对齐depth shape (1,1,504,504) float32,值域约 0.6[INFO] model_name: depth-anything/DA3METRIC-LARGE
[INFO] local_model_dir: /opt/atomgit/adapt-npu-agent/working/models/depth-anything-DA3METRIC-LARGE
[INFO] loading_backend: DepthAnything3 (custom da3)
[INFO] device: npu:0, dtype: torch.float16
[INFO] task: depth-estimation (metric depth)
[INFO] architecture: DINOv2 ViT-L + DPT head
[INFO] model loaded in 3.52s
[INFO] param_device: npu:0
[INFO] input: dummy PIL image 504x504x3, seed=42, process_res=504
[INFO] input_tensor shape: (1, 1, 3, 504, 504) dtype torch.float32
[RESULT] depth shape: (1, 1, 504, 504)
[RESULT] depth dtype: torch.float32 device: npu:0
[RESULT] depth stats: min 0.642681 max 0.719793 mean 0.690193 std 0.015691
[RESULT] sky shape: (1, 1, 504, 504) stats min 0.000000 max 0.306783 mean 0.000152
[PERF] inference latency (ms): avg 29.58 min 29.49 max 29.68 p50 29.57 p90 29.66 p95 29.67
[PERF] throughput: 33.80 images/s (batch 1)
[INFO] PASS: NPU inference completed successfully[VALIDATE] CPU-NPU consistency check
[VALIDATE] diff max 0.002084 mean 0.001269
[VALIDATE] PASS: CPU-NPU consistency within tolerancemodel.model(tensor),比较 depth 的逐像素绝对误差torch.npu.is_available()=True, device_name=Ascend910_9362, torch_npu_version=2.9.0.post1所有计时在 torch.npu.synchronize() 前后测量,预热 3 次,正式 10 次,batch size 1,process_res 504,dtype fp16:
model.model 延迟即上述数值,若含 inference.py 全流程约 30-35ms测试命令:
python inference.py --mode benchmarkassets/agent_workflow.png: 阶段日志 (下载、侦察、加载、NPU 推理、验证、性能)assets/npu_device_call.png: npu-smi info + torch.npu.is_available() + 设备名assets/model_result.png: python inference.py 真实终端输出working/models/depth-anything-DA3METRIC-LARGE (1.3GB),离线环境无法自动下载depth-anything-3 源码 (/tmp/da3/src) 已通过 PYTHONPATH 注入,未打包进仓;若 clean 环境需手动 git cloneplyfile, trimesh, moviepy, open3d, evo, e3nn, gsplat, pycolmap 已在推理脚本中 mock,仅保留核心深度推理,3D 高斯导出 (export_format=glb/gs_ply) 不可用scipy 未安装时姿态插值警告但不影响单图深度Hardware: NPU, NPU, Ascend, Ascend910