https://github.com/willbrennan/ageregression
AgeRegression tries to guess the age of a person from their photo! Its a basic example of how to use a CNN for regression in pytorch.
https://github.com/willbrennan/ageregression
age-estimation convolutional-neural-networks deep-learning pytorch regression-models torchvision
Last synced: 8 months ago
JSON representation
AgeRegression tries to guess the age of a person from their photo! Its a basic example of how to use a CNN for regression in pytorch.
- Host: GitHub
- URL: https://github.com/willbrennan/ageregression
- Owner: WillBrennan
- License: mit
- Created: 2020-06-22T00:37:41.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-23T23:14:10.000Z (about 5 years ago)
- Last Synced: 2024-04-21T11:19:43.060Z (about 2 years ago)
- Topics: age-estimation, convolutional-neural-networks, deep-learning, pytorch, regression-models, torchvision
- Language: Python
- Homepage:
- Size: 1.65 MB
- Stars: 15
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Age Regression
## Overview
I was at a supermarket buying wine and I used a self-checkout, suprisingly it didn't ask an assistant to verify my age! Then I noticed it had a camera in the bezzle. So then I wondered... could we estimate the age of a person from a picture of their face and to what degree of confidence.
In this project we attempt to estimate the age of a person from a picture of their face. We do this by training on [All-Ages-Faces-Dataset](https://github.com/JingchunCheng/All-Age-Faces-Dataset) and regress the age with a MSE loss. This dataset has a heavy racial bias, and impacts the models performance.

## Getting Started
This project uses conda to manage its enviroment; once conda is installed we create the enviroment and activate it,
```bash
conda env create -f enviroment.yml
conda activate age_regression
```
. On windows; powershell needs to be initialised and the execution policy needs to be modified.
```bash
conda init powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
. This repo uses git-lfs to store the models, make sure the git-lfs files have been pulled using,
```bash
git lfs pull
```
To run age prediction on a directory of images run,
```bash
python evaluate_images.py --model pretrained/model_age_regression_resnext101_20.pth --images ~/code/datasets/faces/val
```
## Performance
When we do a joint-plot between predicted and ground-truth age we can see the model has a strong correlation between the two but there are the occasional outliers.

We can see the dataset has a large age inbalance, mostly featuring samples from people 25~35. As we're trying to maximise our performance on this dataset its has been ignored. In the future, this dataset should be resampled before training to give a uniform age distribution.


When we plot the MAE at each age group. We can see our age group with the smallest MAE is 30-35 which corresponds to our predominant age-group in the dataset. Where we have very little data we can see larger prediction errors. Its possibly interesting that the groups for ages <15 also have lower MAE, possibly because they're easier cases.
