waylong/timm-convnext_base.clip_laion2b_augreg_ft_in12k_in1k-NPU
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

timm/convnext_base.clip_laion2b_augreg_ft_in12k_in1k on Ascend NPU

1. 简介

本项目将 timm/convnext_base.clip_laion2b_augreg_ft_in12k_in1k 图片分类模型适配到华为昇腾 NPU (Ascend910)。

模型来源:timm (PyTorch Image Models)
类别数:1000 (ImageNet-1k)
输入尺寸:224x224

2. 验证环境

  • 硬件:Ascend910 (NPU)
  • CANN:8.5.1
  • PyTorch:2.x
  • torch_npu:已安装
  • Python:3.11

3. 推理运行

pip install -r requirements.txt
python inference.py

推理结果 (NPU Top-5):

  • Top-1: class_623 (0.0062)
  • Top-2: class_644 (0.0059)
  • Top-3: class_21 (0.0055)
  • Top-4: class_600 (0.0053)
  • Top-5: class_512 (0.0053)

日志保存在 logs/inference.log。

4. 精度验证

对单张测试图片进行 CPU 与 NPU 一致性验证:

指标数值
max_abs_error0.011773
mean_abs_error0.003293
relative_error0.5994%
cosine_similarity0.999991
threshold1.0%
结果PASS
  • CPU Top-1: class_623
  • NPU Top-1: class_623
  • CPU Top-5: [623, 644, 21, 600, 512]
  • NPU Top-5: [623, 644, 21, 600, 512]
  • Top-1 match: True
  • Top-5 match: True

5. 性能参考

在单卡 Ascend910 NPU 上运行 10 次推理的统计结果:

指标数值
avg_latency_ms15.01
min_latency_ms14.98
max_latency_ms15.04
p50_latency_ms15.02
p90_latency_ms15.04
p95_latency_ms15.04
images_per_sec66.61

日志保存在 logs/benchmark.log。

6. 精度评测说明

本项目包含单图 smoke consistency 验证,非官方 ImageNet 完整验证集评测。详细指标见第 4 节。

7. 自验证截图

见 screenshots/self_verification.png 和 screenshots/self_verification.txt。

8. 日志文件

  • logs/env_check.log — NPU 环境检查
  • logs/inference.log — NPU 推理结果
  • logs/accuracy.log — CPU-NPU 精度一致性验证
  • logs/benchmark.log — 性能基准测试

9. 注意事项

  1. 权重通过 ModelScope snapshot_download 下载,不使用 HuggingFace 自动下载。
  2. timm.create_model(..., pretrained=False) 创建模型后,通过本地权重文件加载。
  3. 推理预处理使用 timm.data.resolve_model_data_config + create_transform,与训练时保持一致。
  4. 本项目不包含模型权重文件(*.bin / *.safetensors / *.pth / *.pt / *.ckpt / *.onnx)。

10. 标签

#NPU #Ascend #Ascend910 #timm #convnext #image-classification