All Projects → BoyuanJiang → Age Gender Estimate Tf

BoyuanJiang / Age Gender Estimate Tf

Licence: mit
Face age and gender estimate using TensorFlow

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Age Gender Estimate Tf

Deep-Learning-Course
Deep Learning with TensorFlow and Keras
Stars: ✭ 13 (-97.45%)
Mutual labels:  tensorflow-examples
Tensorflow Cookbook
Simple Tensorflow Cookbook for easy-to-use
Stars: ✭ 2,812 (+451.37%)
Mutual labels:  tensorflow-examples
Tensorflow chessbot
Predict chessboard FEN layouts from images using TensorFlow
Stars: ✭ 362 (-29.02%)
Mutual labels:  tensorflow-examples
tensorflow-practice
Tutorials of Tensorflow for beginners with popular data sets and projects. Let's have fun to learn Machine Learning with Tensorflow.
Stars: ✭ 93 (-81.76%)
Mutual labels:  tensorflow-examples
model-deployment
Examples showcasing model deployment
Stars: ✭ 17 (-96.67%)
Mutual labels:  tensorflow-examples
Zhihu
This repo contains the source code in my personal column (https://zhuanlan.zhihu.com/zhaoyeyu), implemented using Python 3.6. Including Natural Language Processing and Computer Vision projects, such as text generation, machine translation, deep convolution GAN and other actual combat code.
Stars: ✭ 3,307 (+548.43%)
Mutual labels:  tensorflow-examples
Dog-or-Cat-TensorflowSharp-Example
An example for TensorflowSharp - classify an image as a dog or cat.
Stars: ✭ 15 (-97.06%)
Mutual labels:  tensorflow-examples
Tensorflow Cmake
TensorFlow examples in C, C++, Go and Python without bazel but with cmake and FindTensorFlow.cmake
Stars: ✭ 418 (-18.04%)
Mutual labels:  tensorflow-examples
Tensorflow-lite-kotlin-samples
📌This repo contains the kotlin implementation of TensorflowLite Example Android Apps🚀
Stars: ✭ 17 (-96.67%)
Mutual labels:  tensorflow-examples
Cppflow
Run TensorFlow models in C++ without installation and without Bazel
Stars: ✭ 357 (-30%)
Mutual labels:  tensorflow-examples
food-vision-mobile-tensorflowjs
Food Vision project for mobile devices using TensorFlowJS
Stars: ✭ 19 (-96.27%)
Mutual labels:  tensorflow-examples
Android-Machine-Learning-With-TensorFlow
Tensor Flow implementation for Android
Stars: ✭ 17 (-96.67%)
Mutual labels:  tensorflow-examples
Tensorflow Resources
Curated Tensorflow code resources to help you get started with Deep Learning.
Stars: ✭ 330 (-35.29%)
Mutual labels:  tensorflow-examples
FaceEmotionClassifier
人脸识别与卡通化
Stars: ✭ 102 (-80%)
Mutual labels:  tensorflow-examples
Dr.sure
🏫DeepLearning学习笔记以及Tensorflow、Pytorch的使用心得笔记。Dr. Sure会不定时往项目中添加他看到的最新的技术,欢迎批评指正。
Stars: ✭ 365 (-28.43%)
Mutual labels:  tensorflow-examples
Tensorflow-Wide-Deep-Local-Prediction
This project demonstrates how to run and save predictions locally using exported tensorflow estimator model
Stars: ✭ 28 (-94.51%)
Mutual labels:  tensorflow-examples
Tf tutorial plus
Tutorials for TensorFlow APIs the official documentation doesn't cover
Stars: ✭ 293 (-42.55%)
Mutual labels:  tensorflow-examples
Docs
TensorFlow documentation
Stars: ✭ 4,999 (+880.2%)
Mutual labels:  tensorflow-examples
Daily Deeplearning
🔥机器学习/深度学习/Python/算法面试/自然语言处理教程/剑指offer/machine learning/deeplearning/Python/Algorithm interview/NLP Tutorial
Stars: ✭ 381 (-25.29%)
Mutual labels:  tensorflow-examples
Fire Detection Cnn
real-time fire detection in video imagery using a convolutional neural network (deep learning) - from our ICIP 2018 paper (Dunnings / Breckon) + ICMLA 2019 paper (Samarth / Bhowmik / Breckon)
Stars: ✭ 340 (-33.33%)
Mutual labels:  tensorflow-examples

Age and gender estimation based on Convolutional Neural Network and TensorFlow


UPDATE: There are some compatibility issues under python3 reported by others, recommend using python2 or you should adjust some codes manually

This is a TensorFlow implement of face age and gender estimation which first using dlib to detect and align faces in the picture and then using a deep CNN to estimate age and gender.As you can see below,this project can estimate more than one face in a picture at one time.

demo1 demo2

Dependencies

This project has following dependencies and tested under CentOS7 with Python2.7.14

  • tensorflow==1.4
  • dlib==19.7.99
  • cv2
  • matplotlib==2.1.0
  • imutils==0.4.3
  • numpy==1.13.3
  • pandas==0.20.3

Usage

Make tfrecords

In order to train your own models,you should first download imdb or wiki dataset,and then extract it under data path,after that,images path should look like

/path/to/project/data/imdb_crop/00/somepictures
/path/to/project/data/imdb_crop/01/somepictures
....
/path/to/project/data/imdb_crop/99/somepictures

Then you can run

python convert_to_records_multiCPU.py --imdb --nworks 8

to convert images to tfrecords.--imdb means using imdb dataset,--nworks 8 means using 8 cpu cores to convert the dataset parallelly.Because we will first detect and align faces in the pictures,which is a time consuming step,so we recommend to use as many cores as possible.Intel E5-2667 v4 and with 32 cores need approximately 50 minutes.

Train model

Once you have converted images to tfrecords,you should have the following path:

/path/to/project/data/train/train-000.tfrecords
......
/path/to/project/data/test/test-000.tfrecords
......

At present,our deep CNN uses FaceNet architecture,which based on inception-resnet-v1 to extract features.To speed up training,we use the pretrained model's weight from this project and have converted the weight to adapt our model,you can download this converted pretrained facenet weight checkpoint from here or here.Extract it to path models.

/path/to/project/models/checkpoint
/path/to/project/models/model.ckpt-0.data-00000-of-00001
/path/to/project/models/model.ckpt-0.index
/path/to/project/models/model.ckpt-0.meta

NOTE: This step is optional,you can also train your model from scratch. To start training,run

python train.py --lr 1e-3 --weight_decay 1e-5 --epoch 6 --batch_size 128 --keep_prob 0.8 --cuda

NOTE: Using the flag --cuda will train the model with GPU.

Using tensorboard to visualize learning

tensorboard --logdir=./train_log

train log

Test model

You can test all your trained models on testset through

python test.py --images "./data/test" --model_path "./models" --batch_size 128 --choose_best --cuda

Flag --cuda means using GPU when testing.--choose_best means testing all trained models and return the best one.If you just want to test the latest saved model,without this flag.

python test.py --images "./data/test" --model_path "./models" --batch_size 128 --cuda

One picture demo

If you just want to test the model on your own picture,run

python eval.py --I "./demo/demo.jpg" --M "./models/" --font_scale 1 --thickness 1

Flag --I tells where your picture is.If the text label too small or too large on the picture,you can use a different --font_scale 1 and --thickness 1 to adjust the text size and thickness. We also provide a pretrained model,you can download from here or here and extract it to models path.

Picture from web cam

web cam

First download the pretrained model from here or here and extract to models path. In order to get pictures from web cam, you may need to uninstall your cv2 and install it from source if have problems when running the below command:

python demo.py 

TODO

  • [x] First version of project
  • [x] Code review and add some commits
  • [x] Add a readme doc
  • [x] Add a demo using pictures from web cam

References and Acknowledgments

This project is a part of my class project of Machine Learning course at Zhejiang University,following papers and codes are referred:

  1. Rothe R, Timofte R, Van Gool L. Dex: Deep expectation of apparent age from a single image[C]//Proceedings of the IEEE International Conference on Computer Vision Workshops. 2015: 10-15.
  2. Rothe R, Timofte R, Van Gool L. Deep expectation of real and apparent age from a single image without facial landmarks[J]. International Journal of Computer Vision, 2016: 1-14.
  3. IMDB-WIKI – 500k+ face images with age and gender labels
  4. yu4u/age-gender-estimation
  5. davidsandberg/facenet
  6. Face Alignment with OpenCV and Python
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].