Giter Club home page Giter Club logo

ageestimateadience's Introduction

AgeEstimateAdience

Age and Gender Estimation Using Convolutional Neural Network with Adience Dataset

Note

This project will focus on age and gender prediction using Adience dataset. The purpose of this project is to construct and demo popular CNN network architectures using Tensorflow with image classification task.

(Currently I'm updating a improved version of training script.) Refer to another branch to see old training scripts.

Prerequisites

  • Python3
  • Tensorflow 1.0 or higher
  • OpenCV
  • Jupyter Notebook
  • h5py

Getting Started

To Download the Entire Adience Dataset:

http://www.openu.ac.il/home/hassner/Adience/data.html

Preprocessing

  • Make_Dataset_For_Aligned.ipynb Jupyter Notebook used to compress the entire Adience Dataset(aligned.tar.gz version)

  • Make_Dataset_For_Faces.ipynb Jupyter Notebook used to compress the entire Adience Dataset(faces.tar.gz version, which contains landmark infos)

Note: Both Jupyter Notebooks use BGR mode for image reading and contain channel-wise mean calculation and mean image calculation. The train script uses channel-wise mean subtraction as preprocessing technique.

While both channel-wise mean subtraction and mean image subtraction are two of the popular preprocessing techniques, I would suggest to try channel-wise mean subtraction first if the backgrounds of the images in your dataset have a lot of variations. If preprocessing images from the source like a static camera(which has a high chance of "common background"), mean image is the way to go.

It should also be noted that VGG-Face model uses a BGR mean of [93.5940, 104.7624, 129.1863] for channel-wise mean subtraction, which is calculated originally from VGG-Face Dataset.

CNN Network

Three networks architectures implementations are provided: GilNet, AlexNet and VGG-16. Check out papers for to see the architectures for each CNN:

- GilNet: http://www.openu.ac.il/home/hassner/projects/cnn_agegender/CNN_AgeGenderEstimation.pdf

- AlexNet: http://www.cs.toronto.edu/~fritz/absps/imagenet.pdf

- VGG-Face: http://www.robots.ox.ac.uk/~vgg/publications/2015/Parkhi15/parkhi15.pdf

Training

Local Adience Database I/O Iterator

  • data_helper.py A simple script used for h5py database iteration, batch generation.

Training and Testing

  • train.py A simple script for model training and testing
  usage: train.py [-h] [--dataset_file DATASET_FILE]
  		[--folder_to_test FOLDER_TO_TEST]
  		[--dropout_keep_prob DROPOUT_KEEP_PROB]
  		[--weight_decay WEIGHT_DECAY] [--learning_rate LEARNING_RATE]
  		[--batch_size BATCH_SIZE] [--num_epochs NUM_EPOCHS]
  		[--evaluate_every EVALUATE_EVERY]
  		[--enable_moving_average [ENABLE_MOVING_AVERAGE]]
  		[--noenable_moving_average]

  optional arguments:
    -h, --help            show this help message and exit
    --dataset_file DATASET_FILE
  			Path for the h5py dataset.
    --folder_to_test FOLDER_TO_TEST
  			No. of folder to be tested (default: 1)
    --dropout_keep_prob DROPOUT_KEEP_PROB
  			Dropout keep probability (default: 0.5)
    --weight_decay WEIGHT_DECAY
  			Weight decay rate for L2 regularization (default:
  			5e-4)
    --learning_rate LEARNING_RATE
  			Starter Learning Rate (default: 1e-2)
    --batch_size BATCH_SIZE
  			Batch Size (default: 128)
    --num_epochs NUM_EPOCHS
  			Number of training epochs (default: 200)
    --evaluate_every EVALUATE_EVERY
  			Evaluate model on dev set after this many steps
  			(default: 50)
    --enable_moving_average [ENABLE_MOVING_AVERAGE]
  			Enable usage of Exponential Moving Average (default:
  			True)
    --noenable_moving_average

Real-Time Prediction

-_- Filling this place later

Reference

New Train Script and data iterator from Convolutional Neural Network for Text Classification

Image Dataset Compression

ย Pre-trained VGG-Face Model

Original Implementation of VGG-16 ConvNet

ageestimateadience's People

Contributors

cjiang2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ageestimateadience's Issues

Pretrained model

Can you please share the model you converted from caffe to tensorflow?

Pre-trained model and prediction code

Hey thanks for the useful information on training VGG face network for age estimation.
Is it possible for you to send pre-trained age-gender model along with a prediction code? I'm not getting how to train pre-trained VGG face network weight for age-gender as I'm new to ML and I have been asked to develop this application.

Thank you in advance..

Where are these files

FileNotFoundError: [Errno 2] No such file or directory: '30601258@N03/landmarks.1.10399646885_67c7d20df9_o.txt'

Error 215:Assertion Failed

Getting this error when I run the Make_Dataset_For_Aligned.ipynb.

error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-52oirelq\opencv\modules\imgproc\src\resize.cpp:3929: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

Haven't changed anything from the default code and can't seem to wrap my head around it. Is it an OpenCV version issue as i'm on 4.4.0.

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.