sf-api
The sf-api
service implements the HTTP API for the main functionality of the FindFace Server such as object detection and object recognition.
Note
The mentioned functions themselves are provided by extraction-api
.
The sf-api
interfaces with the following FindFace Server components:
feature vector database powered by Tarantool via the
tntapi
serviceextraction-api
that provides object detection and object recognitionupload
that provides a storage for original images and FindFace Server artifacts
To detect an object in an image, you need to send the image as a file or URL in an API request to sf-api
. The sf-api
will then redirect the request to extraction-api
for object detection and recognition.
If there is a configured video object detection module in the system, sf-api
also interfaces with the router service (e.g. facerouter
). It receives data of detected objects and processing directives from the router service (facerouter
) and executes the received directives (for example, saves objects into a specific database gallery).
Tip
You can also directly access extraction-api
.
Functionality:
HTTP API implementation (object detection and object recognition methods, performed via
extraction-api
).saving object data to the feature vector database (performed via
tntapi
),saving original images, object thumbnails and normalized object images to an NginX-powered web server (via
upload
).provides interaction between all the FindFace Server components.
The sf-api
configuration is done through environment variables and command line flags or through the sf-api.yaml
configuration file. You can find its default content here
.
When configuring sf-api
, refer to the following parameters:
Command line flags |
Type |
Description |
---|---|---|
|
string |
Cache type: inmemory, redis or memcache (default |
|
int |
Maximum number of items in ARC cache (default 16384). |
|
duration |
DNS cache timeout (default 1m0s). |
|
value |
Comma-separated list of memcache shards (default |
|
duration |
Specifies read/write timeout (default 100ms). |
|
int |
Database to be selected after connecting to the server. |
|
string |
Network type, either tcp or unix (default |
|
value |
Array of Host:Port addresses (default |
|
string |
Optional password. Must match the password specified in the requirepass server configuration option. |
|
duration |
Specifies dial/read/write timeout (default 5s). |
|
string |
Path to config file. |
|
Output config template and exit. |
|
|
– |
Enable debug logging. |
|
string |
Extraction API address legacy argument – please switch to ‘url’. |
|
duration |
Keep-alive connection timeout (default 24h0m0s). |
|
int |
Max idle keep-alive connections per host (default 20). |
|
duration |
extraction-api-timeouts-connect (default 5s). |
|
duration |
extraction-api-timeouts-idle-connection (default 10s). |
|
duration |
extraction-api-timeouts-overall (default 35s). |
|
duration |
extraction-api-timeouts-response-header (default 30s). |
|
– |
Enable HTTP tracing (extremely verbose, slows everything down considerably). |
|
string |
Extraction API address (default |
|
– |
Flag for generating openapi docs and exit. |
|
– |
Print help information. |
|
– |
Allow returning raw feature vectors to detect responses if |
|
int |
Maximum length of image supplied in request body (default 33554432). |
|
string |
Comma-separated list of subnets that are not allowed to fetch from (default |
|
int |
Maximum supported url length in bytes (default 4096). |
|
string |
IP:port to listen on (default |
|
– |
Enables normalize saving (default true). |
|
string |
Access key for the object storage. |
|
string |
S3 storage bucket name. |
|
string |
S3 compatible object storage endpoint. |
|
int |
Storage operations (Get, Put, Delete) timeout in seconds (default 30). |
|
string |
Storage public URL. |
|
string |
Storage region. |
|
string |
Secret key for the object storage. |
|
– |
If |
|
duration |
Keep-alive connection timeout (default 24h0m0s). |
|
int |
Max idle keep-alive connections per host (default 20). |
|
duration |
normalized-storage-webdav-timeouts-connect (default 5s). |
|
duration |
normalized-storage-webdav-timeouts-idle-connection (default 10s). |
|
duration |
normalized-storage-webdav-timeouts-overall (default 35s). |
|
duration |
normalized-storage-webdav-timeouts-response-header (default 30s). |
|
– |
Enable HTTP tracing (extremely verbose, slows everything down considerably). |
|
string |
Webdav storage for normalized, disable normalized if empty string (default |
|
string |
Normalized storage type: webdav, s3 (default |
|
value |
Supported object types (default face,body,car). |
|
duration |
Cooldown timeout after communication error (default 2s). |
|
Prefer slaves over master for get/list galleries requests. |
|
|
duration |
Keep-alive connection timeout (default 24h0m0s). |
|
int |
Max idle keep-alive connections per host (default 20). |
|
int |
Give up after trying to read from max_slave_attempts slaves (default 2). |
|
– |
Prefer slaves over master for requests. |
|
– |
Ignore master on read requests. If true: ReadSlaveFirst will be ignored. |
|
duration |
storage-api-timeouts-connect (default 5s). |
|
duration |
storage-api-timeouts-idle-connection (default 10s). |
|
duration |
storage-api-timeouts-overall (default 35s). |
|
duration |
storage-api-timeouts-response-header (default 30s). |
|
– |
Enable HTTP tracing (extremely verbose, slows everything down considerably). |
The format of environment variable for flag -my-flag
is CFG_MY_FLAG
.
Priority:
Defaults from source code (lowest priority).
Config file.
Environment variables.
Command line.