SFCli

It is a command-line utility which can be used to interact with SmartFace API. You can download the current version of the SFCli on the Innovatrics' GitHub.

The SFCli allows you to access and update camera information, control the watchlist members and access information from the SmartFace by listening to the SmartFace’s notifications or running queries on the SmartFace Platform.

Syntax

sfcli command [subcommand] [option1, option2, ...]

Exit code of sfcli utility is 0 in case of success and nonzero number in case of any failure.

Example:

Command camera with subcommand get with no options

sfcli camera get

Will list all existing camera processors.

Options:

Options are supported in long form prepended by double dash:

sfcli camera get --id 2976ac85-f570-4bec-9561-ce5b2ec1d234 as well in short form.

sfcli camera get -i:2976ac85-f570-4bec-9561-ce5b2ec1d234
sfcli camera get -i=2976ac85-f570-4bec-9561-ce5b2ec1d234
sfcli camera get -i 2976ac85-f570-4bec-9561-ce5b2ec1d234

API location

HTTP Target HTTP API location can be defined by --api-url and --odata-url options. Default value for API URL is http://localhost:8098 and default value for OData URL is http://localhost:8099.

$ sfcli --api-url http://localhost:8098 --odata-url http://localhost:8099

Example camera command with defined API url option:

$ sfcli --api-url http://localhost:8098 camera get

Both URLs can overridden by setting sfcli_url_api and sfcli_url_odata environment variables.

ZeroMQ Smartface notifications are published via ZeroMQ, sfcli utility uses non configurable default smartface port 2406. For more info about notifications please see command notifications.

Commands

Options:

--api-url        SmartFace REST API url (e.g. "http://smartfaceserver:8098"). Defaults to "http://localhost:8098". Can be overridden by environment
                  variable sfcli_url_api
--odata-url      SmartFace OData API base url (e.g. "http://smartfaceserver:8099"). Defaults to "http://localhost:8099". Can be overridden by environment
                  variable sfcli_url_odata
--zero-mq-host   Hostname where SFBase service is available
-?|-h|--help     Show help information

Commands:
  camera           View or edit properties of camera configuration
  notifications    Receive and print notifications to console
  query            Select entities using Language Integrated Query (LINQ)
  watchlistmember  Operations with watchlist member

notifications

Command prints notifications of specific topic provided in option. Requires ctrl+c or new line to exit.

Options:
  -t|--topic    Specify topic of notifications [faces.insert, faces.extracted, grouping_progress.info,
                inputFiles.update, tracklets.completed, matchResults.match, matchResults.nomatch,
                matchResults.match.insert, liveness.result, heartbeat]
  -?|-h|--help  Show help information

Example:

$ sfcli --zero-mq-host localhost notifications -t:matchResults.match.insert

watchlistmember

This command mnipulates with watchlistmember entities.

Options:
  -?|-h|--help     Show help information

Commands:
  register         Register single watchlist member
  registerFromDir  Register WatchlistMember entities from photos in directory in format
                   {watchlistmember_id}.(jpeg|jpg|png)

watchlistmember register

Create or update watchlist member with all required related entities. Unique ids are supposed to be generated by clients (e.g. GUIDs or external id from another system).

Create : If Id of watchlist(s) or watchlist member do not exists in database, new ones with provided external id will be created for you automatically.

Replace: If you want to link watchlist member to other watchlist(s) or change photos of existing watchlist member, use existing external Ids of entities.

NOTE: All watchlist member related data that exists before callling this method will be deleted/unlinked and new one by payload will be recreated.

Options:
  -i|--id
  -w|--watchlistIds
  -p|--photos <FILE>
  -?|-h|--help        Show help information

Example:

$ sfcli watchlistmember register -i:external_wlMember_id -w:123 -w:567 -p:face1.jpg -p:face2.jpg

This command will create/replace watchlist member with faces from photo files (face1.jpg, face2.jpg) and link this watchlist member to watchlists with external ids (123, 567).

watchlistmember registerFromDir
This command will register multiple watchlist members from directory with photos. It will take all image files from given directory which name conforms with format {watchlistmember_id}.(jpeg|jpg|png) and register photos for each id as watchlist member. Example file name “ext123.jpeg”.

