siyan824/profusion_pr (HuggingFace)model.safetensors (2.16 GB, 约 540M 参数 fp32) + config.json({}) + profusion_pr.pth(等价)model.safetensors 逆向重建等价推理结构 (modeling_profusion.py)。| 模块 | 结构 | 说明 |
|---|---|---|
patch_embed.proj | Conv2d(3 → 1024, kernel=16, stride=16) | 图像 patch 化 → 1024 维 token |
enc_blocks | 24 × Block(1024) | 自注意力 (qkv=3072×1024, proj=1024×1024) + MLP(fc1=4096, fc2) + LayerNorm×2 |
enc_norm | LayerNorm(1024) | 编码器输出归一化 |
ponit_embedder | Conv2d(3 → 768, kernel=16, stride=16) | 点云网格 patch 化 → 768 维 token(原文拼写 ponit=point) |
void_pe_token | [1, 1, 768] 可学习参数 | "空视图"位置编码 token |
decoder_embed | Linear(1024 → 768) | 编码器特征投影到解码器维度 |
mv_dec_blocks1 | 12 × MVDecoderBlock(768) | 自注意力 + cross_attn(projq/projk/projv/proj) + MLP(fc1=3072) + LayerNorm(norm1/norm2/norm3/norm_y) |
mv_dec_blocks2 | 12 × MVDecoderBlock(768) | 同上,第二解码器堆栈 |
dec_norm | LayerNorm(768) | 解码器输出归一化 |
pose_downstream_head2 | proj(768→1024) + more_mlps(1024) + res_conv(2× 1×1 残差卷积) + fc_rot(→9) + fc_t(→3) | 位姿回归头:旋转矩阵(9D) + 平移(3D) |
image (RGB 224×224) point_grid (合成 3 通道点云网格)
│ patch_embed │ ponit_embedder
▼ [B,196,1024] ▼ [B,196,768]
enc_blocks(24) → enc_norm ┌───┘
│ decoder_embed ▼
▼ [B,196,768] context query = cat([point_tokens, void_pe_token]) → [B,197,768]
mv_dec_blocks1(12) (自注意力 + 对图像 context 的交叉注意力)
mv_dec_blocks2(12)
dec_norm → 均值池化 [B,768]
pose_downstream_head2 → rotation [B,3,3] + translation [B,3]npu:1。.to("npu:1")。load_state_dict(strict=False): missing=0, unexpected=0,897 个 tensor 全部真实加载。torch.inference_mode(),结束 torch.npu.synchronize(),输出 .cpu() 序列化。pip install -r requirements.txt
# CLI 推理 (单图, 默认 npu:1)
python inference.py --img test_input.png --device npu:1 --output_json result.json
# FastAPI 服务
NPU_DEVICE=npu:1 python inference.py --serve --port 8005
curl -s -F "file=@test_input.png" http://127.0.0.1:8005/predict{
"pred_pose": {
"rotation_3x3": [[...],[...],[...]],
"rotation_angle_deg": 119.3052,
"rotation_axis": [-0.50832, -0.76487, 0.39572],
"translation_xyz": [0.98081, -0.32433, 0.10136]
},
"architecture": { "encoder_depth": 24, "decoder_depth_1": 12, "decoder_depth_2": 12 },
"inference_ms": 261.69,
"model": "siyan824/profusion_pr",
"requested_device": "npu:1",
"actual_device": "npu:1",
"npu_name": "Ascend910_9362",
"exit_status": 0
}assets/agent_workflow.png — NPU 环境部署 / 依赖安装 / 权重加载 / 服务启动assets/npu_device_call.png — python inference.py --img ... 命令行推理成功assets/model_result.png — FastAPI /predict 返回推理结果inference.py — 昇腾 NPU 推理入口(CLI + FastAPI 双模式)modeling_profusion.py — 按权重键名逆向重建的 ProFusion 模型inspect_weights.py — 权重键/形状检查工具requirements.txt — 依赖清单test_input.png — 单图推理验证输入assets/ — 适配证据截图