Shipped
Multi-attribute face detection
A Faster R-CNN face detector that predicts age range, gender, and expression. It started as a four-person undergraduate thesis comparing ResNet-50 and MobileNetV3 backbones, in which I built most of the model architecture. I am now improving the MobileNetV3 version.
stack: Python, PyTorch, torchvision, Faster R-CNN
Problem
Detect every face in an image and predict three attributes for each one: age range, gender, and expression. No single dataset had all three labels.
Approach
Faster R-CNN with a modified RoI head: each detected face gets one bounding box plus a label for each of the three attributes, instead of one box per class. Non-maximum suppression and the loss were changed to match. The thesis compared a ResNet-50 backbone against MobileNetV3, both starting from COCO-pretrained weights.
This was a team thesis. Vito Xavier led the research design and methodology. I built most of the model architecture, implemented the algorithms, and did data analysis. Kenny Nathaniel wrote the literature review and also worked on data analysis. Abram Setyo Prabowo supported the technical work and validated the findings.
Training data: a balanced subset of 6,000 LAGENDA images for age range and gender, and 1,200 hand-picked ExpW (Expression in-the-Wild) images for expression, since the full ExpW set has inaccurate boxes and class imbalance. Neither dataset has all three labels, so each image gets placeholder values for the labels it lacks. To fit the available compute, training ran in three stages of about 2,000 images each.
The work is published as a paper at ICIMTech 2025: Multi-Task Face Attribute Detection with ResNet50 and MobileNetV3 Backbones in Faster R-CNN.
Since the thesis, I have been reworking the MobileNetV3 model on my own to improve its accuracy. ResNet-50 is dropped from that work. The MobileNetV3 model is still being improved. Each version so far has a tab below with its recorded runs and scores, and its own rows in the results tables.
Demo: recorded runs
The model the bachelor's thesis ended with, re-measured on the same test sets as the later versions. Expression trained only a final layer on frozen features, and the code had bugs that affected both training and the reported scores.
Fixed the thesis code's bugs, cleaned both datasets and trimmed each to about 10,000 faces, then retrained all three tasks together from base weights. Gender and expression rose sharply; age and face box tightness fell below the thesis weights.
Same network, new training: unlabelled faces count as faces instead of background, inputs are larger, and the box loss weight is fixed. Age, gender and face boxes rose more than at any other step, and expression only slightly.
A dedicated face head replaces the background class in each attribute head. Gender and expression improved on v2, age and face boxes came out slightly lower, and it has the best mean over the three tasks of any version.
- Face 1: Age range (50-59) 36%Gender Male 65%Expression Happy 12%
- Face 1: Age range (40-49) 39%Gender Male 91%Expression Fear 21%
- Face 1: Age range (20-29) 36%Gender Male 52%Expression Fear 16%
- Face 1: Age range (40-49) 36%Gender Male 90%Expression Angry 25%
- Face 1: Age range (40-49) 36%Gender Male 76%Expression Fear 13%
- Face 1: Age range (40-49) 37%Gender Male 85%Expression Fear 20%
- Face 1: Age range (10-19) 47%Gender Female 89%Expression Disgust 20%
- Face 1: Age range (10-19) 37%Gender Female 90%Expression Happy 17%
- Face 1: Age range (20-29) 27%Gender Male 56%Expression Angry 19%
- Face 1: Age range (30-39) 40%Gender Male 53%Expression Fear 17%
- Face 1: Age range (>=70) 82%Gender Male 91%Expression Angry 22%
- Face 1: Age range (30-39) 33%Gender Male 70%Expression Fear 26%
- Face 1: Age range (40-49) 36%Gender Male 87%Expression Happy 26%
- Face 1: Age range (>=70) 54%Gender Male 96%Expression Sad 63%
- Face 1: Age range (30-39) 28%Gender Female 98%Expression Happy 90%
- Face 1: Age range (40-49) 36%Gender Male 100%Expression Sad 51%
- Face 1: Age range (40-49) 30%Gender Male 91%Expression Happy 49%
- Face 1: Age range (>=70) 80%Gender Female 61%Expression Sad 40%
- Face 1: Age range (0-9) 43%Gender Female 100%Expression Sad 31%
- Face 1: Age range (>=70) 46%Gender Female 84%Expression Sad 36%
- Face 1: Age range (30-39) 36%Gender Male 99%Expression Neutral 31%
- Face 1: Age range (40-49) 76%Gender Male 100%Expression Happy 56%
- Face 1: Age range (>=70) 71%Gender Male 93%Expression Disgust 47%
- Face 1: Age range (30-39) 72%Gender Male 100%Expression Neutral 73%
- Face 1: Age range (40-49) 47%Gender Male 97%Expression Happy 46%
- Face 1: Age range (>=70) 85%Gender Male 99%Expression Neutral 48%
- Face 1: Age range (30-39) 35%Gender Female 100%Expression Happy 87%
- Face 1: Age range (50-59) 52%Gender Male 100%Expression Disgust 53%
- Face 1: Age range (30-39) 48%Gender Male 100%Expression Neutral 94%
- Face 1: Age range (50-59) 44%Gender Male 85%Expression Disgust 42%
- Face 1: Age range (20-29) 52%Gender Female 100%Expression Happy 52%
- Face 1: Age range (20-29) 79%Gender Female 86%Expression Happy 98%
- Face 1: Age range (20-29) 69%Gender Male 100%Expression Neutral 91%
- Face 1: Age range (40-49) 66%Gender Male 100%Expression Disgust 42%
- Face 1: Age range (>=70) 51%Gender Male 100%Expression Disgust 76%
- Face 1: Age range (20-29) 81%Gender Male 100%Expression Neutral 96%
- Face 1: Age range (40-49) 85%Gender Male 54%Expression Angry 72%
- Face 1: Age range (50-59) 65%Gender Male 100%Expression Disgust 100%
- Face 1: Age range (40-49) 62%Gender Female 100%Expression Happy 98%
- Face 1: Age range (40-49) 81%Gender Male 100%Expression Disgust 89%
- Face 1: Age range (30-39) 93%Gender Male 100%Expression Neutral 97%
- Face 1: Age range (40-49) 60%Gender Female 100%Expression Angry 100%
- Face 1: Age range (20-29) 53%Gender Female 100%Expression Neutral 89%
- Face 1: Age range (20-29) 55%Gender Female 100%Expression Happy 91%
- Face 1: Age range (20-29) 85%Gender Male 100%Expression Happy 93%
- Face 1: Age range (50-59) 72%Gender Male 100%Expression Disgust 64%
- Face 1: Age range (>=70) 92%Gender Male 100%Expression Disgust 100%
- Face 1: Age range (20-29) 90%Gender Male 100%Expression Neutral 100%
- transform , done 4.864 ms Photo at 800 × 534 px, padded to a square of 800 px, then scaled to 800 × 800 and normalized
- backbone , done 43.124 ms MobileNetV3 with FPN: a 25 × 25 feature map of 256 channels. Brighter cells respond more strongly
- rpn , done 6.414 ms 10 region proposals that might hold a face
- roi_heads , done 4.671 ms 1 box with a face score above 0.1, at most 30
- postprocess , done 0.049 ms Boxes mapped back to the photo; 1 at or above this version's display threshold of 0.5
- total 59.122 ms
The model is still being improved.
- Finding faces (ExpW) Thesis not measured. The thesis weights were not measured on ExpW face boxes. v3.1 64%
- Finding faces (Lagenda) Thesis 53% v3.1 71%
- Gender Thesis 23% v3.1 57%
- Expression (7 kinds) Thesis 3% v3.1 26%
- Age (8 ranges) Thesis 13% v3.1 18%
Results and evaluation
Results per version
Every version is measured on the same held-out reporting sets with the same metric, so these rows compare like for like. “Thesis weights, re-measured” is the thesis model run on those sets, not the paper’s figures.
| Row | mAP@0.50:0.95 | mAP@0.50 | Precision | Recall | F1 |
|---|---|---|---|---|---|
| Thesis weights, re-measured | 0.132 | 0.190 | 0.233 | 0.318 | 0.260 |
| v1 | 0.099 | 0.158 | 0.253 | 0.290 | 0.268 |
| v2 | 0.186 | 0.243 | 0.246 | 0.399 | 0.298 |
| v3.1 | 0.180 | 0.235 | 0.214 | 0.389 | 0.275 |
Source: Test runs of each version on the held-out Lagenda reporting set.
| Row | mAP@0.50:0.95 | mAP@0.50 | Precision | Recall | F1 |
|---|---|---|---|---|---|
| Thesis weights, re-measured | 0.230 | 0.350 | 0.390 | 0.551 | 0.445 |
| v1 | 0.326 | 0.576 | 0.572 | 0.679 | 0.620 |
| v2 | 0.555 | 0.742 | 0.441 | 0.806 | 0.557 |
| v3.1 | 0.570 | 0.763 | 0.422 | 0.819 | 0.556 |
Source: Test runs of each version on the held-out Lagenda reporting set.
| Row | mAP@0.50:0.95 | mAP@0.50 | Precision | Recall | F1 |
|---|---|---|---|---|---|
| Thesis weights, re-measured | 0.031 | 0.101 | 0.211 | 0.247 | 0.198 |
| v1 | 0.220 | 0.322 | 0.428 | 0.457 | 0.420 |
| v2 | 0.233 | 0.334 | 0.382 | 0.472 | 0.392 |
| v3.1 | 0.261 | 0.381 | 0.390 | 0.502 | 0.421 |
Source: Test runs of each version on the held-out ExpW reporting set.
| Row | mAP@0.50:0.95 | mAP@0.50 | Precision | Recall | F1 |
|---|---|---|---|---|---|
| Thesis weights, re-measured | 0.531 | 0.839 | 0.619 | 0.895 | 0.732 |
| v1 | 0.453 | 0.827 | 0.733 | 0.869 | 0.795 |
| v2 | 0.712 | 0.959 | 0.487 | 0.979 | 0.650 |
| v3.1 | 0.709 | 0.961 | 0.500 | 0.974 | 0.661 |
Source: Test runs of each version on the held-out Lagenda reporting set.
| Row | mAP@0.50:0.95 | mAP@0.50 | Precision | Recall | F1 |
|---|---|---|---|---|---|
| Thesis weights, re-measured | not measured | not measured | not measured | not measured | not measured |
| v1 | 0.626 | 0.957 | 0.849 | 0.973 | 0.907 |
| v2 | 0.650 | 0.979 | 0.657 | 0.992 | 0.791 |
| v3.1 | 0.640 | 0.984 | 0.695 | 0.992 | 0.817 |
Source: Test runs of each version on the held-out ExpW reporting set.
not measured: The thesis weights were not measured on ExpW face boxes.
Precision, recall, and F1 count only detections that score above a fixed threshold of 0.1. v2 and v3.1 find more faces than v1, but they also keep more low-confidence boxes above that threshold. So their precision, and with it their F1, is lower than v1’s even though their mAP is much higher. mAP ranks detections by confidence and does not depend on the threshold, so it is the main metric here.
Thesis results, as reported in the paper
These are the multi-task MobileNetV3 results from Table I of the paper. The paper also reports ResNet-50, which is left out here because the improved model drops it. Scores are COCO-style mAP at an IoU of 0.50 and averaged over 0.50 to 0.95, plus precision, recall, and F1. For those last three, a detection counts as correct when its box reaches an IoU of 0.50 and its label matches. Each model is scored at the epoch with its highest precision.
The paper used other test splits and older metric code than the per-version tables, so treat its table as a reference point, not a like-for-like comparison. Two of its figures are wrong. Its expression F1 does not follow from its own precision and recall, so it is left out here. Its expression mAP@0.50:0.95 equals its mAP@0.50, which a correct metric cannot give.
| Row | mAP@0.50:0.95 | mAP@0.50 | Precision | Recall | F1 |
|---|---|---|---|---|---|
| Age range | 0.0971 | 0.1331 | 0.1402 | 0.3202 | 0.1645 |
| Gender | 0.1587 | 0.2353 | 0.1779 | 0.3019 | 0.2199 |
| Expression | 0.0471 | 0.0471 | 0.1440 | 0.1550 | · |
The paper did not report speed or size. They stay empty here rather than estimated.
| Row | Latency | Model size |
|---|---|---|
| MobileNetV3 | not measured | not measured |
not measured: The paper did not report this.
What changed in each version
Thesis
The thesis model is a Faster R-CNN with a MobileNetV3 backbone that finds faces and predicts age, gender and expression for each one. Expression trained only a linear layer on frozen features. These are the thesis weights re-measured on the same held-out sets and metric as v1 to v3, so all four versions compare like for like. The paper's own figures came from other test splits and older metric code.
v1
v1 fixes the thesis code's bugs. ExpW face boxes had been read from the wrong columns, and evaluation could score the wrong task's labels. Each detection now carries all three predictions under one face score. A face detector plus manual review removed broken and misplaced boxes from both datasets, and images that copied an evaluation image left the training set. New held-out sets separate choosing the best epoch from reporting. Training starts from ImageNet/COCO weights instead of the thesis checkpoints, which may have seen evaluation images, and one model learns age, gender and expression at once. Gender and expression rose sharply, expression most of all. Age and face box tightness fell below the thesis weights; the data analysis after v1 found why, and v2 addresses it.
v2
Same network, different training. Lagenda faces with no age or gender label used to train as background, which taught the model that real faces are not faces; v2 trains them as faces of unknown class. Inputs are larger, because the median Lagenda face was tiny at the old size. Each sample is a whole image with all its faces, faces without annotations are ignored rather than counted as background, and training adds horizontal flips and mixed precision. The box loss had been divided by three times too much, and that is fixed. Age, gender and face box tightness rose sharply. Expression rose only slightly, because most ExpW images hold one face, so these fixes changed little for it.
v3.1
Same data and training recipe as v2; the classification heads change. In v1 and v2 each attribute head also had a background class, so three heads each learned whether a box is a face. v3.1 has one face-or-background output, and the attribute heads choose only among their own classes. An intermediate version, v3, also trained age with an ordinal loss. Its age got worse and it over-predicted the youngest bins, and the follow-up run showed the ordinal loss caused that, not the face head. So v3.1 keeps the face head and trains age with a plain softmax, as v2 did. Compared with v2, gender and expression improved. Age and face boxes came out slightly lower. v3.1 has the best mean over the three tasks of any version, and its training kept improving until the last epoch.
Model card and limitations
The labels are the datasets’ categories, not facts about the people in an image. Gender is a two-label visual guess and says nothing about how anyone identifies. Age is a coarse bin.
In the thesis model, the reported probabilities are low, often under 0.2, because each softmax also covers the background class. Read them as a ranking between labels, not as calibrated confidence. Postprocessing applies a score threshold to the age task only. v1 and v2 compute their probabilities the same way. In v3.1, the face head gives the probability that a box is a face. Each class’s probability is that face probability times the attribute head’s probability for the class. The gallery shows the probabilities unchanged as whole percentages. It draws a face only when its face score clears that version’s threshold. For Thesis, v1, and v2 the face score is the mean non-background probability of the age and gender heads; for v3.1 it is the face head’s probability.
The thesis results have no breakdown by group, so how the model performs across age, gender, or skin tone is unknown.
Images with several faces are the hard case. On a small hand-picked set of single-person images, both thesis models scored markedly higher than on the full test set.
Age range and expression score lowest in every version’s results, so read those labels in the gallery as weak guesses.
Trade-offs I made
- Only MobileNetV3 carries forward: in the paper it scored higher than ResNet-50 on age range and gender, and it is cheaper to run.
- Recorded runs instead of uploads: the gallery replays runs recorded once on licensed images, so the site needs no inference server.
How it runs in production
The gallery shows recorded runs of each version, generated once on a CPU and served as static files.
Paper and data credits
- Paper: V. Xavier, R. D. Susilo, K. Nathaniel, and A. S. Prabowo, “Multi-Task Face Attribute Detection with ResNet50 and MobileNetV3 Backbones in Faster R-CNN”, 2025 International Conference on Information Management and Technology (ICIMTech), IEEE, pp. 674-679. DOI 10.1109/ICIMTECH67074.2025.11265049.
- LAGENDA by the Layer Team, licensed under CC BY 2.0 (dataset page). A subset was used for training. The authors ask to cite: M. Kuprashevich and I. Tolstykh, “MiVOLO: Multi-input Transformer for Age and Gender Estimation”, arXiv:2307.04616, 2023; and M. Kuprashevich, G. Alekseenko, and I. Tolstykh, “Beyond Specialization: Assessing the Capabilities of MLLMs in Age and Gender Estimation”, arXiv:2403.02302, 2024.
- ExpW (Expression in-the-Wild) from Z. Zhang, P. Luo, C. C. Loy, and X. Tang, “From Facial Expression Recognition to Interpersonal Relation Prediction”, arXiv:1609.06426, 2016 (project page). A subset was used for training.