g
gyccc/prithivMLmods-Deep-Fake-Detector-Model-NPU
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

prithivMLmods/Deep-Fake-Detector-Model on Ascend NPU

1. 简介

本项目将 prithivMLmods/Deep-Fake-Detector-Model 模型适配到昇腾 NPU (Ascend910B) 上运行。

  • 模型架构: SiglipForImageClassification
  • 基模型: google/siglip2-base-patch16-512
  • 任务类型: 二分类图像分类(Deepfake 检测)
  • 类别: Fake / Real
  • 输入尺寸: 224 x 224 RGB
  • 框架: PyTorch + Transformers
  • 权重来源: ModelScope snapshot_download 本地加载

2. 验证环境

项目版本/信息
NPU 驱动npu-smi 25.5.2
NPU 设备Ascend910_9362
Python3.11.14
PyTorch(环境自带)
torch_npu(环境自带)
transformers4.50.0

NPU 健康状态: OK

3. 推理运行

pip install -r requirements.txt
python inference.py

推理结果 (NPU Top-2):

  • Top-1: Real (0.795800)
  • Top-2: Fake (0.204200)

完整推理日志 (logs/inference.log):

=== prithivMLmods/Deep-Fake-Detector-Model NPU Inference ===
Model: prithivMLmods/Deep-Fake-Detector-Model
Loader type: transformers
Input shape: torch.Size([1, 3, 224, 224])
Output shape: torch.Size([1, 2])
Num classes: 2

NPU Top-2 Predictions:
  Top-1: Real (0.795800)
  Top-2: Fake (0.204200)

All class probabilities:
  Fake: 0.204200
  Real: 0.795800

4. 精度验证

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

指标数值
max_abs_error0.000496
mean_abs_error0.000280
relative_error0.0281%
cosine_similarity1.000000
threshold1.0%
结果PASS
  • CPU Top-1: Real
  • NPU Top-1: Real
  • CPU Top-2: Real, Fake
  • NPU Top-2: Real, Fake
  • Top-1 match: True
  • Top-2 match: True

5. 性能参考

指标数值
avg latency5.8971 ms
min latency(见 logs/benchmark.log)
max latency(见 logs/benchmark.log)
p50 latency(见 logs/benchmark.log)
p90 latency(见 logs/benchmark.log)
p95 latency(见 logs/benchmark.log)
images/sec169.58

测试配置: warmup 2 次 + 正式 10 次,单卡 NPU。

6. 精度评测说明

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

7. 自验证截图

见 screenshots/self_verification.png。

8. 日志文件

日志说明
logs/env_check.logNPU 环境检查
logs/inference.logNPU 推理输出
logs/accuracy.logCPU-NPU 精度一致性
logs/benchmark.logNPU 性能基准测试

9. 注意事项

  1. 权重通过 ModelScope snapshot_download 下载,不提交到仓库。
  2. 推理时使用 local_files_only=True 避免 HuggingFace 自动下载。
  3. 测试图片为随机网络图片,实际性能可能因输入不同而略有差异。

10. 标签

#NPU #Ascend #Ascend910 #SigLIP #ImageClassification #DeepfakeDetection