Configuration

The service allowed two variant of configuration:

  1. use the Configurator service

  2. use the configuration file

The service reads settings from the configuration file by default.

You can specify the –luna-config option for pulling settings from the Configurator service, see configurator.

Auto reload configuration

The service supports an auto-reload of configurations. You can enable this feature by specifying a config-reload option in the command line. The service periodically checks new settings. If current settings and new pulled settings are the same the service will not perform any actions. You can specify the check period in the pulling-time command line argument (10 seconds by default).

If a configuration fetching has failed, the service will work without applying any changes to the existing configurations.

If check connections with the new configuration have failed, the service will retry pulling new configuration after pulling-time seconds. The service will shut down after 10 failed attempts.

Warning

Service can work incorrectly while the new settings are being applied. It is strongly recommended not to send requests to the service when you change important settings (database configuration, work plugins list, and others).

Configuration file for administrator

# Luna-api configuration file

[LUNA_CONFIGURATOR]
#: load configs from LUNA Configurator
USE_CONFIGURATOR = 0
#: LUNA Configurator protocol, IP address, and port
LUNA_CONFIGURATOR_ORIGIN = http://127.0.0.1:5070
#: API version of the LUNA Configurator
LUNA_CONFIGURATOR_API  = 1


[LUNA_HANDLERS_DB]

#: type of database: "postgres" or "oracle"; "postgres" type is used by default
DB_TYPE = postgres
#: database username
DB_USER = luna
#: database password
DB_PASSWORD = luna
#: database name for "postgres" type, SID name for "oracle" type
DB_NAME = luna_handlers
#: database IP address
DB_HOST = 127.0.0.1
#: database listener port, 5432 - default for "postgres" type, 1521 - default for "oracle" type
DB_PORT = 5432


[LUNA_HANDLERS_DB.DB_SETTINGS]

#: [integer] database connection pool size
CONNECTION_POOL_SIZE = 5


[INFLUX_MONITORING]

#: send data for monitoring to InfluxDB
SEND_DATA_FOR_MONITORING = 1
#: [string] InfluxDB 2.x workspace
ORGANIZATION =
#: [string] InfluxDB 2.x authentication token
TOKEN =
#: [string] InfluxDB 2.x bucket name
BUCKET = luna_monitoring
#: InfluxDB IP address
HOST = 127.0.0.1
#: InfluxDB port
PORT = 8086
#: use HTTPS to connect to InfluxDB
USE_SSL = 0
#: frequency of sending monitoring data to InfluxDB (in seconds)
FLUSHING_PERIOD = 1


[LUNA_HANDLERS_LOGGER]

#: folder, where logs are saved
FOLDER_WITH_LOGS = ./
#: level of debug print, by priority: "ERROR", "WARNING", "INFO", "DEBUG"
LOG_LEVEL = INFO
#: time format used in log records: "LOCAL" or "UTC"
LOG_TIME = LOCAL
#: maximum log file size in megabytes before performing rotation (0 - without rotation)
MAX_LOG_FILE_SIZE = 1024
#: send log to stdout
LOG_TO_STDOUT = 1
#: send log to file
LOG_TO_FILE = 1
#: allow multiline stack trace in logs
MULTILINE_STACK_TRACE = 1


[LUNA_LICENSES_ADDRESS]

#: LUNA Licenses protocol, IP address, and port
ORIGIN = http://127.0.0.1:5120
#: API version of the LUNA Licenses
API_VERSION = 1


[LUNA_FACES_ADDRESS]

#: LUNA Faces protocol, IP address, and port
ORIGIN = http://127.0.0.1:5030
#: API version of the LUNA Faces
API_VERSION = 3


[LUNA_FACES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_IMAGE_STORE_FACES_SAMPLES_ADDRESS]

#: LUNA Image Store protocol, IP address, and port (for samples)
ORIGIN = http://127.0.0.1:5020
#: API version of the LUNA Image Store (for samples)
API_VERSION = 1
#: *bucket* name, where samples will be stored
BUCKET = visionlabs-samples

[LUNA_IMAGE_STORE_BODIES_SAMPLES_ADDRESS]

