Giter Club home page Giter Club logo

age-estimation-pytorch's Introduction

Age Estimation PyTorch

PyTorch-based CNN implementation for estimating age from face images. Currently only the APPA-REAL dataset is supported. Similar Keras-based project can be found here.

Requirements

pip install -r requirements.txt

Demo

Webcam is required. See python demo.py -h for detailed options.

python demo.py

Using --img_dir argument, images in that directory will be used as input:

python demo.py --img_dir [PATH/TO/IMAGE_DIRECTORY]

Further using --output_dir argument, resulting images will be saved in that directory (no resulting image window is displayed in this case):

python demo.py --img_dir [PATH/TO/IMAGE_DIRECTORY] --output_dir [PATH/TO/OUTPUT_DIRECTORY]

Train

Download Dataset

Download and extract the APPA-REAL dataset.

The APPA-REAL database contains 7,591 images with associated real and apparent age labels. The total number of apparent votes is around 250,000. On average we have around 38 votes per each image and this makes the average apparent age very stable (0.3 standard error of the mean).

wget http://158.109.8.102/AppaRealAge/appa-real-release.zip
unzip appa-real-release.zip

Train Model

Train a model using the APPA-REAL dataset. See python train.py -h for detailed options.

python train.py --data_dir [PATH/TO/appa-real-release] --tensorboard tf_log

Check training progress:

tensorboard --logdir=tf_log

Training Options

You can change training parameters including model architecture using additional arguments like this:

python train.py --data_dir [PATH/TO/appa-real-release] --tensorboard tf_log MODEL.ARCH se_resnet50 TRAIN.OPT sgd TRAIN.LR 0.1

All default parameters defined in defaults.py can be changed using this style.

Test Trained Model

Evaluate the trained model using the APPA-REAL test dataset.

python test.py --data_dir [PATH/TO/appa-real-release] --resume [PATH/TO/BEST_MODEL.pth]

After evaluation, you can see something like this:

100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:08<00:00,  1.28it/s]
test mae: 4.800

age-estimation-pytorch's People

Contributors

yu4u 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.