Configuration options

The configuration options are provided when the engine is initialized and they are case-sensitive.

Sample (default) config:

{
    "debug_level": "info",
    "debug_write_input_image_enabled": false,
    "debug_internal_data_path": ".",

    "assets_folder": "../../../assets",

    "gpu_ctrl_memory_enabled": false,
    "num_threads": -1,
    "max_latency": -1,
    "max_batchsize": -1,
    "asm_enabled": true,
    "intrin_enabled": true,

    "openvino_activation": "auto",
    "openvino_device": "CPU",

    "graph_type": "dense",
    "graph_2passes_enabled": true,
    "graph_2ndpass_ocr_threshold": 0.9,
    "graph_2ndpass_umeyama_enabled": true,

    "ocr_2passes": true,
    "ocr_2ndpass_threshold": 0.9,
    "ocr_patch_antialias": true,
    "ocr_tunning_apply_patterns": true,
    "ocr_tunning_apply_whitelist": true,
    "ocr_tunning_apply_blacklist": true,

    "magsac_sigma": 1.0,
    "magsac_max_iters": 5000,
    "magsac_resampler": "uniform",

    "tps_enabled": true,
    "tps_speed": 1,
    "tps_cost": "l2",

    "stn_enabled": true,

    "detect_threshold": 0.3,

    "text_segmentation_type": "watershed"
}

assets_folder

Path to the folder containing the configuration files and deep learning models.
Default value is the current folder.
The SDK will look for the models in $(assets_folder)/KYC-Documents-Verif-SDK-Models folder.

type

string

pattern

folder path

default

“”

debug_level

Defines the debug level to output on the console. You should use “verbose” for diagnostic, “info” in development stage and “warn” in production.

type

string

pattern

“verbose” | “info” | “warn” | “error” | “fatal”

default

“info”

debug_write_input_image_enabled

Whether to write the transformed input image to the disk.
This could be useful for debugging.

type

bool

pattern

true | false

default

False

debug_internal_data_path

Path to the folder where to write the transformed input image.
Used only if debug_write_input_image_enabled is true.

type

string

pattern

folder path

default

“”

license_token_file

Path to the file containing the license token.
First you need to generate a Runtime Key using requestRuntimeLicenseKey() function then activate the key to get a token.
You should use license_token_file or license_token_data but not both.

type

string

pattern

file path

default

“”

license_token_data

Base64 string representing the license token.
First you need to generate a Runtime Key using requestRuntimeLicenseKey() function then activate the key to get a token.
You should use license_token_file or license_token_data but not both.

type

string

pattern

base64

default

“”

gpu_ctrl_memory_enabled

Whether to control the GPU memory usage.
This option applies to Tensorflow only and doesn’t apply to OpenVINO.
By default Tensorflow will allocate as much memory as possible and this could be problematic and produce Out Of Memory (OOM) issues.
Enabling memory usage control will ensure that only required memory will be allocated.
Restricting the memory usage may slightly slowdown the inference speed but is highly recommended to avoid OOM.

type

bool

pattern

true | false

default

false

num_threads

Defines the maximum number of threads to use. You should not change this value unless you know what you’re doing.
Set to -1 to let the SDK choose the right value.
The right value the SDK will choose will likely be equal to the number of virtual core.
For example, on an octa-core device the maximum number of threads will be 8.

type

int

pattern

