SkillAgentSearch skills...

Agender

Real-time estimation of gender and age

Install / Use

/learn @diovisgood/Agender

README

<p align="left"> <a href="https://www.python.org/"> <img src="https://ForTheBadge.com/images/badges/made-with-python.svg" alt="python"></a> &nbsp; <br /> <a href="https://opensource.org/licenses/MIT"> <img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square" alt="MIT license"></a> &nbsp; </p>

Agender Project

This is a small demo project to try and test OpenCV library and also implement on-the-fly face detection, age and gender estimation using pre-trained models.

This article can also be found on medium.

What do you do when you want to try something new in deep learning? Of course you search for articles and open-source projects first!

Existing Open-Source Projects for Gender and Age Estimation

Disclaimer: There are many more projects that are not listed here. But I believe I have covered the most popular ones, that appear at first pages of search results.

How did I search

I have googled for:

  • gender age estimation
  • gender age opencv
  • gender age keras
  • gender age tensorflow
  • gender age caffemodel
  • gender age pytorch

I was looking at one or two first pages of results only. Then I excluded:

  • articles with restricted access,
  • projects without source code,
  • projects with source code written in other than python language,
  • projects that perform only age or gender estimation, not both,
  • project duplicates or copies.

After that I dig into source code to find details of input image format, output format, model architecture, weight size, license, pre-trained model availability, etc.

List of existing projects

