g
gcw_C8PI9e90/facial-age-detection-npu
模型介绍文件和版本Pull Requests讨论分析

Facial Age Detection - NPU 适配

模型信息

  • 原始模型:prithivMLmods/facial-age-detection
  • 网络结构:SiglipForImageClassification(基于 SigLIP2 微调)
  • 参数量:92,890,376
  • 标签:8 个年龄组
    ID年龄组
    001-10 岁
    111-20 岁
    221-30 岁
    331-40 岁
    441-55 岁
    556-65 岁
    666-80 岁
    780+ 岁

环境配置

组件版本
PyTorch2.9.0
torch_npu2.9.0.post1
Ascend CANN8.5.1
NPUAscend 910B4(29.5GB)
Transformers4.57.6

文件说明

文件描述
inference.py单图像年龄推理 + 性能基准测试
accuracy_run.pyCPU 与 NPU 精度验证
accuracy_run_perf.pyNPU 性能基准测试
result.json推理结果样例
accuracy_report.json精度验证报告
perf_report.json性能基准测试报告

使用方法

单图像推理

python3 inference.py \
  --model_path /path/to/facial-age-detection \
  --image /path/to/face.jpg \
  --output result.json

性能基准测试

python3 accuracy_run_perf.py /path/to/facial-age-detection 10 perf_report.json

性能结果(Ascend 910B4)

指标数值
平均延迟11.14 ms
中位数延迟11.08 ms
P90 延迟11.20 ms
P99 延迟12.20 ms
最小延迟10.97 ms
最大延迟12.77 ms
吞吐量89.78 img/s

示例输出

{
  "predicted_label": "age 01-10",
  "probabilities": [
    0.7402, 0.0839, 0.0309, 0.0442,
    0.0405, 0.0281, 0.0281, 0.0040
  ],
  "inference_time_ms": 16138.77
}

年龄分布详情

年龄组置信度
age 01-1074.02% ✅
age 11-208.39%
age 21-303.09%
age 31-404.42%
age 41-554.05%
age 56-652.81%
age 66-802.81%
age 80+0.40%

首次推理包含 JIT 编译开销(约 16 秒)。后续推理平均耗时约 11 毫秒。

下载使用量0