FindFace Video Worker Deployment on Remote Hosts

You can install findface-video-worker instances apart from the FindFace Multi principal server when creating a multi-host environment.

Important

Before deploying findface-video-worker instances on remote hosts, do the following:

On the FindFace Multi server, open the /opt/findface-multi/configs/findface-multi-legacy/findface-multi-legacy.py configuration file. Configure the value of the ROUTER_URL parameter, which is set to http://findface-multi-ui by default. Specify the external IP address of the FindFace Multi server in the ROUTER_URL parameter. The findface-video-worker instances on the remote hosts will be using this address for posting objects.

sudo vi /opt/findface-multi/configs/findface-multi-legacy/findface-multi-legacy.py

...

'ROUTER_URL': 'http://192.168.112.253',

...

To install only the findface-video-worker service, do the following:

Tip

Before deployment, get acquainted with the system requirements and prepare the server on Ubuntu or Debian.

  1. Download the installer file findface-*.run.

  2. Put the .run file into some directory on the designated host (for example, /home/username).

  3. From this directory, make the .run file executable.

    Note

    Be sure to specify the actual file name instead of findface-*.

    chmod +x findface-*.run
    
  4. Execute the .run file.

    sudo ./findface-*.run
    

    The installer will ask you a few questions and perform several automated checks to ensure that the host meets the system requirements. After filling out each prompt, press Enter. The questions and answers are the following:

    1. Q: Which product should be installed?

      A: 2

      Which product should be installed?
      
      -  1 [multi   ]  FindFace Multi
      -  2 [video-worker]  FindFace Video Worker
      
      (default: multi)
      product> 2
      
    2. Q: Which variant of Video Worker should be installed?

      A: Specify the findface-video-worker variant, CPU or GPU.

      Which variant of Video Worker should be installed?
      
      -  1 [cpu]  CPU-based implementation, slower but doesn't require GPU
      -  2 [gpu]  CUDA-based implementation of video detector, requires NVIDIA GPU
      
      (default: cpu)
      findface-video-worker.variant> 1
      
    3. Q: Directory to install into:

      A: Specify the FindFace Video Worker installation directory. By default, it’s /opt/findface-server. Press Enter to confirm it. Otherwise, specify the directory of your choice and press Enter.

      Directory to install into:
      (default: /opt/findface-server)
      dest_dir>
      
    4. Q: Please enter domain name or IP address to access License and Video Manager services:

      A: Specify the domain name or IP address that is used to access the findface-ntls and findface-video-manager services.

      Please enter domain name or IP address to access License and Video Manager services:
      server_addr> 192.168.112.253
      
    5. Q: Found X interface(s). Which one should we announce as our external address?

      A: Choose the interface that you are going to use as the instance IP address.

      Found 4 interface(s). Which one should we announce as our external address?
      
      -  1 [lo      ]  127.0.0.1
      -  2 [ens3    ]  192.168.112.254
      -  3 [docker0 ]  10.44.132.1
      -  4 [br-60d3cac2fd81]  10.44.0.1
      
      (default: 192.168.112.254)
      ext_ip.advertised> 2
      

    After that, the installation process will automatically begin.

  5. Perform post-installation procedures.

    Configure the findface-video-worker.yaml file and fill out the values for all required parameters. Make sure that detectors, normalizers, and extractors are specified in the models section and objects section has corresponding values. Below is an example of how the section should look like. It may vary depending on the recognition objects that you have selected.

    sudo vi /opt/findface-server/configs/findface-video-worker/findface-video-worker.yaml
    
    models:
      cache_dir: /var/cache/findface/models_cache
      detectors:
        car:
          fnk_path: /usr/share/findface-data/models/detector/car.gustav_normal.007.cpu.fnk
          min_size: 60
        body:
          fnk_path: /usr/share/findface-data/models/detector/bodydet.gustav_normal.022.cpu.fnk
          min_size: 60
        face:
          fnk_path: /usr/share/findface-data/models/detector/facedet.jasmine_fast.004.cpu.fnk
          min_size: 60
      normalizers:
        car_norm:
          fnk_path: /usr/share/findface-data/models/facenorm/cropbbox.v2.cpu.fnk
        car_norm_quality:
          fnk_path: /usr/share/findface-data/models/facenorm/cropbbox.v2.cpu.fnk
        body_norm:
          fnk_path: /usr/share/findface-data/models/facenorm/cropbbox.v2.cpu.fnk
        body_norm_quality:
          fnk_path: /usr/share/findface-data/models/facenorm/cropbbox.v2.cpu.fnk
        face_norm:
          fnk_path: /usr/share/findface-data/models/facenorm/crop2x.v2_maxsize400.cpu.fnk
        face_norm_quality:
          fnk_path: /usr/share/findface-data/models/facenorm/crop1x.v2_maxsize400.cpu.fnk
      extractors:
        car_quality:
          fnk_path: /usr/share/findface-data/models/carattr/carattr.license_plate_quality.v4.cpu.fnk
          normalizer: car_norm_quality
        body_quality:
          fnk_path: /usr/share/findface-data/models/pedattr/pedattr.quality.v0.cpu.fnk
          normalizer: body_norm_quality
        face_quality:
          fnk_path: /usr/share/findface-data/models/faceattr/faceattr.quality.v5.cpu.fnk
          normalizer: face_norm_quality
      objects:
        car:
          normalizer: car_norm
          quality: car_quality
          track_features: ''
        body:
          normalizer: body_norm
          quality: body_quality
          track_features: ''
        face:
          normalizer: face_norm
          quality: face_quality
          track_features: ''
    

    Restart the findface-server-findface-video-worker-1 container.

    sudo docker restart findface-server-findface-video-worker-1
    

