All Projects → mowshon → age-and-gender

mowshon / age-and-gender

Licence: MIT license
Predict Age and Gender of people from images | Determination of gender and age

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
CMake
9771 projects
Cuda
1817 projects
XSLT
1337 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to age-and-gender

AIML-Human-Attributes-Detection-with-Facial-Feature-Extraction
This is a Human Attributes Detection program with facial features extraction. It detects facial coordinates using FaceNet model and uses MXNet facial attribute extraction model for extracting 40 types of facial attributes. This solution also detects Emotion, Age and Gender along with facial attributes.
Stars: ✭ 48 (-29.41%)
Mutual labels:  face-recognition, gender-recognition, gender-classification
Face Api.js
JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
Stars: ✭ 13,258 (+19397.06%)
Mutual labels:  face-recognition, gender-recognition, age-estimation
namsor-python-sdk2
NamSor API v2 Python SDK - classify personal names accurately by gender, country of origin, or ethnicity.
Stars: ✭ 23 (-66.18%)
Mutual labels:  gender-classification, gender-detection
People-tracking-with-Age-and-Gender-detection
A combination between people tracking and age and gender detection
Stars: ✭ 57 (-16.18%)
Mutual labels:  gender-detection, age-detection
multi-task-learning
Multi-task learning smile detection, age and gender classification on GENKI4k, IMDB-Wiki dataset.
Stars: ✭ 154 (+126.47%)
Mutual labels:  gender-classification, age-estimation
voice gender detection
♂️♀️ Detect a person's gender from a voice file (90.7% +/- 1.3% accuracy).
Stars: ✭ 51 (-25%)
Mutual labels:  gender-classification, gender-detection
11K-Hands
Two-stream CNN for gender classification and biometric identification using a dataset of 11K hand images.
Stars: ✭ 44 (-35.29%)
Mutual labels:  gender-recognition, gender-classification
Insightface
State-of-the-art 2D and 3D Face Analysis Project
Stars: ✭ 10,886 (+15908.82%)
Mutual labels:  face-recognition, age-estimation
HSE FaceRec tf
Tensorflow/Keras small models for face recognition, ag/gender prediction from images
Stars: ✭ 23 (-66.18%)
Mutual labels:  gender-recognition, gender-classification
GenderRecognizer
Plain Face Detector & Gender Recognizer
Stars: ✭ 57 (-16.18%)
Mutual labels:  face-recognition, gender-recognition
WreckFaceApp
Android application for gender, age and face recognition using OpenCV and JavaCV libraries
Stars: ✭ 21 (-69.12%)
Mutual labels:  face-recognition, gender-recognition
double-take
Unified UI and API for processing and training images for facial recognition.
Stars: ✭ 585 (+760.29%)
Mutual labels:  face-recognition
T System
the moving objects tracking system via two axis camera motion (and as optionally n joint robotic arm) for raspberry pi distributions
Stars: ✭ 17 (-75%)
Mutual labels:  face-recognition
Recognize-Face-on-Android
This is an Android face recognize application that based on tensorflow , you can develop it with Android Studio
Stars: ✭ 20 (-70.59%)
Mutual labels:  face-recognition
Face-Recognition-using-Raspberry-Pi
A small project which does face detection using OpenCV library.
Stars: ✭ 48 (-29.41%)
Mutual labels:  face-recognition
face-recognition
🙂 An OpenCV application that can detect & recognize your face in real-time
Stars: ✭ 13 (-80.88%)
Mutual labels:  face-recognition
OpenCV-Face-Recognition-Android
Face Detection & Recognition on Android using OpenCV
Stars: ✭ 28 (-58.82%)
Mutual labels:  face-recognition
tryonface
Simple video-based eyewear virtual try on
Stars: ✭ 57 (-16.18%)
Mutual labels:  face-recognition
Real-time-Face-recognition
即時人臉辨識(使用OpenCV與FaceNet)
Stars: ✭ 37 (-45.59%)
Mutual labels:  face-recognition
PassFace
Face recognizing program develop using EmguCV (OpenCV wrapper). It is possible to use 4 different algorithm and 3 different source(Camera, Video, Image)
Stars: ✭ 38 (-44.12%)
Mutual labels:  face-recognition

Predict Age and Gender using Python

This module will help you determine the gender and age of people from the image. The predict method returns a list of faces of people who were found in the image with a possible age and gender of the person.

Available for Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8

img

© Bill Gates family

Instalation

git clone [email protected]:mowshon/age-and-gender.git
cd age-and-gender
python3 setup.py install --user

Download the pre-trained models

We use already trained models. Thanks for the provided models from: https://github.com/davisking/dlib-models

Author: Davis E. King

  1. shape_predictor_5_face_landmarks.dat.bz2 Download

