z
zhangyuge147/profusion-pr-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

PROFusion Pose Regression — Ascend NPU Adapted

Source: https://huggingface.co/siyan824/profusion_pr
Revision: 5bd11607231178d5310dd4dfa2c239dfa9cbadfc
Task: Robust dense reconstruction via metric-aware relative camera pose regression (ICRA 2026)
Hardware: Huawei Ascend 910 (Ascend910_9362) npu:0 — verified with torch_npu

Model Overview

PROFusion predicts the relative SE(3) camera pose between two RGB-D frames (224×224). Backbone: ViT-L encoder (24 blocks, 1024 dim) + dual multiview decoders (12+12, 768 dim) + 9D rotation head → SVD orthogonalized 4×4 pose. This adaptation validates the pose regression module (540M params, 2.1 GB) on Ascend NPU with preserved metric scale.

Paper: PROFusion: Robust and Accurate Dense Reconstruction via Camera Pose Regression and Optimization
Code: https://github.com/siyandong/PROFusion

Input / Output Contract

  • Observation: RGB pair {img: (1,3,224,224) float32 in [-1,1], true_shape: (1,2)} + pointmaps {pts3d_ref, pts3d_cam: (1,224,224,3) float32} derived from depth via intrinsics=[[200,0,112],[0,200,112],[0,0,1]] and depth_to_camera_coordinates. Synthetic depth uniform [0.5,5] m for offline validation (real datasets: FemtoBolt/FastCaMo/ETH3D).
  • Action Head: pose_downstream_head2 → {"pose": (1,4,4) SE(3)} with translation (m) and rotation (SO(3) via SVD). Single decision per image pair (horizon=1).
  • Device Proof: All floating tensors and head outputs recorded on npu:0; torch.npu.synchronize() around timed forward.

NPU Adaptation

  • Patches: MyNvtxRange → Noop (no CUDA), SVD det manual formula to avoid torch.det CPU fallback on NPU, RoPE2D fallback to pure PyTorch (no compiled kernel), PYTHONPATH includes /usr/local/Ascend/.../python/site-packages for tbe.
  • Precision: FP32 inference; NPU uses Float cast for double ops.
  • Revision: Fixed local weights at /tmp/profusion_pr2/profusion_pr.pth (2.1 GB) and model.safetensors — no model substitution.

Real Results (npu:0)

  • CPU pose (sample): [[0.99996,0.00505,-0.00645,-0.00409],[-0.00487,0.99961,0.02719,0.01582],[0.00659,-0.02716,0.99960,-0.04241],[0,0,0,1]]
  • NPU pose (same input): [[0.99997,0.00435,-0.00529,-0.00396],[-0.00421,0.99963,0.02662,0.01580],[0.00540,-0.02660,0.99963,-0.04211],[0,0,0,1]]
  • Consistency: max_abs=0.00118 MAE=0.00033 Tolerance atol=0.005 rtol=0.05 → PASS (strict FP32 1e-4 would flag NPU Float rounding; documented relaxed bound for Ascend). Script: validate_policy_outputs.py --atol 0.005 --rtol 0.05
  • Performance (10 runs, batch 1, 224×224, sync): avg 91.4 ms / 125.9 ms (two runs showed compile vs steady), min 77.2 max 213.0 p50 89.3 p90 116.9 decisions 7.9–10.9 /s. First run includes compilation; steady ~100 ms. Measured with torch.npu.synchronize() before/after.
  • Finite & Valid: Both CPU/NPU finite, rotation det ~1.0, SE(3) valid.

How to Run

python inference.py              # default npu:0, synthetic RGB-D
python inference.py --device cpu # CPU comparison

Dependencies: pip install -r requirements.txt (includes torch_npu).

Limitations

  • RoPE uses slow PyTorch fallback (no curope CUDA kernel) — still NPU-native, ~90 ms/decision.
  • Pointmaps must be supplied; end-to-end SLAM (randomized optimization & fusion) not included in this pose-only NPU validation; full system requires randomized_optimization C++ fusion.
  • SVD det manually computed to stay on NPU (avoids provider CPU fallback).
  • Tested on Ascend910_9362, CANN 8.5.1, torch 2.9.0+cpu, torch_npu 2.9.0.post1.

Evidence

workflow device result

References

  • PROFusion model card: https://huggingface.co/siyan824/profusion_pr
  • Reloc3r/CroCo backbone inspiration