Skip to content

Feodoros/ForensicGenderSex

Repository files navigation

Table of Contents

Intro

Gender classification algorithm in the forensic field based on EfficientNet model and manually marked up by gender WiderFace.

Marked up WiderFace

WiderFace was selected because the images in this set are as close as possible to the forensic photos. This set is "more wild" (extreme scale, occlusion, etc) than similar datasets such as FairFace, Adience, IMDb-Wiki. After we take easy-scale part of images and marked up them by gender. Total amount of faces in our data set -- 12 662 (6331 Males and 6331 Females) . The dataset is available on Kaggle or Drive.

Gender Classification

EfficientNet model

We chose EfficientNet model pretrained on Imagenet for training on Our data set.

Results on Gendered WiderFace

Method Trained on Precision Recall F1
EfficientNet-B0 Our 0.962 0.97 0.966
EfficientNet-B2 Our 0.978 0.97 0.974
EfficientNet-B4 Our 0.974 0.974 0.974
Gil Levi model Adience 0.745 0.735 0.740
VGG-Face IMDb-WIKI 0.581 0.97 0.727
FairFace FairFace 0.773 0.927 0.843

Results on forensic set

Method Trained on Precision Recall F1
EfficientNet-B0 Our 0.924 0.872 0.897
EfficientNet-B2 Our 0.911 0.887 0.899
EfficientNet-B4 Our 0.902 0.897 0.9
Gil Levi model Adience 0.893 0.6 0.718
VGG-Face IMDb-WIKI 0.649 0.985 0.782
FairFace FairFace 0.829 0.897 0.862

Inference Latency

Method Min time Max time Avg time
EfficientNet-B0 0.24 0.39 0.28
EfficientNet-B2 0.39 1.2 0.51
EfficientNet-B4 0.76 1.66 0.87
Gil Levi model 0.12 0.24 0.13
VGG-Face 1.57 2.87 1.75
FairFace 0.87 1.61 0.94

ROC-AUC on forensic set

изображение

Usage

Face Detector

We use CenterFace detector for python and C# projects.

Python script

You can download our pretrained gender prediction models from here. Usage of this python script:

predict_gender.py -i Input image path -o Output image path -d Detect faces True/False (default: True)

.NET WPF solution

You can test gender prediction (EfficientNet-B0 model) with windows desktop app.

Convert pytorch model to onnx

We should convert our pretrained model to onnx format to use this model in .NET with onnxruntime. Use this notebook to convert to onnx. You can download prepaired onnx model from here.

How to use

  • Open image
  • Click Analyze
  • Click on face on image or select this face from list to see this face closer
  • Right click on image to save finished image

изображение

Paper

References