depth-anything/DA3METRIC-LARGE 是 ByteDance Seed 发布的 Depth Anything 3 Metric Large 模型,专为单目度量深度估计(monocular metric depth estimation)设计。基于 ViT-L backbone (DinoV2) + DPT head,参数量 334M (1.245 GiB safetensors),支持真实尺度深度预测(metric depth),输入任意单张 RGB 图,输出稠密深度图(H×W float32,单位米),附带 sky 分割掩码,适用于自动驾驶、3D 重建、AR 等需真实尺度几何的任务。
DepthAnything3Net = DinoV2 ViT-L (out_layers [4,11,17,23], dim 1024) + DPT head (features 256, out_channels [256,512,1024,1024], output_dim 1)depth-anything/DA3METRIC-LARGE (config.json + model.safetensors, 1.245 GiB, pipeline_tag depth-estimation)/tmp/da3metric (model.safetensors 1.245 GiB, config.json 847 B), 权重 SHA 来源 HuggingFace 4010e39f3634a45bc60553321fb49fb760bd594enpu:0 上完成端到端推理,CPU 同权重同输入 smoke consistency,对比深度图 abs diff。pip install -r requirements.txt
# 需预先安装 CANN 与 torch_npu,本机已内置
# 源码在项目根已 vendor depth_anything_3,无需额外 clone或手动:
git clone https://github.com/ByteDance-Seed/depth-anything-3
pip install -e ./depth-anything-3 --no-deps
pip install torch torchvision einops huggingface_hub safetensors pillow opencv-python addict omegaconf默认命令(单图 1208×680 → process_res 504 → 输出 280×504 metric depth):
python inference.py
# 或显式
python inference.py --device npu:0
# 其他模式
python inference.py --mode validate # CPU vs NPU 一致性 + benchmark
python inference.py --mode benchmark # 仅 NPU 性能输入: sample.png (assets/examples/SOH/000.png, 1091690 B) 或任意 PIL Image / 文件路径。预处理: upper_bound_resize 到长边 504,再 pad 到 PATCH_SIZE 14 倍数,ImageNet Normalize。
NPU (npu:0, Ascend910_9362, torch.float32, autocast bfloat16 forward):
CPU (同权重, process_res 224, 合成图 seed 42):
smoke consistency,固定种子 42 的 224×224 随机图,process_res 224,同一权重 FP32,同预处理 (ImageNet normalize, upper_bound_resize)。
完整 504 图因 CPU 耗时 >200s 未做全量一致性,仅 smoke 224 验证;NPU 504 结果与官方预期尺度一致(室内 SOH 场景 2–13m)。
torch.npu.synchronize() 包围计时,batch=1, process_res=504, 图片 1208×680 → [1,3,280,504] (N=1 view)。
assets/agent_workflow.png — 完整工作流 (下载/解包/加载/NPU 推理/验证/性能)assets/npu_device_call.png — npu-smi 与 torch.npu 设备调用证据 (npu:0, Ascend910_9362, param device)assets/model_result.png — python inference.py 默认输出 (depth 8.49 mean, PASS)depth_anything_3 源码 (已 vendor 到仓库),依赖 pycolmap/gsplat 已 mock,不影响 metric depth 核心;Hardware: NPU, NPU, Ascend, Ascend910, depth-estimation, metric-depth, DA3, VisionTransformer, DPT