Skip to content

Use FaceStream with Configurator#

LUNA Configurator Usage#

When FaceStream operates in the server mode, it can use LUNA Configurator service. The service enables you to store FaceStream settings and apply them to the FaceStream instances.

After FaceStream is launched it uses the parameters specified in the Configurator service and does not request them until restart.

To apply the FaceStream settings changed in the Configurator, you must restart FaceStream.

FaceStream in server mode only can utilize the Configurator service.

The Configurator service enables FaceStream to continue the processing of video streams after FaceStream crashes and restarts, all the video streams data is stored in the Configurator service.

If FaceStream is unable to receive data and get a video streams from the Configurator service after a restart, and FaceStream receives a request to process a new video stream, this particular video stream will be written to the Configurator service.

Configurator service installation#

LUNA Configurator is an additional service of LUNA PLATFORM 4 and is distributed with it. All information on its installation and configuration can be found in the platform documentation.

You must install and configure LUNA Configurator before the FaceStream launching.

Parameters in Configurator#

Configurator includes records with the specified parameters.

Each of the Luna Configurator records contains a name, a tag, and a configuration body. A record corresponds to one of the configuration files.

Parameters in the Configurator services have the same names as in configuration files (fs3Config.conf, input.json, trackengine.conf) and documentation.

Table: Correspondence of the LUNA Configurator data and distribution configuration files

Record name in LUNA Configurator Corresponding configuration file Description
FS_STREAMS input.json Video-sources configuration
TRACK_ENGINE_CONFIG and FACE_STREAM_CONFIG trackengine.conf and fs3Config.conf General FaceStream configurations
WORKER_AND_MESSAGE_CONFIG web_tasks.conf settings for working with message queue

Set configurations for several FaceStream instances#

If a single FaceStream instance is working with the Configurator service, it uses the settings that are loaded by default.

If you want to use multiple FaceStream instances with different settings, create a separate record with a unique tag for each of these settings.

The tag is a unique identifier for the record and is specified in the launching keys described below. Thus a specific FaceStream instance can get its own unique settings.

Follow these steps:

  • Duplicate the record, for example, "FACE_STREAM_CONFIG", by pressing the Duplicate button.
Duplicate record
Duplicate record
  • Set a tag and specify parameters values.
Change tag
Change tag

Tags are not created for the default records.

Set up Configurator to work with FaceStream#

To configure FaceStream via Configurator, use one of the following files:

  • luna_configurator_dump file.json - the file is provided as an example of setting without parameters from the input.json file

  • luna_configurator_dump_with_streams_example.json - the file is provided as an example of setting with parameters from the input.json file.

Both files are located in the "./bin/data " directory.

  • Run the db_create.py script from the LUNA Configurator directory with the specified path to the luna_configurator_dump.json. The file is included in the FaceStream distribution package.

All the required parameters will be automatically added to Configurator.

This feature is available starting version 0.0.3 of LUNA Configurator.

Configurator is in Docker container#

The Configurator service can be delivered as a docker container.

Use the docker run command to add the dump file with FS configurations to the Configurator:

docker run \
-v /etc/localtime:/etc/localtime:ro \
-v <path_to_dump_file>/luna_configurator_dump.json:
/srv/luna_configurator/used_limitations/luna_configurator_dump.json \
-v $(pwd)/luna_configurator/configs/luna_configurator_postgres.conf:
/srv/luna_configurator/configs/config.conf \
--network=host  \
--rm  \
--entrypoint=python3.7 dockerhub.visionlabs.ru/luna/luna-configurator:<v.X.Y.Z> ./base_scripts/db_create.py --dump-file /srv/luna_configurator/used_limitations/luna_configurator_dump.json

-v <path_to_dump_file>/luna_configurator_dump.json:

/srv/luna_configurator/used_limitations/luna_configurator_dump.json

This command enables you to copy the dump file with all the FS configurations to the Configurator Docker container.

The dump file must be on the server with the launched Configurator container.

./base_scripts/db_create.py --dump-file

/srv/luna_configurator/used_limitations/luna_configurator_dump.json

This command adds all the configurations from the file to the Configurator service.

luna-configurator:<v.X.Y.Z> - you need to specify the Configurator service version instead of <v.X.Y.Z>. Check the LUNA PLATFORM installation instruction for this information.

Configurator distribution as set of files#

The Configurator service can be delivered as a set of files that should be configured and run in accordance with the LUNA PLATFORM documentation.

Follow these steps to add FaceStream settings to the Configurator service.

  • Go to the directory with the installed Configurator service.
cd /var/lib/luna/current/luna-configurator
  • Activate the virtual environment.
source venv/bin/activate
  • Run the following script for the Configurator database to add required parameters. You must specify the full path to the luna_configurator_dump.json.
python3.7 ./base_scripts/db_create.py --dump-file  <facestream_directory>/bin/data/luna_configurator_dump.json 

As a result, all the required parameters will be added. On the bases of these parameters, you can set your own record with required stream sources.

  • Deactivate virtual environment
deactivate

Launching in server mode with Configurator#

  • Launch using FaceStream URL and the path to the Configurator service.
cd ./bin
./FaceStream --http-address "http://<FS_server_IP>:34569" --configurator-address "http://<Configurator_server_IP>:5070" --streams-id "tag_1"

http://<Configurator_server_IP>:5070 - you must specify the valid URL and port for the Configurator service.

See all the available launching keys when using the Configurator service in the following section.

Launching keys for server mode only#

Use the following commands to show all the launch keys for the server mode.

cd ./bin
./FaceStream --help
  • --http_address(-A) - http address to listen by FaceStream. Its format is \<address:port> (required only when FaceStream is in http server mode). The user will send requests to this address.

    You should specify FaceStream server external IP.

    For Linux, default address is set to "http://0.0.0.0:34569".

Launching arguments when using configurator#

The following keys are available if you use the LUNA Configurator service:

  • --configurator-address (-Ca) is used to set a LUNA Configurator

    address. The address is used for saving/loading of the video-streams parameters and FaceStream configurations in LUNA Configurator.

    By default, the value is set to "default". In this case LUNA Configurator is not used and all the parameters will be applied according to the files from the distribution package.

  • --streams-id (-Sid) is used to set a LUNA Configurator tag, which

relates to the video-sources configuration.

If the value equals "\ "\ then saving/loading from LUNA Configurator will not be performed.

The ID of video-stream should be specified in the Configurator service to use the stream. When the video-stream is added using the API request, the ID is generated automatically.

If you specify a nonexistent tag, then a new record based on the FS_STREAMS record will be created in LUNA Configurator with the specified tag.

If the -Sid tag is not specified, the information about the video stream specified in the Configurator service is not used in FaceStream.

By default, the value equals "\ ".

The LUNA Configurator address (--configurator-address) should be specified for the launching key usage.

  • --configs-id (-Cid) is used to set a LUNA Configurator tag, which

relates to the FaceStream main configurations. The same tag should be set for TRACK_ENGINE_CONFIG and FACE_STREAM_CONFIG.

If the value is set to "\ "\ then the TRACK_ENGINE_CONFIG and FACE_STREAM_CONFIG records will be used by default. If the record by default does not exist or has an invalid JSON syntax, the configuration file from the distribution package will be used.

By default, the value equals "\ ".

The LUNA Configurator address (--configurator-address) should be specified for the launching key usage.

  • --tasks-config-id (-Tcid) is used to set a LUNA Configurator tag,

which relates to the message queue configuration.

If the value is set to "\ "\ then the configuration file from the distribution package will be used.

The LUNA Configurator address (configurator-address) should be specified for the launching key usage.

By default, the value equals "\ ".

Back to top