[-1, +inf[

default

-1

max_batchsize

Defines the maximum batch size to use for the inference.
This option applies to Tensorflow only and doesn’t apply to OpenVINO.
Set this value to -1 to let the SDK choose the right value.

type

int

pattern

[-1, +inf[

default

-1

max_latency

The parallel processing method could introduce delay/latency in the delivery callback on low-end CPUs.
This parameter controls the maximum latency you can tolerate.
The unit is number of frames.
The default value is -1 which means auto.

type

int

pattern

[0, +inf[

default

-1

asm_enabled

Whether to enable assembler code to use SIMD acceleration (SSE, AVX, NEON).

type

bool

pattern

true | false

default

true

intrin_enabled

Whether to enable intrinsic code to use SIMD acceleration (SSE, AVX, NEON).

type

bool

pattern

true | false

default

true

openvino_activation

Defines the OpenVINO activation mode. “auto” means the activation will be based on whether GPU acceleration is possible or not.
“auto” mode will activate some modules to run on CPU and others on GPU in a smart way.
“on” and “off” modes are hard activation or deactivation of OpenVINO.
We higly recommend using “auto” mode to let the SDK balance the inferences on CPU/GPU.

type

string

pattern

“auto” | “on” | “off”

default

“auto”

openvino_device

OpenVINO device to use for computations. We recommend using “CPU” which is always correct.
If you have an Intel GPU, VPU or FPGA, then you can change this value.
If you try to use any other value than “CPU” without having the right device, then OpenVINO will be completely disabled with a fallback on Tensorflow.

type

string

pattern

“GNA” | “HETERO” | “CPU” | “MULTI” | “GPU” | “MYRIAD” | “HDDL ” | “FPGA”

default

“CPU”

graph_type

Defines the graph type. “dense” graphs are more accurate but slower.
We recommend using “dense” graphs for x86 (server) CPUs and “sparse” graphs for ARM (mobile) devices.

type

string

pattern

“sparse” | “dense”

default

“dense”

graph_2passes_enabled

Whether to enable 2-pass graph computation.

type

bool

pattern

true | false

default

True

graph_2ndpass_ocr_threshold

Threshold value to perform 2nd-pass graph computation.
The 2nd-pass will be performed only if the OCR score is less than this threshold.

type

float

pattern

[0, 1]

default

0.9

graph_2ndpass_umeyama_enabled

Whether to run Umeyama algorithm during the 2nd-pass graph computation.

type

bool

pattern

true | false

default

True

ocr_2passes

Whether to run 2-pass OCR.
The second pass will use different parameters than the 1st-pass and the best one will be chosen.

type

bool

pattern

true | false

default

True

ocr_2ndpass_threshold

Threshold value to perform 2nd-pass OCR.
The 2nd-pass will be performed only if the OCR score is less than this threshold.

type

float

pattern

[0, 1]

default

0.9

ocr_patch_antialias

Whether to enable anti-aliasing on the each field before OCR.

type

bool

pattern

true | false

default

True

ocr_tunning_apply_patterns

Whether to apply pattern matching on the OCR candidate results.

type

bool

pattern

true | false

default

True

ocr_tunning_apply_whitelist

Whether to apply white-listing on the OCR candidate results.

type

bool

pattern

true | false

default

True

ocr_tunning_apply_blacklist

Whether to apply black-listing on the OCR candidate results.

type

bool

pattern

true | false

default

True

magsac_sigma

Defines MAGSAC++ (Marginalizing Sample Consensus) sigma value.

type

float

pattern

]-inf, +inf[

default

1.0

magsac_max_iters

Defines maximum number of iterations for MAGSAC++ (Marginalizing Sample Consensus).

type

int

pattern

[1, +inf[

default

5000

magsac_resampler

Defines the resampler to use for MAGSAC++ (Marginalizing Sample Consensus).

type

string

pattern

“uniform” | “pnapsac”| “napsac” | “prosac”

default

“uniform”

tps_enabled

Whether to enable TPS (Thin Plate Spline).
TPS is performed as part of 2nd-pass graph computation which means you must enable 2-pass graph computation.

type

bool

pattern

true | false

default

True

tps_speed

Defines TPS speed.
Higher this value, faster the TPS computation will be done at the expense of accuracy.

type

int

pattern

[1, 5]

default

1

tps_cost

Defines the cost function to measure TPS error for each epoch. “l2” stands for Euclidean distance while “kc” stands for Kernel Correlation.

type

string

pattern

“l2” | “kc”

default

“l2”

stn_enabled

Whether to enable STN (Spatial Transformer Network).

type

bool

pattern

true | false

default

True

detect_threshold

Defines document (passport, id card, driver license…) detection threshold.
Any document detection score with a score lower than this threshold will be discarded and tagged as false-positive.

type

float

pattern

[0, 1]

default

0.3

text_segmentation_type

Defines the algorithm to use for text segmentation.
The “+” is used to combine 2 types.
Text segmentation is used to retrieve character boxes used for de-skewing.

type

string

pattern

“watershed” | “tmms” | “watershed+tmms” | “tmms+watershed”

default

“watershed”