Python API Documentation

Module Functions

get_sdk_version_string()

Returns the version string of the SDK (and not the model).

Returns: str

DemographicEstimator class

class realeyes.demographic_estimation.DemographicEstimator(model_file, max_concurrency=0)

The Demographic Estimator class

__init__(self, model_file, max_concurrency=0)

DemographicEstimator constructor: loads model file, sets up the processing.

Parameters:

  • model_file (str) - path for the used model
  • max_concurrency (int) - maximum allowed concurrency, 0 means automatic (using all cores), default: 0

detect_faces(self, image)

Detects the faces on an image.

Parameters:

  • image (numpy.ndarray) - image of the face(s)

Returns: list[Face]

estimate(self, face)

Returns the estimated demographics of the detected face.

Parameters:

  • face (Face) - face to estimate.

Returns: list[Output]

get_model_name(self)

Returns the name (version etc) of the loaded model.

Returns: str

Result classes

Face

class realeyes.demographic_estimation.Face

__init__(self, image, landmarks, bbox=BoundingBox(x=0, y=0, width=0, height=0), confidence=0.0)

Face constructor to use a 3rd party face detector as face source

Parameters:

  • image (numpy.ndarray) - image of the face
  • landmarks (list[Point2d]) - landmarks of the face, see landmarks specification
  • bbox (BoundingBox) - bounding box of the face
  • confidence (float) - confidence value of the detected face
bounding_box(self)

Returns the bounding box of the detected face.

Returns: BoundingBox

confidence(self)

Returns the confidence value of the detected face.

Returns: float

landmarks(self)

Returns the landmarks of the detected face.

Returns: list[Point2d]

See also: landmarks specification.

Point2d

class realeyes.demographic_estimation.Point2d

Point2d class for the landmarks

__init__(self, x, y)

Point2d constructor

Parameters:

  • x (float) - X coordinate of the point
  • y (float) - Y coordinate of the point
Attributes
  • x (float) - X coordinate of the point.
  • y (float) - Y coordinate of the point.

BoundingBox

class realeyes.demographic_estimation.BoundingBox

Bounding Box class for the faces

__init__(self, x, y, width, height)

BoundingBox constructor

Parameters:

  • x (int) - X coordinate of the top-left corner
  • y (int) - Y coordinate of the top-left corner
  • width (int) - Width of the bounding box in pixels
  • height (int) - Height of the bounding box in pixels
Attributes
  • x (int) - X coordinate of the top-left corner.
  • y (int) - Y coordinate of the top-left corner.
  • width (int) - Width of the bounding box in pixels.
  • height (int) - Height of the bounding box in pixels.

OutputType

class realeyes.demographic_estimation.OutputType

Attributes:

  • AGE = 0
  • GENDER = 1
  • AGE_UNCERTAINTY = 2

Gender

class realeyes.demographic_estimation.Gender

Attributes:

  • FEMALE = 0
  • MALE = 1

Output

class realeyes.demographic_estimation.Output

Attributes:

  • name (str) - Name of the output
  • type (OutputType) - Type of the output
  • value (Union[Gender, float]) - Value of the output