Skip to content

Configuration File

With the configuration file, you can add a scenario for the detect module, see How to add a scenario. In the future, you'll be able to include only the needed modules with the help of the active parameter.

The set of checks is defined by flags. When the library is initialized, the configuration is passed with a file that is read by the path from the FACEAPI_CONFIG_FILE_PATH environment variable.

How to add config

To add your configuration, first, create a file, see the Config file structure section below.

Then add the path to this file through the environment variable FACEAPI_CONFIG_FILE_PATH when loading the service.

Config file structure

The available modules are detect, match, liveness, search.

Use the detect module to analyze images, recognize faces in them, and return cropped and aligned portraits of the detected people, see Face Detection.

The match module lets you compare faces in two images for similarity, see Faces Comparison.

The liveness module examines and determines whether a live person is present and not a “spoof” or fake, here is more information.

Use search for matching a face from an image against a database of faces, see 1:N Face Identification.

Each module includes the active parameter. In the current version, active is always set to true, but in the future, you'll be able to set it to false to exclude the module you do not need.

└── detect
    └── active
    └── scenarios
└── match
    └── active
└── liveness
    └── active
└── search
    └── active

Config file example

{
  "detect": {
    "active" : true,
    "scenarios" : [
      {
        "scenario": "EyesChecks",
        "config": [
                {"name": "EyeRightClosed", "range": [0.0, 0.5]},
                {"name": "EyeLeftClosed", "range": [0.0, 0.5]},
                {"name": "EyeRightOccluded", "range": [0.0, 0.5]},
                {"name": "EyeLeftOccluded", "range": [0.0, 0.5]},
                {"name": "EyesRed", "range": [0.0, 0.5]},
                {"name": "EyeRightCoveredWithHair", "range": [0.0, 0.05]},
                {"name": "EyeLeftCoveredWithHair", "range": [0.0, 0.05]}
        ],
        "onlyCentralFace": true
      }
      {
        "scenario": "CropCentralFace",
        "outputImageParams": {
          "crop": {"type": 0, "size": [300, 400], "padColor": [128, 128, 128]}
        },
        "onlyCentralFace": true
      }
    ]
  },
  "match": {
    "active" : true,
  },
  "liveness": {
    "active" : true,
  },
  "search": {
    "active" : true,
  }
}