Coder Social home page Coder Social logo

py-agender's Introduction

Face Age & Gender detection tool

Simple opencv & tensorflow solution to estimate Age and Gender in your next project. Command line or Python DIY style.

Based on and forked from: https://github.com/yu4u/age-gender-estimation

Good enough for pet-projects and prototypes, but not ready for production real-life applications

How

pip3 install py-agender[cpu]  # for the cpu version of TensorFlow
pip3 install py-agender[gpu]  # for the gpu version of TensorFlow

Warning: ~190MB download (pretrained network is heavy).

CLI:

py-agender PATH_TO_IMAGE

Python:

from pyagender import PyAgender

agender = PyAgender() 
# see available options in __init__() src

faces = agender.detect_genders_ages(cv2.imread(MY_IMAGE))
# [
#   {left: 34, top: 11, right: 122, bottom: 232, width:(r-l), height: (b-t), gender: 0.67, age: 23.5},
#   ...
# ]

# Additional options & methods in PyAgender source

Don't forget to download pretrained weights if using source code DIY style.

TODO:

  • add options (like STDIN input, output formatters etc.) for useful commandline applications
  • add help output
  • train better network with higher image resolution
  • train another (more compact & precise) network architecture

Tests

python3 -m unittest 

Dependencies

  • Python 3.5, 3.6, 3.7
  • numpy ~> 1.15
  • Keras ~> 2.2
  • tensorflow or tensorflow-gpu ~> 1.10
  • opencv-python ~> 3.4.2+contrib

Tested on:

  • MacOS 10.13 high Sierra without GPU (you're welcome to update & contribute!)

Model

These weigts are from https://github.com/yu4u/age-gender-estimation on first console version run they are cached in ./pyagender.pretrained_models folder:

https://github.com/yu4u/age-gender-estimation/releases/download/v0.5/weights.28-3.73.hdf5

License

This project is released under the MIT license.

However, the IMDB-Wiki dataset used for pretrained network above is originally provided under the following conditions:

Please notice that this dataset is made available for academic research purpose only. All the images are collected from the Internet, and the copyright belongs to the original owners. If any of the images belongs to you and you would like it removed, please kindly inform us, we will remove it from our dataset immediately.

Refer to fresh IMDB-Wiki dataset License and act accordingly.

py-agender's People

Contributors

aristofun avatar itaybb 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.