{"id":16609357,"url":"https://github.com/willbrennan/ageregression","last_synced_at":"2025-10-29T16:32:47.220Z","repository":{"id":43574119,"uuid":"274006686","full_name":"WillBrennan/AgeRegression","owner":"WillBrennan","description":"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.","archived":false,"fork":false,"pushed_at":"2021-03-23T23:14:10.000Z","size":1730,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-21T11:19:43.060Z","etag":null,"topics":["age-estimation","convolutional-neural-networks","deep-learning","pytorch","regression-models","torchvision"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WillBrennan.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-22T00:37:41.000Z","updated_at":"2024-02-21T11:30:02.000Z","dependencies_parsed_at":"2022-07-11T03:47:27.678Z","dependency_job_id":null,"html_url":"https://github.com/WillBrennan/AgeRegression","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2FAgeRegression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2FAgeRegression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2FAgeRegression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2FAgeRegression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WillBrennan","download_url":"https://codeload.github.com/WillBrennan/AgeRegression/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219857408,"owners_count":16556062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["age-estimation","convolutional-neural-networks","deep-learning","pytorch","regression-models","torchvision"],"created_at":"2024-10-12T01:28:51.343Z","updated_at":"2025-10-29T16:32:41.785Z","avatar_url":"https://github.com/WillBrennan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Age Regression\n## Overview\nI 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.\n\nIn 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.\n\n![Age Regression](https://raw.githubusercontent.com/WillBrennan/AgeRegression/master/pretrained/age_regression.png)\n\n## Getting Started\nThis project uses conda to manage its enviroment; once conda is installed we create the enviroment and activate it, \n```bash\nconda env create -f enviroment.yml\nconda activate age_regression\n```\n. On windows; powershell needs to be initialised and the execution policy needs to be modified. \n```bash\nconda init powershell\nSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\n```\n\n. This repo uses git-lfs to store the models, make sure the git-lfs files have been pulled using, \n\n```bash\ngit lfs pull\n```\n\nTo run age prediction on a directory of images run, \n\n```bash\npython evaluate_images.py --model pretrained/model_age_regression_resnext101_20.pth --images ~/code/datasets/faces/val\n```\n\n## Performance\nWhen 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. \n\n![joint_plot](https://raw.githubusercontent.com/WillBrennan/AgeRegression/master/pretrained/joint_plot.png)\n\nWe 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. \n\n![gt_ages_dist](https://raw.githubusercontent.com/WillBrennan/AgeRegression/master/pretrained/gt_ages_dist.png)\n![pred_ages_dist](https://raw.githubusercontent.com/WillBrennan/AgeRegression/master/pretrained/pred_ages_dist.png)\n\n\nWhen 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 \u003c15 also have lower MAE, possibly because they're easier cases.\n\n![mae_for_age](https://raw.githubusercontent.com/WillBrennan/AgeRegression/master/pretrained/mae_for_age.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillbrennan%2Fageregression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillbrennan%2Fageregression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillbrennan%2Fageregression/lists"}