Deploy Step-by-Step from Repository¶
This section will guide you through the FindFace Security step-by-step deployment process. Follow the instructions below minding the sequence.
In this section:
Get Distributable Packages¶
If you opt to deploy FindFace Security from an APT repository, you will be provided with the following packages:
<ffsecurity-repo*.deb>: a deb-package that installs a local repository with components.<findface-data*.deb>: a deb-package(s) that installs neural network models for face detection and face features recognition.
You receive the packages from your Ntech Lab manager.
Note
You can deploy step-by-step by using the FindFace Security console installer.
Prepare Packages for Installation¶
To prepare the distributable packages for installation, do the following:
Unpack the package with components on each designated host.
sudo dpkg -i <ffsecurity-repo>.deb
Add a signature key on each designated host.
sudo apt-key add /var/ffsecurity-repo/public.key sudo apt update
Unpack the packages with models (face, gender, age, emotions, etc.). In the cluster environment, models are installed only on the
findface-extraction-apihosts.sudo dpkg -i findface-data*
Prerequisites¶
FindFace Security requires such third-party software as PostgreSQL, Redis, etcd, and memcached. Do the following:
Install the prerequisite packages as such:
sudo apt update sudo apt install -y postgresql-9.5 redis-server 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, simply add them in the file.sudo vi /etc/memcached.conf -m 512 -I 16m
Enable the prerequisite services autostart and launch the services:
sudo systemctl enable postgresql@9.5-main.service redis-server etcd.service memcached.service sudo systemctl start postgresql@9.5-main.service redis-server etcd.service memcached.service
Provide Licensing¶
You receive a license file from your NTechLab manager. If you opt for the on-premise licensing, we will also send you a USB dongle.
The FindFace Security licensing is provided as follows:
Deploy
findface-ntls, license server in the FindFace core.Important
There must be only one
findface-ntlsinstance in eachFindFace Securityinstallation.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.sudo apt update sudo apt install -y findface-ntls sudo systemctl enable findface-ntls.service && sudo systemctl start findface-ntls.service
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 Security main web 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.
See also
Deploy Main Database¶
In FindFace Security, the main system database is based on PostgreSQL. To deploy the main database, do the following:
Using the PostgreSQL console, create a new user
ntechand a databaseffsecurityin PostgreSQL.sudo -u postgres psql postgres=# CREATE ROLE ntech WITH LOGIN; postgres=# CREATE DATABASE ffsecurity WITH OWNER ntech ENCODING 'UTF-8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE template0;
Tip
To quit from the PostgreSQL console, type
\qand press Enter.Allow authentication in PostgreSQL by UID of a socket client. Restart PostgreSQL.
echo 'local all ntech peer' | sudo tee -a /etc/postgresql/9.5/main/pg_hba.conf sudo systemctl restart postgresql@9.5-main.service
Deploy FindFace Core¶
To deploy the FindFace core, do the following:
Tip
You can find the description of the FindFace core components and their configuration parameters in Architecture and Components in Depth.
Install the FindFace core components:
sudo apt update sudo apt install -y findface-tarantool-server findface-extraction-api findface-sf-api findface-upload findface-video-manager findface-video-worker
Note
To install the GPU-accelerated
findface-extraction-apicomponent, usefindface-extraction-api-gpuinstead offindface-extraction-apiin the command.Note
To install the GPU-accelerated
findface-video-workercomponent, usefindface-video-worker-gpuinstead offindface-video-workerin the command.Open the
findface-extraction-apiconfiguration file (CPU or GPU service). Enable thequality_estimatorto be able to estimate the face quality in a dossier.Note
The minimum face quality in a dossier photo is set as
MINIMUM_DOSSIER_QUALITYin/etc/ffsecurity/config.py.sudo vi /etc/findface-extraction-api.ini quality_estimator: true
In the
findface-extraction-apiconfiguration file, 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 offindface-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/elderberry_576.cpu.fnk gender: faceattr/gender.v2.cpu.fnk beard: faceattr/beard.v0.cpu.fnk
The following models are available:
Face feature Acceleration Configuration file parameter face (biometry) CPU face: face/elderberry_576.cpu.fnkGPU face: face/elderberry_576.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, simply 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: ""
Open the
/etc/findface-video-worker.ini(/etc/findface-video-worker-gpu.ini) configuration file. In themgr-staticparameter, specify thefindface-video-managerhost IP address, which providesfindface-video-workerwith settings and the video stream list. In thecapacityparameter, specify the maximum number of video streams to be processed byfindface-video-worker.sudo vi /etc/findface-video-worker.ini sudo vi /etc/findface-video-worker-gpu.ini mgr-static=127.0.0.1:18811 capacity=10
Enable the FindFace core services autostart and launch the services.
sudo systemctl enable findface-extraction-api findface-sf-api findface-video-manager findface-video-worker sudo systemctl start findface-extraction-api findface-sf-api findface-video-manager findface-video-worker
Deploy FindFace Security Application Module and Biometric Database¶
To deploy the FindFace Security application module, do the following:
Install the
ffsecurityandffsecurity-uicomponents from the <ffsecurity-repo>.deb package.sudo apt update sudo apt install -y ffsecurity ffsecurity-ui
Migrate the database architecture from FindFace Security to PostgreSQL, create user groups with predefined rights and the first user with administrator rights (a.k.a. Super Administrator).
Important
Super Administrator cannot be deprived of its rights, whatever the role.
sudo findface-security migrate sudo findface-security create_groups sudo findface-security createsuperuser --username admin --email root@localhost
Create a structure of the Tarantool-based biometric database.
sudo findface-security make_tnt_schema | sudo tee /etc/ffsecurity/tnt-schema.lua
Import the
meta_schemevariable from thetnt-schema.luafile. Open the/etc/tarantool/instances.enabled/FindFace.luaconfiguration file. Before theFindFace.startsection, add a linedofile("/etc/ffsecurity/tnt-schema.lua"). In theFindFace.startparameters, definemeta_scheme=meta_scheme.sudo vi /etc/tarantool/instances.enabled/FindFace.lua dofile("/etc/ffsecurity/tnt-schema.lua") FindFace.start("@TNT_FF_LISTEN_IP@", @TNT_FF_LISTEN_PORT@, { license_ntls_server="@TNT_FF_NTLS@", facen_size=576, meta_scheme = meta_scheme })
Enable the
findface-tarantool-serverservice autostart and launch the service.sudo systemctl enable tarantool@FindFace.service && sudo systemctl start tarantool@FindFace.service
Open the
/etc/ffsecurity/config.pyconfiguration file. Specify the following parameters:EXTERNAL_ADDRESS: external IP address or URL that will be used to access the FindFace Security web interface.VIDEO_DETECTOR_TOKEN: to authorize the video face detection module, come up with a token and specify it here.VIDEO_MANAGER_ADDRESS: IP address of thefindface-video-managerhost.NTLS_HTTP_URL: IP address of thefindface-ntlshost.ROUTER_URL: IP address of theffsecurityhost that will receive detected faces from thefindface-video-workerinstance(s). Specify either external or internal IP address, subject to the network through whichfindface-video-workerinteracts withffsecurity.SF_API_ADDRESS: IP address of thefindface-sf-apihost.
Tip
If necessary, ensure data security by enabling SSL.
Tip
If necessary, set
’IGNORE_UNMATCHED’: Trueto disable logging events for faces which have no match in the dossiers (negative verification result). Enable this option if the system has to process a large number of faces. The face similarity threshold for verification is defined by theCONFIDENCE_THRESHOLDparameter.Tip
It is recommended to change the
MINIMUM_DOSSIER_QUALITYdefault value. This parameter determines the minimum quality of a face in a dossier photo. Photos containing faces of worse quality will be rejected when uploading to a dossier. 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 -5 and less. By default,’MINIMUM_DOSSIER_QUALITY’: -2which is the average quality.Important
If you enabled recognition models in the
findface-extraction-apiconfiguration file, add the following line in theFFSECURITYsection: ‘EVENTS_FEATURES’: [‘gender’, ‘age’, ‘emotions’, ‘beard’, ‘glasses’], subject to the list of enabled models.sudo vi /etc/ffsecurity/config.py MEDIA_ROOT="/var/lib/ffsecurity/uploads" STATIC_ROOT="/var/lib/ffsecurity/static" EXTERNAL_ADDRESS="http://172.20.77.23" DEBUG = False LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'ffsecurity', } } # use pwgen -sncy 50 1|tr "'" "." to generate your own unique key SECRET_KEY = 'changeme' FFSECURITY = { 'VIDEO_DETECTOR_TOKEN': 'GOOD_TOKEN', 'CONFIDENCE_THRESHOLD': 0.75, 'MINIMUM_DOSSIER_QUALITY': -2, 'IGNORE_UNMATCHED': False, 'VIDEO_MANAGER_ADDRESS': 'http://127.0.0.1:18810', 'EVENTS_MAX_AGE': 30, 'NTLS_HTTP_URL': 'http://127.0.0.1:3185', 'ROUTER_URL': 'http://172.20.77.23', 'MONITORING_UPDATE_INTERVAL': 60, 'SF_API_ADDRESS': 'http://127.0.0.1:18411', 'EVENTS_FEATURES': ['gender', 'age', 'beard', 'glasses'], } FFSECURITY_UI_CONFIG = { } # integration plugins INSTALLED_APPS.append('ffsecurity_genetec') # remove or comment out this line to disable genetec integration```
Generate a signature key for the session encryption (used by Django) by executing:
pwgen -sncy 50 1|tr “’” “.”. Specify this key asSECRET_KEY.Start the services.
Important
The
ffsecurityservice includesfindface-security-proto(provides HTTP and web socket),findface-security-worker(provides interaction with the other system components),findface-security-monitoring-updater, andfindface-security-webhook-updater.Important
The number of the
findface-security-workerinstances is calculated using the formula:N=(number of CPU cores-1), and specified after the@character, for example,findface-security-worker@{1,2,3}indicates 3 instances.In the example below,
findface-security-workerhas 4 instances.sudo systemctl enable findface-security-proto findface-security-worker@{1,2,3,4} findface-security-monitoring-updater findface-security-webhook-updater sudo systemctl start findface-security-proto findface-security-worker@{1,2,3,4} findface-security-monitoring-updater findface-security-webhook-updater
Important
For high load projects, start more instances of
findface-security-worker. The main indicator that allocated resources are not enough and you should start morefindface-security-workerinstances is errors in the web interface.Disable the default nginx server and add the
ffsecurityserver to the list of enabled servers. Restart nginx.sudo rm /etc/nginx/sites-enabled/default sudo ln -s /etc/nginx/sites-available/ffsecurity-nginx.conf /etc/nginx/sites-enabled/ sudo nginx -s reload