xujiashuai/timm-cv_unet_video-deinterlace
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

cv_unet_video-deinterlace - Ascend NPU 适配

1. 模型简介

视频去场纹模型,基于 UNet 架构,包含频域去场纹模块 (DeinterlaceFre) 和多帧重建增强模块 (DeinterlaceEnh),用于去除隔行扫描视频中的场纹。

  • 原始模型: iic/cv_unet_video-deinterlace
  • 框架: PyTorch + ModelScope
  • 任务: Video Deinterlace (视频去场纹)
  • Backbone: UNet (frequency-domain + multi-frame enhancement)

2. 昇腾 NPU 适配结果

指标值
Cosine Similarity0.999986
Max Abs Error0.012915
平均延迟28.92ms
输出维度(1, 3, 64, 64)
推理精度float32
设备Ascend 910B4

3. 环境要求

组件版本
CANN8.5.1
torch_npu2.9.0.post1
PyTorch2.9.0
Python3.11
modelscopelatest

4. 快速使用

export ASCEND_HOME_PATH=/usr/local/Ascend/cann
export LD_LIBRARY_PATH=/usr/local/Ascend/cann/lib64:$LD_LIBRARY_PATH

python inference.py
python evaluate.py

5. 推理输出证据

Model: iic/cv_unet_video-deinterlace
Device: npu:0
Output shape: [1, 3, 64, 64]
Output sample: [0.07940101623535156, -0.05751371011137962, 0.07430489361286163, -0.14583489298820496, -0.07235150039196014]
Latency: 28.92ms

--- CPU vs NPU 精度对比 ---
Cosine Similarity: 0.999986
Max Abs Error: 0.012915
SUCCESS

6. CPU vs NPU 精度对比

指标CPU (float32)NPU (float32)误差
Cosine Similarity基准0.999986< 0.0001
Max Abs Error-0.012915-
输出维度(1, 3, 64, 64)(1, 3, 64, 64)一致

7. 模型结构

  • frenet: DeinterlaceFre - 频域去场纹 UNet (3-level encoder-decoder + FFT upsampling)
  • enhnet: DeinterlaceEnh - 多帧增强 UNet (4-level encoder-decoder + offset conv)
  • Input: 3 frames of RGB images (B, T=3, C=3, H, W)
  • Output: Restored frame (B, C=3, H, W)
  • NPU 适配要点: FFT complex tensor abs 操作需手动实现 (sqrt(real^2 + imag^2))