g
gcw_C8PI9e90/facial-age-detection-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Facial Age Detection - NPU 适配

Model Info

  • Original Model: prithivMLmods/facial-age-detection
  • Architecture: SiglipForImageClassification (SigLIP2 fine-tuned)
  • Parameters: 92,890,376
  • Labels: 8 age groups
    IDGroup
    0age 01-10
    1age 11-20
    2age 21-30
    3age 31-40
    4age 41-55
    5age 56-65
    6age 66-80
    7age 80+

Environment

ComponentVersion
PyTorch2.9.0
torch_npu2.9.0.post1
Ascend CANN8.5.1
NPUAscend 910B4 (29.5GB)
Transformers4.57.6

Files

FileDescription
inference.pySingle-image age inference + benchmark
accuracy_run.pyCPU vs NPU accuracy validation
accuracy_run_perf.pyNPU performance benchmark
result.jsonSample inference result
accuracy_report.jsonAccuracy validation report
perf_report.jsonPerformance benchmark report

Usage

Single Image Inference

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

Performance Benchmark

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

Performance Results (Ascend 910B4)

MetricValue
Avg Latency11.14 ms
Median Latency11.08 ms
P90 Latency11.20 ms
P99 Latency12.20 ms
Min Latency10.97 ms
Max Latency12.77 ms
Throughput89.78 img/s

Sample Output

{
  "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 Distribution Details

Age GroupConfidence
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%

First inference includes JIT compilation overhead (~16s). Subsequent inferences average ~11ms.