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
| ID | Group |
|---|
| 0 | age 01-10 |
| 1 | age 11-20 |
| 2 | age 21-30 |
| 3 | age 31-40 |
| 4 | age 41-55 |
| 5 | age 56-65 |
| 6 | age 66-80 |
| 7 | age 80+ |
Environment
| Component | Version |
|---|
| PyTorch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| Ascend CANN | 8.5.1 |
| NPU | Ascend 910B4 (29.5GB) |
| Transformers | 4.57.6 |
Files
| File | Description |
|---|
inference.py | Single-image age inference + benchmark |
accuracy_run.py | CPU vs NPU accuracy validation |
accuracy_run_perf.py | NPU performance benchmark |
result.json | Sample inference result |
accuracy_report.json | Accuracy validation report |
perf_report.json | Performance benchmark report |
Usage
Single Image Inference
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
| Metric | Value |
|---|
| Avg Latency | 11.14 ms |
| Median Latency | 11.08 ms |
| P90 Latency | 11.20 ms |
| P99 Latency | 12.20 ms |
| Min Latency | 10.97 ms |
| Max Latency | 12.77 ms |
| Throughput | 89.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 Group | Confidence |
|---|
| age 01-10 | 74.02% ✅ |
| age 11-20 | 8.39% |
| age 21-30 | 3.09% |
| age 31-40 | 4.42% |
| age 41-55 | 4.05% |
| age 56-65 | 2.81% |
| age 66-80 | 2.81% |
| age 80+ | 0.40% |
First inference includes JIT compilation overhead (~16s). Subsequent inferences average ~11ms.