Giter VIP home page Giter VIP logo

fairface's Introduction

Run on Ainize

FairFace: Face Attribute Dataset for Balanced Race, Gender, and Age

The paper: https://arxiv.org/abs/1908.04913

Kärkkäinen, K., & Joo, J. (2019). FairFace: Face Attribute Dataset for Balanced Race, Gender, and Age. arXiv preprint arXiv:1908.04913.

If you use our dataset or model in your paper, please cite:

@article{karkkainen2019fairface,
title={FairFace: Face Attribute Dataset for Balanced Race, Gender, and Age},
author={K{"a}rkk{"a}inen, Kimmo and Joo, Jungseock},
journal={arXiv preprint arXiv:1908.04913},
year={2019}
}

Examples of FairFace Prediction

test ### Instructions to use FairFace
  • Download or Clone this repo

  • Install Dependencies

    1. Please follow the Pytorch's official documentation to install Pytorch
    2. Please also install dlib, if you have pip installed on your system. Simply type the following command on your terminal.
    pip install dlib
    
  • Download our models Download our pretrained models from here and save it in the same folder as where predict.py is located. Two models are included, race_4 model predicts race as White, Black, Asian and Indian and race_7 model predicts races as White, Black, Latino_Hispanic, East, Southeast Asian, Indian, Middle Eastern.

  • Unzip the downloaded FairFace model as well as dlib face detection models in dlib_models.

  • Prepare the images

    • prepare a csv and provide the paths of testing images where the colname name of testing images is "img_path" (see our template csv file.

Run script predict.py

Run the predict.py script and provide the csv path (described in the section above).

python3 predict.py --csv "NAME_OF_CSV"

After download this repository, you can run python3 predict.pu --csv test_imgs.csv, the results will be available at detected_faces (in case dlib detect multiple faces in one image, we save them here) and test_outputs.csv.

Results

The results will be saved at "test_outputs.csv" (located in the same folder as predict.py, see sample here

UPDATES:

Run script predict_bbox.py

same commands as predict.py, the output csv will have additional column "bbox" which is the bounding box of detected face.

python3 predict_bbox.py --csv "NAME_OF_CSV"
output file documentation

indices to type

  • race_scores_fair (model confidence score) [White, Black, Latino_Hispanic, East, Southeast Asian, Indian, Middle Eastern]
  • race_scores_fair_4 (model confidence score) [White, Black, Asian, Indian]
  • gender_scores_fair (model confidence score) [Male, Female]
  • age_scores_fair (model confidence score) [0-2, 3-9, 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70+]

Data

Images (train + validation set): Padding=0.25, Padding=1.25

We used dlib's get_face_chip() to crop and align faces with padding = 0.25 in the main experiments (less margin) and padding = 1.25 for the bias measument experiment for commercial APIs. Labels: Train, Validation

License: CC BY 4.0

Notes

The models and scripts were tested on a device with 8Gb GPU, it takes under 2 seconds to predict the 5 images in the test folder.

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.