基于 Video Depth Anything (VDA) 的绝对深度蒸馏工程。
该仓库将原始“视频相对深度”能力改造为“单图输入 + 物理尺度输出”的流程,用于稳定地生成绝对深度结果并支持时序对比分析。
- 保留 VDA 的边缘与相对几何表征能力。
- 使用 Depth Pro 作为绝对深度教师信号。
- 通过轻量
Scale MLP Head预测每帧尺度参数。 - 当前映射采用倒数后线性仿射:
D_abs = s * (1 / max(D_vda, eps)) + t
说明:四列分别为 RGB、Depth-Pro、VDA 倒数(0-255后映射到Depth-Pro显示范围)、多场景训练后的 VDA Absolute;两行为两个不同场景样本。
说明:该图展示当前 checkpoint 在 cam19/cam20 上的 MSE 对比,以及标签拟合残差与训练最优验证损失摘要。
VDA-Absolute-Depth-Distillation/
├── VDA_Absolute_Distillation/
│ ├── configs/distill_config.yaml
│ ├── data_prep/
│ ├── core_engine/
│ ├── models/
│ └── inference_abs_vda.py
├── scripts/
│ ├── make_strategy_compare_4cols_shared_scale.py
│ ├── make_temporal_compare_video.py
│ └── draw_vda_kd_architecture_paper_simple.py
├── docs/
│ ├── Agent_VDA_Absolute_Distillation-CN.md
│ ├── vda_pipeline.md
│ ├── depth_pro_pipeline.md
│ └── output_inventory.md
└── artifacts/
├── architecture/vda_kd_architecture_paper_simple_clean.png
├── qualitative/depth_visual_comparison_2scene_4cols_shared_scale.png
└── experiments/experimental_comparison_summary.png
推荐在 Linux + CUDA 环境运行,核心依赖:
python >= 3.10torchopencv-pythonnumpypyyamlmatplotlib
并确保配置中的外部路径可用(VDA 原仓库、Depth Pro 仓库、数据集路径、权重路径)。
进入核心工程目录:
cd VDA_Absolute_Distillationpython data_prep/01_spatial_align.py \
--config configs/distill_config.yamlpython data_prep/02_extract_scale_labels.py \
--config configs/distill_config.yaml \
--plotpython core_engine/train_distill.py \
--config configs/distill_config.yaml \
--run-name run_cam00_01_04_05_19_20python inference_abs_vda.py \
--config configs/distill_config.yaml \
--checkpoint /media/a1/16THDD/YJY/VDA_Absolute_Distillation/runs/run_cam00_01_04_05_19_20/best.pt \
--input /media/a1/16THDD/XZB/DyNeRF/coffee_martini/images/cam00 \
--output-dir /media/a1/16THDD/YJY/VDA_Absolute_Distillation/infer/cam00_abs输出包括:
*.npy:绝对深度数组*.jpg:可视化图metadata.json:每帧scale/shift与路径信息
仓库 scripts/ 提供:
- 四列静态对比图(RGB / Depth-Pro / VDA 倒数 / 多场景模型输出)
- 时序视频生成(用于观察帧间稳定性)
- 架构图绘制(论文风格简化版)
示例(时序视频):
python scripts/make_temporal_compare_video.py \
--rgb-dir /path/to/images/cam00 \
--depth-pro-dir /path/to/raw_depth_pro_depth/cam00 \
--vda-dir /path/to/raw_vda_depth/cam00 \
--pred-dir /path/to/abs_pred/cam00 \
--output-video /path/to/out/compare_cam00.mp4 \
--output-metrics /path/to/out/compare_cam00_metrics.json- 默认只使用白名单相机目录;
cam02为空目录,应显式跳过。 - VDA 与 Depth-Pro 分辨率不一致时,需先做空间对齐或在流程中插值对齐。
- 单图改造后仍需满足
ensure_multiple_of=14的 patch 约束。 - 训练阶段冻结 VDA 主干与解码器,仅更新
Scale MLP Head。
- 项目规则与边界:
VDA_Absolute_Distillation/PROJECT_CHARTER_AND_GUIDELINES.md - 技术状态记录:
VDA_Absolute_Distillation/TECHNICAL_STATUS_2026-03-25.md - 总结报告(中文):
docs/Agent_VDA_Absolute_Distillation-CN.md
本仓库沿用 LICENSE 中的许可条款;如使用第三方模型与权重,请同时遵循其原始许可证。


