
Age Group Detection
Three approaches to the same classification problem, measured honestly.
- Year
- 2025
- Role
- Research and implementation
- Stack
- Python · PyTorch · scikit-learn · ResNet18
This one has no interface and was never meant to. It ran from a notebook — a demonstration rather than a product, included because the method is the point.
The problem
Four-class age-group classification, which is less a modelling problem than a comparison problem: the interesting question is not whether a deep model beats a classical one, but by how much, at what cost, and on which failure cases.
The approach
Three pipelines built to be compared like for like.
- HOG + SVM — the classical baseline.
- MLP — a shallow learned representation.
- ResNet18 — transfer learning from a pretrained backbone.
Identical splits, identical preprocessing, identical metrics.
The result
| Model | Accuracy | Macro F1 | Inference | Size |
|---|---|---|---|---|
| HOG + SVM | 0.7106 | 0.7008 | 0.02 ms | 0.10 MB |
| HOG + MLP | 0.7294 | 0.7181 | 0.02 ms | 10.41 MB |
| ResNet18 | 0.7871 | 0.7796 | 19.91 ms | 42.72 MB |
ResNet18 wins by roughly eight points over the classical baseline, and pays for it with a thousandfold increase in inference time and four hundred times the model size. Whether that trade is worth making depends entirely on where the thing has to run — which is the answer the comparison existed to produce.
What was hard
Class imbalance across the age bands, and resisting the temptation to report the accuracy figure that flattered the model I'd spent the most time on.
What I'd change
The comparison is sound and the reporting around it is thin. Accuracy and macro F1 across four classes hide the thing that matters most — which classes each model confuses, and whether all three fail on the same faces. A confusion matrix per model would have said more than any of the headline figures, and it is the first thing I would add.
The repository reports no per-class breakdown and no treatment of the class imbalance beyond acknowledging it. That is the real gap. Macro F1 is chosen precisely because it does not let a majority class carry the score, but choosing a fairer metric is not the same as addressing the imbalance, and I would not want the metric to be mistaken for a fix.
The largest omission is bias. Age classification from faces is known to perform unevenly across skin tone and gender, and I did not measure it. Any conclusion here about which model is better is a conclusion about aggregate accuracy on one dataset, which is a much narrower claim than it looks — and on this particular task, the narrower claim is the only one worth making.