Option –metaDataFile
If you need to fill additional data to watchlist member like FullName, DisplayName or Note then use option -m. WatchlistMember will be registred from json file which contains array of objects, where each object represents data for watchlist member. This json file is expected to be in specified directory (option --dirToPhotos). Name of json file is irrelevant.

Options:
  -w|--watchlistIds
  -d|--dirToPhotos
  -m|--metaDataFile  Use this option when you can provide single json file in selected directory with meta data for WatchlistMember. In this case could be use any name for photo file
                     [
                     {
                     "Id": "120",
                     "DisplayName": "Display name",
                     "FullName": "Full name",
                     "Note": "Example note",
                     "PhotoFiles": ["file1.jpeg", "file2.jpeg"]
                     }
                     ]

  -p|--parallel      Max degree of parallelism, default value is 1
  -?|-h|--help       Show help information

Example:

sfcli watchlistmember registerFromDir -w:fingera -d:"d:\Fingera Registration Photo"

camera

This command allow to create, update, delete or view settings of a camera. Camera is domain entity which groups some data entities, workers and configs. That allows you to add live stream from IP camera and easily change processing properties.

NOTE: camera id is a unique identifier of a camera

Options:
  -?|-h|--help  Show help information

Commands:
  add           Create new camera
  get           Read properties of camera
  delete        Delete a camera
  set           Edit properties of a camera

Example (create camera):

$ sfcli camera add -s:c:\temp\wafs.mp4

Example (start camera):

$ sfcli camera set -e:true -i:2976ac85-f570-4bec-9561-ce5b2ec1d234

camera add Create a camera. --name and --source options are required.

Options:
  -n|--name                           [Required] Name of the new camera.
  -s|--source                         [Required] Url to video E.g. rtsp://server.example.org:8080/test.sdp
  -e|--enabled                        Whether the stream is processed or not
  -m|--minFaceSize                    Minimum count of pixels between eyes
  -x|--maxFaceSize                    Maximum count of pixels between eyes
  -r|--redetectionTime                Time between face re-detections in milliseconds
  -p|--mpeg1PreviewPort               Port to processed stream MPEG1 preview
  -tg|--templateGeneratorResourceId   Template generator resource id for the camera
  -fd|--faceDetectorResourceId        Face detector resource id for the camera
  -pd|--pedestrianDetectorResourceId  Pedestrian detector resource id for the camera
  -mp|--minPedestrianSize             Minimum size of detected pedestrian in pixels (if >= 1) or relative to the longer edge of the processed video (if > 0 && < 1)
  -xp|--maxPedestrianSize             Maximum size of detected pedestrian in pixels (if >= 1) or relative to the longer edge of the processed video (if > 0 && < 1)
  -sd|--spoofDetectorResourceId       Spoof detector resource id for the camera
  -?|-h|--help                        Show help information

camera get Read properties of a camera. If --id option is not provided then all cameras are listed.

Options:
  -i|--id  Id of camera to get. If empty, all cameras will be fetched.
  -?|-h|--help   Show help information

camera delete Delete a camera.

Options:
  -i|--id         [Required] Id of camera to delete.
  -?|-h|--help    Show help information

camera set Change properties of a camera. --id is required. Only filled properties will be changed on the camera.

Options:
  -i|--id                             [Required] Identifier of camera to edit
  -n|--name                           Name of the camera
  -s|--source                         Url to video E.g. rtsp://server.example.org:8080/test.sdp
  -e|--enabled                        Whether the stream is processed or not
  -m|--minFaceSize                    Minimum count of pixels between eyes
  -x|--maxFaceSize                    Maximum count of pixels between eyes
  -r|--redetectionTime                Time between face re-detections in milliseconds
  -p|--mpeg1PreviewPort               Port to processed stream MPEG1 preview
  -tg|--templateGeneratorResourceId   Template generator resource id for the camera
  -fd|--faceDetectorResourceId        Face detector resource id for the camera
  -pd|--pedestrianDetectorResourceId  Pedestrian detector resource id for the camera
  -mp|--minPedestrianSize             Minimum size of detected pedestrian in pixels (if >= 1) or relative to the longer edge of the processed video (if > 0 && < 1)
  -xp|--maxPedestrianSize             Maximum size of detected pedestrian in pixels (if >= 1) or relative to the longer edge of the processed video (if > 0 && < 1)
  -sd|--spoofDetectorResourceId       Spoof detector resource id for the camera
  -?|-h|--help                        Show help information