FALPRS
This project is a replacement for the old one. Key differences:
- PostgreSQL is used as the DBMS.
- The project is written in Rust without unsafe code and uses Tokio — an open-source asynchronous runtime.
- Strict data type compliance in API requests. For example, if a numeric field is expected, it must not be enclosed in quotes.
- Added license plate recognition system (LPRS).
Table of Contents
- LPRS
- Neural Network Models Used
- General Scheme of Interaction with LPRS
- Automatic Plate Banning
- FRS
- Neural Network Models Used
- General Scheme of Interaction with FRS
- Project Build and Configuration
- System Requirements
- NVIDIA Driver Installation
- Docker Engine Installation
- NVIDIA Container Toolkit Installation
- PostgreSQL Installation
- Environment Variables
- Initializing PostgreSQL
- Building the Project
- Creating TensorRT Plans for Neural Network Models
- Project Configuration
- Managing Video Stream Groups
- Project Update
- Examples
- LPRS
- FRS
- Tests
- LPRS
- FRS
- Service Endpoints
- Rust Unit Tests
- Stress Tests
- Data Synchronization with the Deprecated FRS Project
- Examples of CPU and GPU Load Charts
LPRS
The system is designed for license plate recognition and detection of special vehicles with sirens: ambulances, emergency services, police, etc. Currently, Russian registration plates of type 1 (GOST R 50577-93) and 1A (GOST R 50577-2018) are supported:

