HRNet+OCR 天空变化检测模型,基于 HRNet 骨干网络和 OCR(Object-Contextual Representations)模块,用于天空区域分割。该模型是天空替换 pipeline 的核心组件,能够准确识别图像中的天空区域。
| 指标 | 值 |
|---|---|
| Cosine Similarity | 1.000005 |
| MaxAbsErr | 0.002669 |
| Relative Error | 0.2783% |
| 平均延迟 | 28.24 ms |
| 峰值显存 | 0.68 GB |
| 推理精度 | float32 |
| 设备 | Ascend 910B4 |
| 组件 | 版本 |
|---|---|
| CANN | 8.5.1 |
| torch_npu | 2.9.0.post1 |
| PyTorch | 2.9.0 |
| Python | 3.11 |
# 设置环境
source setup_env.sh
# 运行推理 (CPU vs NPU 对比)
python3 inference.py --device npu:0NPU 推理输出(float32, sky mask 对比):
模型: damo/cv_hrnetocr_skychange
设备: npu:0
------------------------------------------------------------
Input shape: torch.Size([1, 3, 904, 1600])
[CPU] 加载模型...
[CPU] 推理中...
CPU mask shape: torch.Size([1, 1, 320, 320])
[NPU] 加载模型到 npu:0...
[NPU] 推理中...
NPU mask shape: torch.Size([1, 1, 320, 320])
Cosine Similarity: 1.000005
MaxAbsErr: 0.002669
Relative Error: 0.2783%
✓ 推理完成
[Perf] 测延迟...
平均延迟: 28.24 ms
峰值显存: 0.68 GB| 指标 | CPU (float32) | NPU (float32) | 误差 |
|---|---|---|---|
| Cosine Similarity | 基准 | 1.000005 | < 0.001% |
| MaxAbsErr | - | 0.002669 | - |
| Relative Error | - | 0.2783% | < 1% ✓ |
| 输出维度 | [1, 1, 320, 320] | [1, 1, 320, 320] | 一致 |
| NaN | False | False | 一致 |
详见 screenshots/verification.txt。
本适配由 Ascend NPU 适配 Agent Skill 自动完成。