Git Product home page Git Product logo

age-gender-pred's Introduction

Age Gender Prediction

This repository is used for finding and predicting from an image one or multiple human's gender and age(confidence scores provided for both age and gender). 94% acc for gender and MAE of 4.2 for age can be achieved after just 32 epochs of training.

Example

Requirements

  • python3, pytorch
  • pip3 install --upgrade opencv-python, dlib, imutils, skimage
  • Download FaceAligner and save shape_predictor_68_face_landmarks.dat in models/
  • Download FaceDetector and save mmod_human_face_detector.dat in models/

Usage

Predicting images in val/ folder

  1. train the model using python train.py, weight will be stored in models/
  2. or download pretrained weight from url[pending]
  3. put your test image in pics/val/
  4. run python evaluate.py

Real-time Prediction

call eval_live() function in evaluate.py

Train/Test Pipeline

Example

Train

  1. Using cleaned IMDB-WIKI dataset[1] for training (IMDB-WIKI dataset contains 50%+ mislabeled images[2]).
  2. Using FG-NET dataset[3] for testing.
  3. Train a model based on ResNet-18,
    • the output is 2 neuron represents probs of male&female plus 100 neurons represents probs of being age 0-99.
    • auto detect if use GPU or even multiple GPUs for training.
    • auto reduce learning rate when we have no loss reduce on val dataset for >N epochs.
    • auto freeze CNN laters and train only last FCN layers when first epoch.
    • auto load and save weights, log training loss and metadatas after each epoch.
    • more detains can be found on src file train.py and configuration file config.ini

Test

  1. detect and align faces using dlib.
  2. predict age, gender and confidence scores(probability of each gender and variance of age).

Reference

[1] Rothe R, Timofte R, Van Gool L. Deep Expectation of Real and Apparent Age from a Single Image Without Facial Landmarks [J/OL]. International Journal of Computer Vision. 126 (2). 2018, Apr: 144–157.

[2] Antipov G, Baccouche M, Berrani S-A et al. Effective training of convolutional neural networks for face-based gender and age prediction [J/OL]. Pattern Recognition. 72. 2017, December: 15–26.

[3] Panis G, Lanitis A, Tsapatsoulis N et al. Overview of research on facial ageing using the FG-NET ageing database [J]. IET Biometrics. 5 (2). 2016: 37–46.

Contact

Feel free to mail [email protected] for any pretrained weight or quetsions and bug report about this repo :)

age-gender-pred's People

Contributors

naayaaa avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.