Here is what I've found for the topic:

  1. Age and Gender Classification using MobileNets by Kinar Ravishankar.

    • Source code: https://github.com/KinarR/age-gender-estimator-keras
    • License: MIT
    • Framework: Keras/TensorFlow
    • Input: RGB images of any size, author used: 224x224x3
    • Output:
      • gender: two binary classes: Male and Female, choose maximum.
      • age: 21 class, use softmax, choose maximum and multiply it's index by 4.76, which gives you roughly [0 - 100] years interval.
    • Model weights size: we can estimate it as this model is based on MobileNet_v1_224, followed by one Dense(1024->1024) layer plus two output Dense(1024->1) layers. So there are approximately (4.24 MP + 1.05 MP) = 5.29 MP (=Million Parameters). Which is about 21 Mb for float32.
    • Pre-trained model available: NO
  2. How to build an age and gender multi-task predictor with deep learning in TensorFlow by Cole Murray

    • Source code: https://github.com/ColeMurray/age-gender-estimation-tutorial
    • License: unspecified
    • Framework: TensorFlow
    • Input: RGB images224x224x3
    • Output:
      • gender: two binary classes: Male and Female, choose maximum.
      • age: vector of 101 classes probabilities for ages [0..100], choose maximum or use weighted sum
    • Model weights size: we can estimate it from model architecture: Conv(5x5, 3->32) -> MaxPool(2->1) -> Conv(5x5, 32->64) -> MaxPool(2->1) -> Conv(5x5, 64->128) -> MaxPool(2->1) -> Dense(28*28*128 -> 1024) -> Dense(1024 -> 101), Dense(1024 -> 2). 2400 + 51200 + 204800 + 102760448 + 103424 + 2048 = 103.1MP Which is approximately 393 Mb.
    • Pre-trained model available: NO
  3. Predicting apparent Age and Gender from face picture : Keras + Tensorflow by Youness Mansar

    • Source code: https://github.com/CVxTz/face_age_gender
    • License: MIT
    • Framework: Keras/TensorFlow
    • Input: RGB images 224x224x3
    • Output:
      • gender: one number in range [0..1], where 0 = Female, 1 = Male.
      • age: 8 classes [0..2], [4..6], [8..12], [15..20], [25..32], [38..43], [48..53], [60..100], use softmax, choose maximum.
    • Model weights size: We can estimate it from model architecture: ResNet50 -> Dense(100) -> Dense(1). Approximately: 100 Mb.
    • Pre-trained model available: NO
  4. SSR-Net: A Compact Soft Stagewise Regression Network for Age Estimation by Tsun-Yi Yang, Yi-Hsuan Huang, Yen-Yu Lin, Pi-Cheng Hsiu, Yung-Yu Chuang.

    • Source code: https://github.com/shamangary/SSR-Net
    • Third party source code: https://github.com/shamangary/SSR-Net
    • License: Apache License 2.0
    • Framework: Keras/TensorFlow
    • Input: RGB images 64x64x3
    • Output:
      • gender: one number in range [0..1], where 0 = Female, 1 = Male.
      • age: one number
    • Model weights size:
      • gender: 0.32 Mb,
      • age: 0.32 Mb,
    • Pre-trained model available: YES
    • Last models update: Apr 2018
  5. Mxnet version implementation of SSR-Net for age and gender estimation by @wayen820

    • Source code: https://github.com/wayen820/gender_age_estimation_mxnet
    • License: unspecified
    • Framework: MXNET
    • Input: RGB image 112x112x3
    • Output:
      • gender: one number in range [0..1], where 0 = Female, 1 = Male.
      • age: one number
    • Model weights size:
      • gender: 3.94 Mb
      • age: 1.95 Mb
    • Pre-trained model available: YES
    • Last models update: Oct 2018
  6. Age and Gender Classification Using Convolutional Neural Networks by Gil Levi and Tal Hassner.

    • Source code: https://github.com/GilLevi/AgeGenderDeepLearning
    • License: as is
    • Framework: Caffe. But models could be loaded with OpenCV.
    • Input: 256x256x3
    • Output:
      • gender: two binary classes: Male and Female, choose maximum.
      • age: 8 classes: [0..2], [4..6], [8..12], [15..20], [25..32], [38..43], [48..53], [60..100], use softmax, choose maximum.
    • Model weights size:
      • gender: 43.5 Mb,
      • age: 43.5 Mb.
    • Pre-trained model available: YES, separate models for gender and age.
    • Last models update: Sep 2017
  7. Age and Gender Deep Learning with TensorFlow by Rude Carnie (? Daniel Pressel)

    • Source code: https://github.com/dpressel/rude-carnie
    • License: unspecified
    • Framework: TensorFlow
    • Input: RGB images 256x256x3
    • Output:
      • gender: two binary classes: Male and Female, choose maximum.
      • age: 8 classes: [0..2], [4..6], [8..12], [15..20], [25..32], [38..43], [48..53], [60..100], use softmax, choose maximum.
    • Model weights size:
      • gender: inception_v3 based model - 166 Mb,
      • age: inception_v3 based model - 166 Mb.
    • Pre-trained model available: YES, separate networks for gender and age.
    • Last models update: Apr/Feb 2017
  8. Easy Real time gender age prediction from webcam video with Keras by Chengwei Zhang

    • Source code: https://github.com/Tony607/Keras_age_gender
    • License: unspecified
    • Framework: Keras/TensorFlow
    • Input: RGB images 64x64x3. Possibly, any size can be chosen.
    • Output:
      • gender: one number [0..1], where 1 means Female,
      • age: vector of 101 classes probabilities for ages [0..100], choose maximum or use weighted sum
    • Model weights size: 186 Mb.
    • Pre-trained model available: YES
    • Last model update: Jan 2018
  9. Age and Gender Estimation by Yusuke Uchida

    • Source code: https://github.com/yu4u/age-gender-estimation
    • License: MIT
    • Framework: Keras/TensorFlow
    • Input: RGB image of any size. Author used 32x32x3
    • Output:
      • gender: one number [0..1], where 1 means Female,
      • age: vector of 101 classes probabilities for ages [0..100], choose maximum or use weighted sum
    • Model weights size: 187 Mb.
    • Pre-trained model available: YES
    • Last models update: Feb 2018
  10. Age and gender estimation based on Convolutional Neural Network and TensorFlow by Boyuan Jiang

    • Source code: https://github.com/BoyuanJiang/Age-Gender-Estimate-TF
    • License: MIT
    • Framework: TensorFlow
    • Input: RGB image 160x160x3
    • Output:
      • gender: one number, 0 = Female, 1 = Male.
      • age: one number
    • Model weights size: 246.5 Mb.
    • Pre-trained model available: YES
    • Last models update: Nov 2017
  11. Apparent Age and Gender Prediction in Keras by Sefik Ilkin Serengil

    • Source code: https://github.com/serengil/tensorflow-101/blob/master/python/age-gender-prediction-real-time.py and also https://github.com/serengil/tensorflow-101/blob/master/python/gender_prediction.ipynb
    • License: unspecified
    • Framework: Keras/TensorFlow
    • Input: RGB image 224x224x3
    • Output:
      • gender: one number, 0 = Woman, 1 = Man
      • age: vector of 101 classes probabilities for ages [0..100], choose maximum or use weighted sum
    • Model weights size:
      • gender: 553 Mb
      • age: *514 Mb
View on GitHub
GitHub Stars159
CategoryDevelopment
Updated6mo ago
Forks39

Languages

Python

Security Score

77/100

Audited on Oct 7, 2025

No findings