模型名称: businesslion/scaffdiff
模型链接: HuggingFace | AtomGit 镜像
模型描述: ScaffDiff 是一款面向 3D 场景补全的单步、支架引导的扩散模型。基于 SemanticKITTI 数据集,它通过局部点云输入完成完整 3D 场景重建。
模型架构:
参数规模: 约 124M(VAE:7.1M + Denoiser:6.4M + Encoder:108M,冻结)
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| numpy | >= 1.20 | 数值计算 |
| open3d | >= 0.13 | 点云处理(可选) |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch-npu==2.9.0.post1
pip install numpy open3d# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"方式一:AtomGit 镜像(推荐,HuggingFace 下载较慢时使用)
# 权重文件已包含在 HuggingFace 镜像中
# 使用 hf-mirror 下载:
export HF_ENDPOINT=https://ai.gitcode.com/hf_mirrors
huggingface-cli download businesslion/scaffdiff --local-dir ./scaffdiff_ckpt方式二:HuggingFace
huggingface-cli download businesslion/scaffdiff --local-dir ./scaffdiff_ckpt# VAE 推理 (点云编码-解码)
python inference.py \
--checkpoint-type vae \
--model-path checkpoints/best_point_vae.pth \
--device npu \
--num-frames 3
# Teacher Denoiser 推理 (单步去噪)
python inference.py \
--checkpoint-type teacher-ft \
--model-path checkpoints/teacher_v2gt_ft/best_model.pth \
--device npu \
--num-frames 1| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --checkpoint-type | str | 必填 | 模型类型: vae 或 teacher-ft |
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --device | str | cpu | 推理设备: cpu 或 npu |
| --num-frames | int | 1 | 推理帧数 |
# 启动 VAE 推理服务
python inference.py \
--checkpoint-type vae \
--model-path checkpoints/best_point_vae.pth \
--device npu \
--num-frames 1单条推理:
python inference.py \
--checkpoint-type vae \
--model-path checkpoints/best_point_vae.pth \
--device npu \
--num-frames 1批量推理:
python inference.py \
--checkpoint-type vae \
--model-path checkpoints/best_point_vae.pth \
--device npu \
--num-frames 8教师去噪器推理:
python inference.py \
--checkpoint-type teacher-ft \
--model-path checkpoints/teacher_v2gt_ft/best_model.pth \
--device npu \
--num-frames 1[VAE] Loading checkpoint from checkpoints/best_point_vae.pth ...
[WARN] Missing keys (2): ['centering_mean', 'centering_std']...
[VAE] Config: num_latent_tokens=32, num_decoded_points=8000, internal_dim=256
[VAE] Parameters: 7,107,523 (7.11M)
Frame 0: MSE=0.055769, MeanDist=0.3776, Time=118.2ms, OutputShape=(1, 3, 8000)
[RESULT] VAE inference completed: 1 frame(s)
[SUCCESS] ScaffDiff inference completed on Ascend910_9362[Teacher] Loading checkpoint from checkpoints/teacher_v2gt_ft.pth ...
[Teacher] Denoiser loaded: missing=50, unexpected=212
[Teacher] Parameters: 6,407,043 (6.41M)
Frame 0: DeltaMean=0.0564, DeltaStd=0.5046, Time=1244.4ms, OutputShape=(1, 20000, 3)
[RESULT] Teacher denoiser inference completed: 1 frame(s)[基准测试] 3帧 VAE 推理统计:
Frame 0: MSE=0.064385, MeanDist=0.4055, Time=65.7ms
Frame 1: MSE=0.055322, MeanDist=0.3772, Time=4.5ms
Frame 2: MSE=0.062160, MeanDist=0.3990, Time=4.7ms
平均MSE: 0.0606
平均耗时: 25.0ms/frame (首帧后 4.6ms)运行命令:
python inference.py --checkpoint-type vae --model-path checkpoints/best_point_vae.pth --device npu --num-frames 1输出:
[INFO] Device: Ascend910_9362 (npu)
[INFO] Checkpoint: checkpoints/best_point_vae.pth (81.5 MB)
[VAE] Loading checkpoint from checkpoints/best_point_vae.pth ...
[VAE] Config: num_latent_tokens=32, num_decoded_points=8000, internal_dim=256, num_dec_blocks=5
[VAE] Parameters: 7,107,523 (7.11M)
Frame 0: MSE=0.061752, MeanDist=0.3977, Time=146.5ms, OutputShape=(1, 3, 8000)
[RESULT] VAE inference completed: 1 frame(s)
[SUCCESS] ScaffDiff inference completed on Ascend910_9362运行命令:
python inference.py --checkpoint-type teacher-ft --model-path checkpoints/teacher_v2gt_ft.pth --device npu --num-frames 1输出:
[INFO] Device: Ascend910_9362 (npu)
[INFO] Checkpoint: checkpoints/teacher_v2gt_ft.pth (448.2 MB)
[Teacher] Denoiser loaded: missing=50, unexpected=212
[Teacher] Parameters: 6,407,043 (6.41M)
Frame 0: DeltaMean=0.0564, DeltaStd=0.5046, Time=1244.4ms, OutputShape=(1, 20000, 3)
[RESULT] Teacher denoiser inference completed: 1 frame(s)
[SUCCESS] ScaffDiff inference completed on Ascend910_9362


测试数据: 随机生成点云(SemanticKITTI 格式)
评测指标:
| 指标 | 结果 | 说明 |
|---|---|---|
| VAE 重建 MSE | 0.0606(平均) | 3 帧平均 |
| VAE 平均点距离 | 0.391(平均) | 3 帧平均 |
| VAE 推理速度 | 约 25.0 ms/帧 | Ascend 910(首帧 118 ms) |
| 教师去噪器 ΔMean | 0.0564 | 单步 t=200 |
| 教师去噪器速度 | 约 1244 ms/帧 | Ascend 910 |
评测命令:
python inference.py --checkpoint-type vae --model-path checkpoints/best_point_vae.pth --device npu --num-frames 3torch.randn_like 格式警告: 使用 base format 替代 internal format(非关键问题)sonata 包。当前推理使用简化版 PointNet 编码器替代