#: LUNA Image Store protocol, IP address, and port (for samples)
ORIGIN = http://127.0.0.1:5020
#: API version of the LUNA Image Store (for samples)
API_VERSION = 1
#: *bucket* name, where samples will be stored
BUCKET = visionlabs-bodies-samples

[LUNA_IMAGE_STORE_IMAGES_ADDRESS]

#: LUNA Image Store protocol, IP address, and port (for origin images)
ORIGIN = http://127.0.0.1:5020
#: API version of the LUNA Image Store (for origin images)
API_VERSION = 1
#: *bucket* name, where origin images will be stored
BUCKET = visionlabs-image-origin

[LUNA_IMAGE_STORE_FACES_SAMPLES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[LUNA_IMAGE_STORE_BODIES_SAMPLES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[LUNA_IMAGE_STORE_IMAGES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[ADDITIONAL_SERVICES_USAGE]

#: [integer] send events to LUNA Events for storing
LUNA_EVENTS = 1
#: [integer] use LUNA Tasks
LUNA_TASKS = 1
#: [integer] send events to the LUNA Sender subscription service
LUNA_SENDER = 1
#: [integer] use LUNA Python Matcher Proxy instead of LUNA Python Matcher
LUNA_MATCHER_PROXY = 1


[LUNA_EVENTS_ADDRESS]

#: LUNA Events protocol, IP address, and port
ORIGIN = http://127.0.0.1:5040
#: API version of the LUNA Events
API_VERSION = 2


[LUNA_EVENTS_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_PYTHON_MATCHER_ADDRESS]

#: LUNA Python Matcher protocol, IP address, and port
ORIGIN = http://127.0.0.1:5100
#: API version of the LUNA Python Matcher
API_VERSION = 1


[LUNA_PYTHON_MATCHER_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_MATCHER_PROXY_ADDRESS]

#: LUNA Python Matcher Proxy protocol, IP address, and port
ORIGIN = http://127.0.0.1:5110
#: API version of the LUNA Python Matcher Proxy
API_VERSION = 1


[LUNA_PYTHON_MATCHER_PROXY_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[REDIS_DB_ADDRESS]

#: redis host for the service subscription
HOST = 127.0.0.1
#: redis port for the service subscription
PORT = 6379
#: redis password for the service subscription
PASSWORD =
#: redis channel for the service subscription
CHANNEL = luna-sender


[REDIS_DB_ADDRESS.SENTINEL]
#: [string] sentinel master name
MASTER_NAME = luna_sender_master
#: [list(string)] list of Redis Sentinel listeners (example [127.0.0.1:26379, 10.0.4.1:26379]).
#: By setting this parameter, application will query Redis parameters (host and port) from sentinels
SENTINELS = []


[LUNA_HANDLERS_RUNTIME_SETTINGS]

#: device type on which estimations is performed - "cpu" or "gpu"
GLOBAL_DEVICE_CLASS = cpu
#: number of worker threads
NUM_THREADS = 4
#: number of streams; this parameter increases performance, but works only with new versions of NVIDIA drivers
NUM_COMPUTE_STREAMS = 6

[LUNA_HANDLERS_FACE_DETECTOR_SETTINGS.runtime_settings]

#: device type on which the face detection is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_DETECTOR_SETTINGS.estimator_settings]

#: min face size in pixels, max face size = min face size * 32
MIN_FACE_SIZE = 50
#: target face size for redetect
REDETECT_FACE_TARGET_SIZE = 45
#: target face size for redetect after preprocessing
REDETECT_TENSOR_SIZE = 80
#: redetect score threshold; redetection is considered failed if the score is lower than the specified value
REDETECT_SCORE_THRESHOLD = 0.357
#: score threshold; detection is considered failed if the score is lower than the specified value
SCORE_THRESHOLD = 0.42

[LUNA_HANDLERS_GAZE_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which the face detection is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_QUALITY_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which the face detection is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_MOUTH_ATTRIBUTES_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_EMOTIONS_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_BASIC_ATTRIBUTES_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_EYES_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_HEAD_POSE_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_DESCRIPTOR_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_MASK_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_LIVENESS_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_LIVENESS_ESTIMATOR_SETTINGS.estimator_settings]

#: [float] liveness score threshold
REAL_THRESHOLD = 0.5
#: [float] default liveness v2 quality threshold of "appropriate image" in the calculation of aggregate estimates
QUALITY_THRESHOLD = 0.5

[LUNA_HANDLERS_GLASSES_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_WARP_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_LANDMARKS68_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_LANDMARKS5_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_IMAGE_COLOR_TYPE_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_HEADWEAR_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_NATURAL_LIGHT_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FISHEYE_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_EYEBROW_EXPRESSION_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_RED_EYES_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_FACE_DETECTION_BACKGROUND_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_IMAGE_ORIENTATION_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_BODY_DETECTOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_BODY_DETECTOR_SETTINGS.estimator_settings]

#: sets the maximum frame size after scaling to the largest side in pixels
IMAGE_SIZE = 640
#: redetect score threshold; redetection is considered failed if the score is lower than the specified value
REDETECT_SCORE_THRESHOLD = 0.12
#: score threshold; detection is considered failed if the score is lower than the specified value
SCORE_THRESHOLD = 0.3
#: landmarks17 score threshold: score threshold for body landmarks
LANDMARKS17_THRESHOLD = 0.25

[LUNA_HANDLERS_BODY_DESCRIPTOR_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_BODY_WARP_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_BODY_LANDMARKS_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_BODY_ATTRIBUTES_ESTIMATOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1

[LUNA_HANDLERS_HUMAN_DETECTOR_SETTINGS.runtime_settings]

#: device type on which estimation is performed - "cpu", "gpu" or "global"
DEVICE_CLASS = global
#: optimal batch size for stage
OPTIMAL_BATCH_SIZE = 10
#: worker count for estimation
WORKER_COUNT = 1


[LUNA_HANDLERS_LOAD_EXTERNAL_IMAGES_TIMEOUT]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60




[ATTRIBUTES_STORAGE_POLICY]
#: [integer] default time to live of temporary attributes (in seconds)
DEFAULT_TTL = 300
#: [integer] maximum time to live of temporary attributes (in seconds)
MAX_TTL = 86400


[LUNA_HANDLERS_LIMITS]

#: [integer] max number of images received in request
RECEIVED_IMAGES_LIMIT = 8
#: [integer] max detections in raw event
RAW_EVENT_DETECTIONS_LIMIT = 100
#: [integer] max length of arrays in raw event
RAW_EVENT_ARRAYS_LIMIT = 30
#: [integer] max number of matching results for the candidates' list returned in the response
RESULT_CANDIDATE_LIMIT = 100


[EXTERNAL_LUNA_API_ADDRESS]

#: external luna-api origin
ORIGIN = http://127.0.0.1:5000
#: external luna-api origin
API_VERSION = 6


[OTHER]

#: list of active plugins
LUNA_HANDLERS_ACTIVE_PLUGINS = []
#: storage time - "LOCAL" or "UTC"
STORAGE_TIME = LOCAL
#: face detector type
LUNA_HANDLERS_DETECTOR_TYPE = FACE_DET_V3
#: default face descriptor version
DEFAULT_FACE_DESCRIPTOR_VERSION = 59
#: default human body descriptor version
DEFAULT_HUMAN_DESCRIPTOR_VERSION = 107
#: estimate image orientation and rotate the image to the correct angle
LUNA_HANDLERS_USE_AUTO_ROTATION = 1

Extended administrator configuration

Extended configuration.

configs.config.DEFAULT_VERIFICATION_THRESHOLD = 0.9

default verification threshold

configs.config.HANDLERS_CACHE_MAX_SIZE = 1024

int, maximum number of cached handlers

configs.config.HANDLERS_CACHE_POLLING_PERIOD = 10

seconds, cache invalidator polling period

configs.config.HANDLERS_CACHE_TTL = 60

seconds, time to live for cached handlers

configs.config.LICENSE_LIVENESS_BALANCE_WARNING_THRESHOLD = 2000

license liveness balance usage warning threshold (executions number)

configs.config.MAX_IMAGE_ORIGIN_EXTERNAL_URL_LENGTH = 256

max image origin external url

configs.config.PLUGINS_PUBLISHING_CONCURRENCY = 100

event plugins publishing concurrency

configs.config.WARP_FORMAT = 'JPEG'

warp format