Neural Network Models Used
The service works with five neural networks: VDNet, VCNet, LPDNet, LPCNet, and LPRNet. VDNet is designed to search for vehicles in the captured image from the video camera. VCNet determines whether each found vehicle is a special vehicle. LPDNet is designed to search for license plates. LPCNet classifies the found plates. LPRNet is designed for plate recognition from the data obtained by LPDNet. The VDNet, LPDNet, and LPRNet models are trained using Ultralytics. The VCNet and LPCNet models are obtained through transfer learning with fine-tuning. This model is used as the base.
The experimental vehicle footprint detection (the detectVehicleFootprints method of the Rust version) uses the uodnet model: UrbanOmniDetect-2 L, a YOLO26 detector that also regresses the 3D cuboid of each vehicle. The model is distributed under the AGPL-3.0 license.
NVIDIA Triton Inference Server is used for neural network inference.
General Scheme of Interaction with LPRS
The API is used to interact with the service, a detailed description of which is in the repository in the docs/openapi.yaml file. First, you need to register the video streams that the system will work with. The addStream API method is used for this. Main parameters:
- streamId — internal identifier for your backend (external for LPRS) for the video stream;
- config — configuration parameters. Example request body:
{
"streamId": "1234",
"config": {
"screenshot-url": "https://my.video.stream/capture",
"callback-url": "https://my.host/callback?streamId=1"
}
}
Now LPRS knows that frame capture should be done using the specified screenshot-url parameter, and upon detection of special vehicles or license plate recognition, send brief information via HTTP POST to the callback-url. To start LPRS processing frames, call the startWorkflow API method. Example request body:
{
"streamId": "1234"
}
The system will start a cyclic process: capturing a frame, processing it with neural networks, and sending information to the callback-url if required. Then a pause for some time, and capturing a frame again, processing, etc. To stop the process, call the stopWorkflow API method. Example request body:
{
"streamId": "1234"
}
To reduce system load, we recommend calling startWorkflow and stopWorkflow, for example, in accordance with the camera's video analytics: motion detector, line crossing, intrusion detection, etc. When receiving brief information about recognized plates, your backend should process it. For example, check the obtained plates against the allowed list and open the gates or simply ignore them. Plate recognition events are stored in LPRS for some time. If full event information is required, use the getEventData API method. The removeStream API method is used to delete a video stream. Use listStreams to get information about the video streams registered in LPRS.
Automatic Plate Banning
To prevent callback request spamming, a two-stage plate banning is used. If the system sees a plate for the first time, it will end up in the first banning stage after processing: for some time (configuration parameter ban-duration), the plate is ignored regardless of its location in the frame. If the system sees this plate again in the first stage, the ban time is extended. After the first stage ends, the plate moves to the next one. In the second banning stage (configuration parameter ban-duration-area), the plate is ignored as long as it does not change its position in the frame. When the position changes (configuration parameter ban-iou-threshold), the plate will be processed and return to the first stage. After the second stage ends, the plate is removed from the ban list. If you do not want automatic plate banning to be applied, you must set the value of the ban-duration or ban-duration-area configuration parameter to zero, for example, 0s (0 seconds).
FRS
The system is designed for face recognition.
Neural Network Models Used
Currently, FRS uses three models:
- scrfd — designed for face detection in an image. Link to the project.
- genet — designed to determine the presence of a mask or sunglasses on the face. Based on this project. The model was obtained through transfer learning with fine-tuning on three classes: open face, face with a mask, face with sunglasses.
- arcface — designed to calculate the biometric face template. Link to the project.
General Scheme of Interaction with FRS
The API, detailed description of which is in the repository in the docs/openapi.yaml file, is used to interact with the service. First, your backend registers video streams by calling the addStream API method. The main parameters of the method are:
- streamId — internal identifier for the backend (external for FRS) for the video stream;
- url — this is the URL for capturing a frame from the video stream. FRS does not decode video but works with individual frames (screenshots). For example, the URL might look like http://
/cgi-bin/images_cgi?channel=0&user=admin&pwd= - callback — this is the URL that FRS will use when it recognizes a registered face. For example, http://
/face_recognized?stream_id=1
The registerFace method is used for face registration. Main parameters of the method:
- streamId — video stream identifier;
- url — this is the URL of the face image that needs to be registered. For example, http://
/image_to_register.jpg Upon successful registration, the internal unique identifier of the registered face for FRS (external for the backend) — faceId — is returned.
The motionDetection method is used to start and end frame processing. The main idea is for FRS to process frames only when motion is detected in front of the video camera. Parameters of the method:
- streamId — video stream identifier;
- start — indicator of motion start or end. If start=true, FRS starts processing a frame from the video stream every second (set by the delay-between-frames parameter). If start=false, FRS stops processing.
- duration — optional, with start=true only: the period after which FRS stops processing by itself: a duration such as 30s or 2m, or a number of seconds. An invalid value is rejected with code 400. It replaces the workflow-timeout parameter of the video stream for this start; if it is left out or equals 0s, workflow-timeout is used.
Besides POST, the method also accepts GET requests, for devices that can only send them. The parameters are then passed in the query string, with start=t or start=f and an optional duration, and the authorization token in the token parameter, for example: http://localhost:9051/frs/api/motionDetection?streamId=1&start=t&token=<token>. The other API methods accept POST requests only.
Frame processing implies the following chain of actions:
- Face search using the scrfd neural network.
- If faces are found, each is checked for "blur" and "frontality".
- If the face is not blurred (clear image) and frontal, the presence of a mask and sunglasses is determined using the genet neural network.
- For each face without a mask and without sunglasses, a biometric face template, also known as a descriptor, is calculated using the arcface neural network. Mathematically, the descriptor is a 512-dimensional vector.
- Next, each such descriptor is compared pairwise with those registered in the system. Comparison is done by calculating the cosine of the angle between the descriptor vectors: the closer the value is to one, the more the face resembles the registered one. If the maximum cosine value is greater than the threshold value (tolerance parameter), the face is considered recognized and FRS calls the callback (face recognition event), providing the descriptor identifier (faceId) and the internal event identifier for FRS (external for the backend) (eventId) as parameters. If several recognized faces appear in one frame, the callback will be called for the "highest quality" ("best") face (blur parameter).
- Each found non-blurred, frontal face, without a mask and without sunglasses, the best face is temporarily stored in the FRS log.
Using the bestQuality method, you can request the "best" frame from the FRS log. For example, a person unknown to the system approached the intercom and opened the door with a key. The backend knows the key opening time (date) and requests the best frame from FRS. FRS searches its log for the frame with the maximum blur from the time range [date - best-quality-interval-before; date + best-quality-interval-after] and returns it as a result. Such a frame is a good candidate for face registration using the registerFace method. As a rule, for good recognition, it is necessary to register several faces of one person, including from frames taken at night when the camera switches to infrared mode.
Project Build and Configuration
System Requirements
- x86-64 CPU. Extended instruction sets (e.g. AVX2 and FMA) are not required: the service detects them at runtime and uses them where available.
- NVIDIA GPU with Compute Capability greater than or equal to 6.0 and 4 GB memory or more. Details can be found, for example, here.
- Ubuntu 24.04 LTS or Ubuntu 26.04 LTS.
- PostgreSQL 16 or higher.
Git is needed to obtain the source code. If not installed, execute the command:
sudo apt-get install -y git
Obtaining the project source code:
cd ~
git clone https://github.com/rosteleset/falprs.git
NVIDIA Driver Installation
If the latest NVIDIA drivers are already installed on the system, skip this step. You can use the scripts/setup_nvidia_drivers.sh script for installation. The main commands are taken from here.
sudo ~/falprs/scripts/setup_nvidia_drivers.sh
After installation, the operating system must be rebooted:
sudo reboot
Important: turn off automatic package updates (unattended-upgrades) on the servers with the service. They can update the NVIDIA driver packages while the system runs and restart services, Triton Inference Server among them. The installed driver libraries then differ from the driver module loaded in the kernel, and the GPUs stop working (nvidia-smi reports Failed to initialize NVML: Driver/library version mismatch) until the system is rebooted. Turn the updates off and answer No:
sudo dpkg-reconfigure -plow unattended-upgrades
Check that apt-config dump APT::Periodic::Unattended-Upgrade now prints "0". Update the system and the drivers by hand, at a time when the server may be rebooted. If you need to keep the automatic security updates, exclude at least the NVIDIA driver packages from them in the Unattended-Upgrade::Package-Blacklist section of the /etc/apt/apt.conf.d/50unattended-upgrades file:
Unattended-Upgrade::Package-Blacklist {
"nvidia-";
"libnvidia-";
"cuda-drivers";
};
Docker Engine Installation
If Docker Engine is already installed on the system, skip this step. You can use the scripts/setup_docker.sh script for installation. The main commands are taken from here.
sudo ~/falprs/scripts/setup_docker.sh
NVIDIA Container Toolkit Installation
If NVIDIA Container Toolkit is already installed on the system, skip this step. You can use the scripts/setup_nvidia_container_toolkit.sh script for installation. The main commands are taken from here.
sudo ~/falprs/scripts/setup_nvidia_container_toolkit.sh
After installation, it is recommended to restart docker:
sudo systemctl restart docker
PostgreSQL Installation
If PostgreSQL is not installed, run the command:
sudo apt-get install -y postgresql
Environment Variables
Most repository scripts use environment variables. In the scripts directory, make a copy of the .env.example file and name it .env Specify actual values for your system. The major version of PostgreSQL is set by the PG_VERSION variable. You can find the installed PostgreSQL version with the command:
psql --version
psql (PostgreSQL) 16.14 (Ubuntu 16.14-0ubuntu0.24.04.1)
This means PG_VERSION=16 Other variables with the PG_ prefix define the connection to PostgreSQL. Don't forget to specify your password. The build script writes the connections into the config.toml configuration only when it creates the file; later changes of these variables do not get into an existing configuration, so change the dsn settings in it as well. For a PostgreSQL cluster, list its servers in PG_HOST_FRS and PG_HOST_LPRS separated by commas (e.g. PG_HOST_FRS=192.168.50.12,192.168.50.13): the DB schemas are then updated on the master, whichever server it is, and the service connects to all of them. The version of the Triton Inference Server container is set by the TRITON_VERSION variable. It is determined by the Compute Capability — the NVIDIA GPU hardware architecture version that determines the available instruction set, supported technologies (e.g., Tensor cores), and physical limitations of the GPU. It is needed for the CUDA compiler and software to understand how to efficiently execute code on the graphics card. You can find out the Compute Capability with the command:
nvidia-smi --query-gpu=compute_cap --format=csv
Compute Capability Support and Container Version Table
| Compute Capability | GPU Architecture | Container Version |
|---|---|---|
| < 6.0 | Maxwell, Kepler, Fermi | Not supported |
| 6.x | Pascal | 24.04 |
| 7.0 | Volta | 24.09 |
| >= 7.5 | Turing, Ampere, Ada Lovelace, Blackwell, Hopper | The latest |
For example, the GPU GTX 1080 Ti has the Pascal architecture, so TRITON_VERSION=24.04
The project working directory is set by the FALPRS_WORKDIR variable (default value is /opt/falprs).
The scripts build and install the Rust implementation of FALPRS. They install the Rust toolchain with rustup into the home directory of the user who runs them with sudo, if it is not installed yet. If the working directory holds the C++ implementation, scripts/update_falprs.sh replaces it with the Rust one even if the version is the same. For the C++ implementation, check out the main branch.
Important: if you are migrating from an deprecated FRS project, you need to use the sha1sum utility to specify the hash sum of the ONNX file you used to create the TensorRT plan for the old arcface model. This value is specified in the ARCFACE_SHA1 variable. For example, calculating the hash sum for the old glint_r50.onnx file:
sha1sum glint_r50.onnx
4fd7dce20b6987ba89910eda8614a33eb3593216 glint_r50.onnx
Then ARCFACE_SHA1=4fd7dce20b6987ba89910eda8614a33eb3593216
Initializing PostgreSQL
Use the scripts/init_postgresql.sh script:
sudo ~/falprs/scripts/init_postgresql.sh
The script creates databases, users, and assigns roles.
Building the Project
Use the scripts/build_falprs.sh script:
sudo ~/falprs/scripts/build_falprs.sh
Creating TensorRT Plans for Neural Network Models
TensorRT plans are used for inference, which can be obtained from neural network models in ONNX (Open Neural Network Exchange) format. To create plans in the working directory, use the scripts/tensorrt_plans.sh script:
sudo ~/falprs/scripts/tensorrt_plans.sh
Project Configuration
To initially populate the databases, execute the commands:
~/falprs/scripts/sql_frs.sh
~/falprs/scripts/sql_lprs.sh
The project configuration is in the config.toml file in the working directory (by default /opt/falprs). The build script creates it from config.toml.example, which lists every setting with its default value and a description, and sets the database connections from the .env file. Later the file is not overwritten: neither the build nor the update script changes it, and new settings get their default values. Only the two database connections (dsn in the [lprs.database] and [frs.database] sections) are required; the other settings may be left out, and then their default values are used. Unknown settings are rejected: the service does not start and names the setting. To perform API methods with mandatory authorization, set no-auth-group-id to zero in the [lprs] and [frs] sections. Operation with a separate HTTP server is also possible. In this case, replace the values of the local paths and URL prefixes (screenshots-path, screenshots-url-prefix and the like) in the [lprs] and [frs] sections.
The video stream configs (the config member of addStream), the default video stream configs (setStreamDefaultConfig) and the FRS common config (setCommonConfig) are checked when they are set, against the parameter descriptions in docs/openapi.yaml: a value of another type, format or range is answered with code 400 naming the parameter, unknown parameters are dropped (the service writes a warning to its log), and a parameter set to null is removed, so that its default applies again. Numbers may also be given as strings and durations as a number of seconds; values are stored in their canonical form. A stored value the service cannot use is replaced with its default, with a warning in the log.
To start the container with Triton Inference Server, execute the command:
sudo ~/falprs/scripts/triton_service.sh
The script starts the container named falprs-triton with --ipc=host: the service then passes the detector inputs to Triton through system shared memory instead of sending them over the network, which takes less CPU. It is set in the [inference] section of config.toml and is on by default. With Triton on another host, or in a container started without --ipc=host, the service sends the inputs over gRPC and writes a warning to its log. To create the falprs service and log rotation, execute the command:
sudo ~/falprs/scripts/falprs_service.sh
To start the falprs service, execute the command:
sudo systemctl start falprs.service
Project Update
Before updating, make sure you have an up-to-date backup of the project's databases. Environment variables are loaded from the aforementioned .env file.
Important: if you are updating from an older version that did not use the .env file, first read the Environment Variables section. Set TRITON_VERSION according to the working version you are currently using.
Important: update the project with the scripts/update_falprs.sh script only. Older versions kept the configuration in the config.yaml file; the service no longer reads it, and the script converts it into config.toml during the update. If you update the service in another way, convert the configuration yourself before starting the service, otherwise it will not start:
cd /opt/falprs
sudo python3 ~/falprs/scripts/convert_config.py config.yaml config.toml
sudo mv config.yaml config.yaml.bak
and replace config.yaml with config.toml in the /etc/systemd/system/falprs.service file.
Important: a Triton container started by an older triton_service.sh has no --ipc=host, so the service sends it the inputs over gRPC, with the warning no shared memory for ... in its log. Recreate the container once (the models are taken from the same place; TRITON_VERSION defaults to the version of the existing container):
sudo ~/falprs/scripts/triton_recreate.sh
The service registers its shared memory again on its own, at most an hour after Triton is back.
Update the repository and run the scripts/update_falprs.sh script:
cd ~/falprs
git pull
sudo ~/falprs/scripts/update_falprs.sh
The script:
- checks whether the installed FALPRS executable needs to be rebuilt and rebuilds it only if the installed version differs from the project version or cannot be determined
- converts the old config.yaml configuration into config.toml once, keeping your values, and keeps the old file as config.yaml.bak; settings that no longer exist are dropped, and the ones you had changed are listed in a warning. The service unit is switched to config.toml
- performs TensorRT planning before stopping any services and determines whether any TensorRT plans need to be regenerated
- downloads and checks the required neural network models and calculates their SHA1 hashes
- regenerates TensorRT plans only for changed models or missing plans
- removes the models that are no longer used from the Triton Inference Server model repository
- stops the
falprsservice and the Triton Inference Server container only when TensorRT plans need to be regenerated or unused models need to be removed - starts the Triton Inference Server container again after successful TensorRT plan generation when it was running before the update
- updates schemas and data in the DB (old data is not overwritten); Triton Inference Server addresses with the HTTP port 8000, left from versions that used the Triton HTTP client, get the gRPC port 8001 in all the stored configs
- checks the video stream configs, default video stream configs and common configs stored in the DB and cleans them: values in a form the service also took (e.g. "true" or "0.7" as strings) are stored in their canonical form, so that the video streams keep working as before; FRS parameters stored in the wrong config of a stream group are moved to the right one; values the service ignored and unknown parameters are removed. The original configs of the changed rows are saved to the config-cleanup-<date>.json file in the working directory first
- restores the
falprsservice to its previous state after the update
If the FALPRS executable is up to date and all TensorRT plans are current, neither the falprs service nor the Triton Inference Server container is stopped during the update.
The update can also be run in phases, e.g. to update the servers of a cluster one at a time while a load balancer sends the requests to the other one. Each phase is a separate run of the script:
--buildbuilds the FALPRS executable and downloads the neural network models; the running services and the working directory are left as they are, and the TensorRT plans that the next phase will generate are listed--installis run on a server taken out of service: it converts the configuration, stops thefalprsservice if its executable has to be replaced and the Triton Inference Server container if TensorRT plans have to be generated, installs the executable, generates the plans and starts Triton Inference Server again; thefalprsservice is left stopped, and the DB is not touched--finishupdates the DB and checks the stored configs as described above, and starts thefalprsservice
sudo ~/falprs/scripts/update_falprs.sh --build
sudo ~/falprs/scripts/update_falprs.sh --install
sudo ~/falprs/scripts/update_falprs.sh --finish
Updating the DB is the step after which servers with the previous version may no longer work correctly with it (e.g. the C++ implementation does not work with the Triton gRPC port), so run --finish when the servers with the previous version no longer receive requests, or when the update does not change the DB in a way they cannot handle.
The stored configs can also be checked by hand. Without --fix the command only lists what would change and exits with code 1 if something needs cleaning:
cd /opt/falprs
sudo ./falprs -c config.toml check-configs
sudo ./falprs -c config.toml check-configs --fix
Managing Video Stream Groups
Each video stream belongs to one group. When populating with initial data, a group named default is automatically created. When calling API methods for this group, an authorization token can be omitted. To view, add, and remove groups, you can use the utils/vstream_groups.py script.
Install dependencies:
sudo apt-get install -y python3-psycopg2 python3-prettytable
Show the list of commands:
python3 ~/falprs/utils/vstream_groups.py -h
Example of adding a new group in FRS:
python3 ~/falprs/utils/vstream_groups.py -t frs -a "My new group"
Show the list of groups in FRS:
python3 ~/falprs/utils/vstream_groups.py -t frs -l
Example output:
+----------+--------------+--------------------------------------+
| id_group | group_name | auth_token |
+----------+--------------+--------------------------------------+
| 1 | default | 4b05cce8-d29e-4e7f-a1fa-247a91f3fd46 |
| 2 | My new group | 74c0e0f0-ea70-47fb-b715-8932baf7e049 |
+----------+--------------+--------------------------------------+
When calling API methods for new groups, an authorization token must be specified. If you want the authorization token to become mandatory for the default group, set the value to 0 for the no-auth-group-id settings in the [lprs] and [frs] sections of the project configuration file (/opt/falprs/config.toml) and restart the service.
Examples
Install dependencies:
sudo apt-get install -y nodejs npm libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
LPRS
Go to the examples directory:
cd ~/falprs/examples/lprs
Install dependencies:
npm i
Start the test service for processing callbacks:
node lprs_backend.js
Add a "test" video stream. In a new console:
cd ~/falprs/examples/lprs
./test_add_stream.sh
Check that the stream is in the database:
./test_list_streams.sh | jq
The response should be a json file. Wait a minute for the new data to get into the FALPRS cache, then execute the command:
./test_workflow.sh
As a result of executing this command, in the console with the lprs_backend.js test service, we should see lines like:
[2024-10-16 12:37:16.108] Callback: {"streamId":"test001","date":"2024-10-16T09:37:16.103891056+00:00","eventId":1,"plates":["O588OA68"],"hasSpecial":false}
[2024-10-16 12:37:16.108] Matched numbers: O588OA68
[2024-10-16 12:37:16.162] Save image to file: /tmp/lprs_backend/screenshots/49b507ac-9b7d-43a6-94f0-18f647fc1f5c.jpg
And in the /tmp/lprs_backend/screenshots directory, an image file should appear:

