Install Step-by-Step
This section will guide you through the FindFace Enterprise Server step-by-step installation process. Follow the instructions below minding the sequence.
In this section:
Install APT Repository
First of all, install the FindFace apt repository as follows:
Download the installer file
<findface-security-and-server-xxx>.run.Put the
.runfile into some directory on the designated host (for example,/home/username).From this directory, make the
.runfile executable.chmod +x <findface-security-and-server-xxx>.run
Execute the
.runfile.sudo ./<findface-security-and-server-xxx>.run
The installer will ask you a few questions and perform several automated checks to ensure that the host meets the system requirements. Fill out the prompts appropriately once requested. The questions are the following:
Product to install:
FindFace Server.Installation type:
repo: Don't install anything, just set up the APT repository.Neural network models to install if necessary. To select a model(s), deselect all those on the list by entering
-*in the command line first, then select the required model by entering its sequence number (keyword): for example,1 3. Enterdoneto save your selection and proceed to another step.Important
At least one model for face biometry has to be installed.
After that, the FindFace apt repository will be automatically installed.
Prerequisites
FindFace Enterprise Server requires such third-party software as etcd and memcached. Do the following:
Install the prerequisite packages as such:
sudo apt update sudo apt install -y etcd memcached
Open the
memcachedconfiguration file. Set the maximum memory to use for items in megabytes:-m 512. Set the max item size:-I 16m. If one or both of these parameters are absent, add them to the file.sudo vi /etc/memcached.conf -m 512 -I 16m
Enable the prerequisite services autostart and launch the services:
sudo systemctl enable etcd.service memcached.service sudo systemctl start etcd.service memcached.service
Provide Licensing
You receive a license file from your Ntech Lab manager. If you opt for the on-premise licensing, we will also send you a USB dongle.
The FindFace Enterprise Server licensing is provided as follows:
Deploy
findface-ntls, license server in the FindFace core.sudo apt update sudo apt install -y findface-ntls sudo systemctl enable findface-ntls.service && sudo systemctl start findface-ntls.service
Important
There must be only one
findface-ntlsinstance in each FindFace Enterprise Server installation.Tip
In the
findface-ntlsconfiguration file, you can change the license folder and specify your proxy server IP address if necessary. You can also change thefindface-ntlsweb interface remote access settings. See findface-ntls for details.Upload the license file via the
findface-ntlsweb interface in one of the following ways:Navigate to the
findface-ntlsweb interfacehttp://<NTLS_IP_address>:3185/#/. Upload the license file.Tip
Later on, use the
findface-ntlsweb interface to consult your license information, and upgrade or extend your license.Directly put the license file into the license folder (by default,
/ntech/license, can be changed in the/etc/findface-ntls.cfgconfiguration file).
For the on-premise licensing, insert the USB dongle into a USB port.
If the licensable components are installed on remote hosts, specify the IP address of the
findface-ntlshost in their configuration files. See findface-extraction-api, findface-tarantool-server, Video face detection: findface-video-manager and findface-video-worker for details.
Deploy findface-extraction-api
To deploy the findface-extraction-api component, do the following:
Important
This component requires the installation of neural network models.
Install
findface-extraction-apias such:sudo apt install -y findface-extraction-api
Note
To install the GPU-accelerated
findface-extraction-apicomponent, usefindface-extraction-api-gpuin the command.Open the
findface-extraction-api.iniconfiguration file.sudo vi /etc/findface-extraction-api.ini
Specify the IP address of the
findface-ntlshost iffindface-ntlsis installed on a remote host. See Provide Licensing.license_ntls_server: 192.168.113.2:3133
Configure other parameters if needed. For example, enable or disable fetching Internet images.
fetch: enabled: true size_limit: 10485760
The
min_face_sizeandmax_face_sizeparameters do not work as filters. They instead indicate the guaranteed detection interval. Pick up their values carefully as these parameters affect performance.nnd: min_face_size: 30 max_face_size: .inf
The
instancesparameter indicates how manyfindface-extraction-apiinstances are used. Specify the number of instances from your license. The default value (0) means that this number is equal to the number of CPU cores.Note
This parameter severely affects RAM consumption.
instances: 2
To estimate the face quality, enable the
quality_estimator. In this case,extraction-apiwill return the quality score in the detection_score parameter.Tip
Interpret the quality score further in analytics. Upright faces in frontal position are considered the best quality. They result in values around
0, mostly negative (such as-0.00067401276, for example). Inverted faces and large face angles are estimated with negative values some-5and less.quality_estimator: true
Enable recognition models for face features such as gender, age, emotions, glasses3, and/or beard, subject to your needs. Be sure to choose the right acceleration type for each model, matching the acceleration type of
findface-extraction-api: CPU or GPU. Be aware thatfindface-extraction-apion CPU can work only with CPU-models, whilefindface-extraction-apion GPU supports both CPU- and GPU-models.models: age: faceattr/age.v1.cpu.fnk emotions: faceattr/emotions.v1.cpu.fnk face: face/grapefruit_480.cpu.fnk gender: faceattr/gender.v2.cpu.fnk beard: faceattr/beard.v0.cpu.fnk glasses3: faceattr/glasses3.v0.cpu.fnk
The following models are available:
Face feature
Acceleration
Configuration file parameter
face (biometry)
CPU
face: face/grapefruit_480.cpu.fnkGPU
face: face/grapefruit_480.gpu.fnkage
CPU
age: faceattr/age.v1.cpu.fnkGPU
age: faceattr/age.v1.gpu.fnkgender
CPU
gender: faceattr/gender.v2.cpu.fnkGPU
gender: faceattr/gender.v2.gpu.fnkemotions
CPU
emotions: faceattr/emotions.v1.cpu.fnkGPU
emotions: faceattr/emotions.v1.gpu.fnkglasses3
CPU
glasses3: faceattr/glasses3.v0.cpu.fnkGPU
glasses3: faceattr/glasses3.v0.gpu.fnkbeard
CPU
beard: faceattr/beard.v0.cpu.fnkGPU
beard: faceattr/beard.v0.gpu.fnkTip
To disable a recognition model, pass an empty value to a relevant parameter. Do not remove the parameter itself as in this case the system will be searching for the default model.
models: gender: "" age: "" emotions: ""
Enable the
findface-extraction-apiservice autostart and launch the service.sudo systemctl enable findface-extraction-api.service && sudo systemctl start findface-extraction-api.service
Deploy findface-tarantool-server
The findface-tarantool-server component connects the Tarantool database and the findface-sf-api component, transferring search results from the database to findface-sf-api for further processing. To increase search speed, multiple findface-tarantool-server shards can be created on each Tarantool host. Their running concurrently leads to a remarkable increase in performance.
Each shard can handle up to approximately 10,000,000 faces. In the case of the standalone deployment, you need only one shard (already created by default). In a cluster environment, the number of shards has to be calculated depending on your hardware configuration and database size (see details below).
To deploy the findface-tarantool-server component, do the following:
Install
findface-tarantool-serversudo apt update sudo apt install -y findface-tarantool-server
Disable autostart and stop the Tarantool exemplary service.
sudo systemctl disable tarantool@example && sudo systemctl stop tarantool@example
Open the configuration file:
sudo vi /etc/tarantool/instances.enabled/FindFace.lua
Edit the maximum memory usage. The memory usage must be set in bytes, depending on the number of faces the shard handles, at the rate roughly 1280 byte per face. For example, the value
1.2*1024*1024*1024corresponds to 1,000,000 faces:memtx_memory = 1.2 * 1024 * 1024 * 1024,
Specify the IP address of the
findface-ntlshost iffindface-ntlsis installed on a remote host:FindFace.start(“127.0.0.1”, 8001, {license_ntls_server=“192.168.113.2:3133”})By default, you can access Tarantool only from the localhost (
127.0.0.1). If you plan to be accessing Tarantool from a certain remote host, either specify this remote host IP address in theFindFace.startsection, or change127.0.0.1to0.0.0.0in the same section to allow access to Tarantool from any IP address.Tip
To allow access only from a certain remote host (
192.168.113.10in the example), configure as follows:FindFace.start("192.168.113.10", 8001, {license_ntls_server=“192.168.113.2:3133”})To allow access from any IP address, apply
0.0.0.0instead:FindFace.start("0.0.0.0", 8001, {license_ntls_server=“192.168.113.2:3133”})In the
meta_schemeparameter, create a database structure to store the face recognition results. The structure is created as a set of fields. Describe each field with the following parameters:id: field id;
name: field name, must be the same as the name of a relevant face parameter;
field_type: data type;
default: field default value. If a default value exceeds ‘1e14 – 1’, use a string data type to specify it, for example,
"123123.."instead of123123...
box.cfg{ listen = '127.0.0.1:33001', vinyl_dir = '/opt/ntech/var/lib/tarantool/name', work_dir = '/opt/ntech/var/lib/tarantool/name', memtx_dir = '/opt/ntech/var/lib/tarantool/name/snapshots', wal_dir = '/opt/ntech/var/lib/tarantool/name/xlogs', memtx_memory = 16 * 1024 * 1024 * 1024, checkpoint_interval = 3600*4, checkpoint_count = 3, -- force_recovery = true, } pcall(function() box.schema.user.grant('guest', 'execute,read,write', 'universe') end) FindFace = require("FindFace") FindFace.start( "0.0.0.0", 8001, { license_ntls_server="127.0.0.1:3133", facen_size=480, meta_scheme = { { id = 1, name = 'm:timestamp', field_type = 'unsigned', default = 0 }, { id = 2, name = 'feat', field_type = 'string', default = "" }, { id = 3, name = 'normalized_id', field_type = 'string', default = "" }, { id = 4, name = 'm:camera', field_type = 'string', default = "" }, { id = 5, name = 'm:photo', field_type = 'string', default = "" }, { id = 6, name = 'm:thumbnail', field_type = 'string', default = "" }, { id = 7, name = 'm:score', field_type = 'unsigned', default = "10000000000000000000" }, { id = 8, name = 'm:bbox', field_type = 'string', default = "" }, { id = 9, name = 'm:labels', field_type = 'set[string]', default = {} }, { id = 10, name = 'm:is_friend', field_type = 'unsigned', default = 0 }, } } )
(Optional) If there are more than 10,000,000 faces or so on a single shard, the search may take too long. In the case of a large installation, it is advised to create additional
findface-tarantool-servershards, observing the following rules:One shard can successfully handle up to approximately 10,000,000 faces.
The number of shards on a single host must not exceed the number of CPU memory channels, multiplied by 2. Bear it in mind, when designing your system architecture in a cluster environment.
To create multiple shards, multiply the configuration file for the default shard
/etc/tarantool/instances.enabled/FindFace.lua. Then override the default shard IP address and port with new values. To do so, write a bash script (e.g.,shard.sh) that will automatically create configuration files for all shards on a particular host. The script below can be used as an excellent starting point for your own code. The exemplary script creates 4 shards listening to the ports:findface-tarantool-server33001..33004and HTTP8001..8004.#!/bin/sh set -e for I in `seq 1 4`; do TNT_PORT=$((33000+$I)) && HTTP_PORT=$((8000+$I)) && sed " s#/opt/ntech/var/lib/tarantool/default#/opt/ntech/var/lib/tarantool/shard_$I#g; s/listen = .*$/listen = '127.0.0.1:$TNT_PORT',/; s/\"127.0.0.1\", 8001,/\"0.0.0.0\", $HTTP_PORT,/; " /etc/tarantool/instances.enabled/FindFace.lua > /etc/tarantool/instances.enabled/FindFace_shard_$I.lua; mkdir -p /opt/ntech/var/lib/tarantool/shard_$I/snapshots mkdir -p /opt/ntech/var/lib/tarantool/shard_$I/xlogs mkdir -p /opt/ntech/var/lib/tarantool/shard_$I/index chown -R tarantool:tarantool /opt/ntech/var/lib/tarantool/shard_$I echo "Shard #$I inited" done;Tip
Download the
exemplary script.Run the script from the home directory.
sudo sh ~/shard.sh
Check the configuration files created.
ls /etc/tarantool/instances.enabled/ ##example.lua FindFace.lua FindFace_shard_1.lua FindFace_shard_2.lua FindFace_shard_3.lua FindFace_shard_4.lua
Enable the
findface-tarantool-servershard autostart and launch the shard.sudo systemctl enable tarantool@FindFace.service && sudo systemctl start tarantool@FindFace.service
In the case of multiple shards, you can do so by analogy with the following example (launching 4 shards):
for I in `seq 1 4`; do sudo systemctl enable tarantool@FindFace_shard_$I; done; for I in `seq 1 4`; do sudo systemctl start tarantool@FindFace_shard_$I; done;
Deploy findface-upload
To store all original images ever sent to the system for processing, as well as such FindFace core artifacts as face thumbnails and normalized images, you will need the findface-upload service.
Tip
Skip the findface-upload deployment if you do not want to store these data on the FindFace Enterprise Server host. In this case, the system will be saving only face features vectors (biometric samples) in the Tarantool-powered biometric database.
Install findface-upload as such:
sudo apt update sudo apt install -y findface-upload
By default, the original images, thumbnails, and normalized images are stored at /var/lib/ffupload/uploads/.
Deploy findface-sf-api
To deploy the findface-sf-api component, do the following:
Install
findface-sf-apias such:sudo apt update sudo apt install -y findface-sf-api
Open the
/etc/findface-sf-api.iniconfiguration file.sudo vi /etc/findface-sf-api.ini
If FindFace Enterprise Server is being deployed in a cluster environment, specify the IP addresses and ports of the
findface-extraction-apihost (theextraction-apiparameter), thefindface-tarantool-servershards (storage-api, in the format:http://IP_address:port/v2/), and thefindface-uploadhost (upload_url).extraction-api: extraction-api: http://10.220.85.120:18666 storage-api: shards: - master: http://10.200.85.115:8003/v2/ - master: http://10.200.85.120:8004/v2/ - master: http://10.200.85.120:8005/v2/ - master: http://10.200.85.120:8006/v2/ slave: ‘’ upload_url: http://127.0.0.1:3333/uploads/
Enable the
findface-sf-apiservice autostart and launch the service.sudo systemctl enable findface-sf-api.service && sudo systemctl start findface-sf-api.service
Deploy findface-facerouter
To deploy the findface-facerouter component, do the following:
Install
findface-facerouteras such:sudo apt update sudo apt install -y findface-facerouter
Open the
/etc/findface-facerouter.pyconfiguration file.sudo vi /etc/findface-facerouter.py
If the
findface-facerouterandfindface-sf-apicomponents are installed on different hosts, uncomment thesfapi_urlparameter and specify thefindface-sf-apihost IP address.sfapi_url = 'http://localhost:18411'
Enable the
findface-facerouterservice autostart and launch the service.sudo systemctl enable findface-facerouter.service && sudo systemctl start findface-facerouter.service
Deploy Video Face Detection
Video face detection is provided by the findface-video-manager and findface-video-worker components.
To deploy the findface-video-manager component, do the following:
Install
findface-video-manager:sudo apt install -y findface-video-manager
Open the
/etc/findface-video-manager.confconfiguration file.sudo vi /etc/findface-video-manager.conf
In the
router_urlparameter, specify the IP address and port of thefindface-faceroutercomponent which will receive detected faces fromfindface-video-worker.router_url: http://127.0.0.1:18820/v0/frame
In the
ntls -> urlparameter, specify the IP address of thefindface-ntlshost iffindface-ntlsis installed on a remote host.ntls: url: http://127.0.0.1:3185/
If necessary, configure the video processing settings which apply to all video streams in the system.
Tip
You can skip this step: when creating a job for
findface-video-manager, you will be able to individually configure processing settings for each video stream (see Video Face Detection API).Enable the
findface-video-managerservice autostart and launch the service.sudo systemctl enable findface-video-manager.service && sudo systemctl start findface-video-manager.service
To deploy the findface-video-worker component, do the following:
Install
findface-video-worker:sudo apt update sudo apt install -y findface-video-worker-cpu
Note
To install the GPU-accelerated
findface-video-workercomponent, usefindface-video-worker-gpuin the command. If you have several video cards on your server, see Multiple Video Cards Usage.Open the
/etc/findface-video-worker-cpu.ini(/etc/findface-video-worker-gpu.ini) configuration file.sudo vi /etc/findface-video-worker-cpu.ini sudo vi /etc/findface-video-worker-gpu.ini
In the
ntls-addrparameter, specify the IP address of thefindface-ntlshost iffindface-ntlsis installed on a remote host.ntls-addr=127.0.0.1:3133
In the
mgr-staticparameter, specify the IP address of thefindface-video-managerhost that will be providingfindface-video-workerwith settings and the list of to-be-processed video streams.mgr-static=127.0.0.1:18811
In the
capacityparameter, specify the maximum number of video streams thatfindface-video-workeris allowed to process.capacity=10
Enable the
findface-video-workerautostart and launch the service.sudo systemctl enable findface-video-worker-cpu.service && sudo systemctl start findface-video-worker-cpu.service