Skip to content

Race recognition including asian, white, middle eastern, indian, latino and black predictions by single face image

Notifications You must be signed in to change notification settings

Kichkun/race_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Race predictor from single selfie

Installation

git clone https://github.com/Kichkun/race_model.git
cd race_model
pip install .

Race recognition including asian, white, middle eastern, indian, latino and black predictions.

from race_model import RaceModel
import cv2
img = cv2.imread("img4.jpg")
demography = RaceModel.analyze(img)
#demography = RaceModel.analyze([img, img]) #analyze multiple images
print("Race: ", demography["dominant_race"])
#print("Race: ", demography)

{'dominant_race': 'white',
 'race': {'asian': 1.3692333378223509e-08,
  'black': 1.682867603949867e-10,
  'indian': 1.8962782455389515e-07,
  'latino hispanic': 0.0014391415788850281,
  'middle eastern': 0.01635842927498743,
  'white': 99.98220801353455}}

Pretrained weights can be downloaded from here and should be placed in "models" folder