Delete the "test" video stream:
./test_remove_stream.sh
Go to the console from which the test service for processing callbacks was launched and stop it.
FRS
Go to the examples directory:
cd ~/falprs/examples/frs
Install dependencies:
npm i
Start the test service for processing callbacks:
node frs_backend.js
Add a "test" video stream. In a new console:
cd ~/falprs/examples/frs
./test_add_stream.sh
Check that the stream is in the database:
./test_list_streams.sh | jq
The response should be a json file. Wait 10 seconds for the new data to get into the FALPRS cache, then execute the face registration command:
./test_register_face.sh
Check that the face is in the database:
./test_list_all_faces.sh | jq
The response should be a json file. Wait 10 seconds for the new data to get into the FALPRS cache, then execute the command:
./test_workflow.sh
As a result of executing this command, in the console with the frs_backend.js test service, we should see lines like:
[2024-10-21 15:34:29.180] Callback: {"faceId":1,"eventId":1}
[2024-10-21 15:34:29.180] This is Albert Einstein
[2024-10-21 15:34:29.220] Save image to file: /tmp/frs_backend/screenshots/492d7722d038434d9e2676648991e65e.jpg
And in the /tmp/frs_backend/screenshots directory, an image file should appear:

Delete the "test" video stream:
./test_remove_stream.sh
Go to the console from which the test service for processing callbacks was launched and stop it.
Tests
Install dependencies:
sudo apt-get install -y python3-requests python3-pytest python3-pytest-order python3-pil
Create directories and test databases:
cd ~/falprs/tests
./test_prepare.sh
The tests run the implementation set by the FALPRS_IMPL variable (rust by default, or cpp), taken from the environment or from the .env file like in the build scripts; the FALPRS_BIN variable sets the path to the service binary explicitly. The C++ sources are not in this branch, so cpp needs FALPRS_BIN set to the C++ binary built from the main branch. The Rust service is started with the tests/test_config.toml configuration, the C++ one with tests/test_config.yaml, which holds the same settings in the userver format.
LPRS
pytest -v -s test_api_lprs.py
pytest -v -s test_api_lprs_callbacks.py
FRS
pytest -v -s test_api_frs.py
pytest -v -s test_api_frs_callbacks.py
Service Endpoints
pytest -v -s test_service_endpoints.py
After finishing the tests, delete the directories and test databases:
./test_clean.sh
Rust Unit Tests
The Rust implementation also has unit tests. They need neither the test databases nor Triton Inference Server:
cd ~/falprs
cargo test
The tests of the config.yaml converter, which also need the python3-yaml package:
sudo apt-get install -y python3-yaml
python3 -m pytest ~/falprs/scripts/tests
Stress Tests
The tests/stress directory holds the stress tests of FRS and LPRS: a throughput and load comparison over pipelines-per-cpu values (sweep) and a long run of both subsystems that fails on memory, file descriptor or thread leaks, screenshot directories that keep growing and errors in the logs (soak). The runner prepares the test databases and starts the service itself, so do not run it together with the tests above. It runs the implementation set by the FALPRS_IMPL and FALPRS_BIN variables, like the other tests. Install dependencies:
sudo apt-get install -y python3-aiohttp python3-yaml
Examples:
python3 ~/falprs/tests/stress/stress.py sweep
python3 ~/falprs/tests/stress/stress.py soak
The runner stops the service at the end, also when it is interrupted, but leaves the test databases and the /tmp/test_falprs directory; the next run, like test_prepare.sh, recreates them. After finishing the stress tests, delete them:
~/falprs/tests/test_clean.sh
The modes, arguments, results and failure criteria are described in tests/stress/README.md.
Data Synchronization with the Deprecated FRS Project
The sync_data.py script from the utils directory of this repository does a full synchronization: it deletes unnecessary records and adds missing ones in the new database. Before running the script, make sure that your old service is stopped, and the new one is correctly configured and also stopped. Install dependencies:
sudo apt-get install -y pip python3-virtualenv
Go to the directory with the script:
cd ~/falprs/utils
Copy the file:
cp config.sample.py config.py
In the config.py file, replace the variable values in accordance with your configuration of the old and new services. Variables of the type mysql_* and *_old refer to the old project, pg_* and *_new — to the new one. Execute the commands:
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python3 sync_data.py
After the script runs, a success message should appear. Delete the virtual environment:
deactivate
rm -rf ./__pycache__/
rm -rf venv
Examples of CPU and GPU Load Charts
Below are load data for a cluster of two unequal servers with different shares of video stream processing. In this case, these are intercom cameras installed in apartment buildings, and processing is carried out in accordance with motion detection.
First Server

Second Server