Note

If findface-ntls and/or findface-video-manager are installed on different hosts, specify their IP addresses in the /opt/findface-server/configs/findface-video-worker/findface-video-worker.yaml configuration file after the installation. Consider findface-ntls is installed on the principal server 192.168.112.253, and findface-video-manager is installed on an additional server 192.168.112.252, then configure the /opt/findface-server/configs/findface-video-worker/findface-video-worker.yaml file accordingly.

sudo vi /opt/findface-server/configs/findface-video-worker/findface-video-worker.yaml

In the ntls_addr parameter, specify the findface-ntls host IP address.

ntls_addr: 192.168.112.253:3133

In the mgrstatic parameter, specify the findface-video-manager host IP address, which provides findface-video-worker with settings and the video stream list.

static: 192.168.112.252:18811

Tip

To install a findface-video-worker instance on a different host, use the automatic deployment from the installation file. In this case, you won’t have to answer the installation questions again. The exact path to the installation file is displayed right after the last question before the installer starts active progress:

[I 2023-02-09 11:13:37,187 main:142] Your answers were saved to /tmp/findface-installer-p01n9sn3.json

To launch the automatic deployment from the /tmp/<findface-installer-*>.json file, execute:

sudo ./<findface-*>.run -f /tmp/<findface-installer-*>.json

If your findface-video-worker instance is deployed in a multi-GPU environment, you will have to manually configure the /opt/findface-server/docker-compose.yaml file.

  1. In the /opt/findface-server/docker-compose.yaml file in the services section, specify the findface-video-worker configuration for each running findface-video-worker instance. In the environment parameter, specify the correct GPU ID for CUDA_VISIBLE_DEVICES. Stick to the example below:

    sudo vi /opt/findface-server/docker-compose.yaml
    
    services:
      ...
      findface-video-worker:
        command: [--config=/etc/findface-video-worker.yaml]
        environment: [CUDA_VISIBLE_DEVICES=0]
        image: docker.int.ntl/ntech/universe/video-worker-gpu:ffserver-12.241211.2
        logging: {driver: journald}
        network_mode: host
        restart: always
        runtime: nvidia
        volumes: ['./configs/findface-video-worker/findface-video-worker.yaml:/etc/findface-video-worker.yaml:ro',
          './models:/usr/share/findface-data/models:ro', './cache/findface-video-worker/models:/var/cache/findface/models_cache',
          './cache/findface-video-worker/recorder:/var/cache/findface/video-worker-recorder']
      findface-video-worker-1:
        command: [--config=/etc/findface-video-worker-1.yaml]
        environment: [CUDA_VISIBLE_DEVICES=1]
        image: docker.int.ntl/ntech/universe/video-worker-gpu:ffserver-12.241211.2
        logging: {driver: journald}
        network_mode: host
        restart: always
        runtime: nvidia
        volumes: ['./configs/findface-video-worker/findface-video-worker-1.yaml:/etc/findface-video-worker-1.yaml:ro',
          './models:/usr/share/findface-data/models:ro', './cache/findface-video-worker/models:/var/cache/findface/models_cache',
          './cache/findface-video-worker/recorder:/var/cache/findface/video-worker-recorder']
    
  2. In the same section, specify the environment variables for each findface-video-worker instance. Stick to the example below:

    findface-video-worker:
      image: docker.int.ntl/ntech/universe/video-worker-gpu:ffserver-12.241211.2
      ...
      environment:
        - CFG_MGR_STATIC=vm:18811
        - CFG_NTLS_ADDR=ntls:3133
        - CFG_STREAMER_PORT=9999
        - CFG_STREAMER_URL=127.0.0.1:9999
        - CFG_STREAMER_TRACKS=true
        #- CFG_RESOLUTIONS=1920x1080
    

    For help on environment variables, execute the following command, minding the findface-video-worker variant: findface-video-worker-cpu or findface-video-worker-gpu.

    docker exec -it findface-server-findface-video-worker-1 ./findface-video-worker-cpu --help
    

    Important

    For the correct operation, multiple findface-video-worker instances should not refer to the same CFG_STREAMER_PORT. Make sure that you have specified a unique CFG_STREAMER_PORT for each findface-video-worker instance.

    Important

    Specify the CFG_STREAMER_URL parameter with the IP address of the server on which the findface-video-worker is deployed. This parameter is responsible for the operation of the Video Wall.

  3. Rebuild all containers.

    cd /opt/findface-server
    
    sudo docker-compose down
    sudo docker-compose up -d