GithubHelp home page GithubHelp logo

daheer / face-facts Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.05 MB

Face-Facts detects a person's age, gender, and race using advanced machine learning techniques.

Python 4.53% Jupyter Notebook 95.47%

face-facts's Introduction

Face Facts

Face Facts predicts age, race, and gender of individuals from their images using advanced machine learning techniques.

Installation

  • Clone this repo git clone https://github.com/Daheer/face-facts.git
  • Install requirements pip insatll requirements.txt
  • Launch streamlit app streamlit run face_facts.py

Usage

The 'Run Face Facts' section of the app lets you upload any image. It automatically retrieves one face and uses that face as "face of interest", the image of the selected face is run through the model for prediction.

The app carries out prediction using two methods, the first employs a model that was trained to predict all three KPIs (age, gender and race) at once. The second uses three models, each trained for the individual task.

Additionally, the app lets users access more in-depth details, including visualizing the selected face-of-interest, the confidence level of the gender prediction and the probability distribution of the person's race.

The app is available and can be accessed via two platforms

Features

  • Image upload
  • Face detection
  • Age, Gender and Race prediction
  • Multiple prediction methods
  • Seamless toggle between the prediction methods
  • In-depth analysis

Built Using

Details

  • Dataset: UTKFace was used for face facts. It consists of over 20,000 facial images with annotations of age, gender, and ethnicity. The images cover large variation in pose, facial expression, illumination, occlusion, resolution, etc. This dataset could be used on a variety of tasks, e.g., face detection, age estimation, age progression/regression, landmark localization, etc

  • Data processing: The dataset exhibited a pronounced class imbalance in the age category, with a dominance of images of infants (0 - 4 years) as compared to other age ranges. This imbalance can adversely affect the performance of regression models that rely on accurate representation of all age groups. To address this issue, I employed a strategic approach that randomly discards 30% of examples containing images of individuals aged < 4.

  • Model selection and training details: For the standalone models, efficientnet_b0 was employed as the backbone architecture, with task-specific heads appended for each of the sub-tasks i.e. binary classification for gender prediction, regression for age prediction and multi-class classification for race prediction. The models were trained with separate pytorch lightning trainer modules for 25 epochs each.
    As for the joint model, a single pytorch lightning trainer was used to train and optimize all three objectives. After experimentation, I discovered the weighting scheme that performed well as follows:

    • 0.001 * age loss
    • gender loss
    • race loss

Performance

More details about performance can be seen here notebook
Standalone Models

Category Validation Loss Validation Accuracy
Age 137.0 -
Gender - 87.6%
Race - 77.5%

Joint

Category Validation Loss Validation Accuracy
Age 174.0 -
Gender - 88.4%
Race - 78.6%
Total 0.639 -

Contact

Dahir Ibrahim (Deedax Inc)
Email - [email protected]
Twitter - https://twitter.com/DeedaxInc
YouTube - https://www.youtube.com/@deedaxinc
Project Link - https://github.com/Daheer/mask-check

face-facts's People

Contributors

daheer avatar

Watchers

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