This is a 5 point landmarking model which identifies the corners of the eyes and bottom of the nose. It is trained on the dlib 5-point face landmark dataset, which consists of 7198 faces. @davisking created this dataset by downloading images from the internet and annotating them with dlib's imglab tool.

  1. dnn_age_predictor_v1.dat.bz2 Download

The initial source for the model's creation came from the document of Z. Qawaqneh et al.: "Deep Convolutional Neural Network for Age Estimation based on VGG-Face Model". However, our research has led us to significant improvements in the CNN model, allowing us to estimate the age of a person outperforming the state-of-the-art results in terms of the exact accuracy and for 1-off accuracy.

This model is thus an age predictor leveraging a ResNet-10 architecture and trained using a private dataset of about 110k different labelled images. During the training, we used an optimization and data augmentation pipeline and considered several sizes for the entry image.

This age predictor model is provided for free by Cydral Technology and is licensed under the Creative Commons Zero v1.0 Universal.

  1. dnn_gender_classifier_v1.dat.bz2 Download

This model is a gender classifier trained using a private dataset of about 200k different face images and was generated according to the network definition and settings given in Minimalistic CNN-based ensemble model for gender prediction from face images. Even if the dataset used for the training is different from that used by G. Antipov et al, the classification results on the LFW evaluation are similar overall (± 97.3%). To take up the authors' proposal to join the results of three networks, a simplification was made by finally presenting RGB images, thus simulating three "grayscale" networks via the three image planes. Better results could be probably obtained with a more complex and deeper network, but the performance of the classification is nevertheless surprising compared to the simplicity of the network used and thus its very small size.

This gender model is provided for free by Cydral Technology and is licensed under the Creative Commons Zero v1.0 Universal.

  1. Unpack the *.bz2 archives, you need only the .dat file.

Folder structure

test_example
-- shape_predictor_5_face_landmarks.dat
-- dnn_age_predictor_v1.dat
-- dnn_gender_classifier_v1.dat
-- test-image.jpg
-- example.py

Example

from age_and_gender import AgeAndGender
from PIL import Image

data.load_shape_predictor('shape_predictor_5_face_landmarks.dat')
data.load_dnn_gender_classifier('dnn_gender_classifier_v1.dat')
data.load_dnn_age_predictor('dnn_age_predictor_v1.dat')

image = Image.open('test-image.jpg').convert("RGB")
result = data.predict(image)

print(result)

Result:

[{'age': {'confidence': 85, 'value': 26},
  'face': [414, 265, 504, 355],
  'gender': {'confidence': 100, 'value': 'female'}},
 {'age': {'confidence': 58, 'value': 62},
  'face': [223, 199, 330, 307],
  'gender': {'confidence': 99, 'value': 'female'}},
 {'age': {'confidence': 73, 'value': 19},
  'face': [593, 128, 700, 235],
  'gender': {'confidence': 99, 'value': 'male'}},
 {'age': {'confidence': 50, 'value': 24},
  'face': [342, 534, 450, 641],
  'gender': {'confidence': 100, 'value': 'female'}},
 {'age': {'confidence': 92, 'value': 61},
  'face': [782, 116, 872, 206],
  'gender': {'confidence': 99, 'value': 'male'}}]

Examples of determining the gender and age of people from the image

Code: https://github.com/mowshon/age-and-gender/tree/master/example

How to increase efficiency with face_recognition ?

The module will try to determine where the faces of people are on the image. But, it is better for us to provide a variable with people's faces using the library face_recognition and method face_locations().

python -m pip install numpy --user
python -m pip install face_recognition --user

Code:

from age_and_gender import *
from PIL import Image
import face_recognition
import numpy


data = AgeAndGender()
data.load_shape_predictor('models/shape_predictor_5_face_landmarks.dat')
data.load_dnn_gender_classifier('models/dnn_gender_classifier_v1.dat')
data.load_dnn_age_predictor('models/dnn_age_predictor_v1.dat')

filename = 'test-image-2.jpg'

img = Image.open(filename).convert("RGB")
face_bounding_boxes = face_recognition.face_locations(
    numpy.asarray(img),  # Convert to numpy array
    model='hog'  # 'hog' for CPU | 'cnn' for GPU (NVIDIA with CUDA)
)

result = data.predict(img, face_bounding_boxes)

Module age-and-gender without face_recognition

img

Module age-and-gender with face_recognition and face_bounding_boxes

img

Full example of code: https://github.com/mowshon/age-and-gender/blob/master/example/example-with-face-recognition.py

Changelog

Version 1.0.1

  • The method predict(pillow_img) now require a PIL.Image object. Thanks to @arrufat for the piece of code that successfully performs the matrix conversion.
  • The method predict(pillow_img, face_bounding_boxes) takes another argument face_bounding_boxes with a list of faces in the image. Check out this example.
  • If the method predict(pillow_img) does not get the second argument face_bounding_boxes with a list of faces, then the module will try to find the faces in the image itself.

Version 1.0.0

  • Initial commit and code
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].