Auto Enrollment Module
SmartFace provides face biometry for various purposes including the access control and attendance use cases. The Auto Enrollment module helps automate the process of enrolling new faces into watchlists based on specific criteria.
Auto Enrollment module
The Auto Enrollment module connects to SmartFace GraphQL endpoint and listens for NoMatch notifications. When an unmatched face is detected, the module evaluates it against defined criteria and automatically enrolls it into one or multiple watchlists if the criteria are met.
Development
The source code is available on our Github repository. To run the application locally, follow these steps:
- Clone the
https://github.com/innovatrics/smartface-integrations/
Github repository using git commands or download the code using the “Download Zip” button - Open terminal
- Navigate to
/src/AutoEnrollment
- Run
dotnet run
Configuration
When running the application you can configure it via the appsettings.json
file in the Windows version, or using the environment variables in the .env.rc
file when the module is deployed as a docker container. Here’s a comprehensive example of the configuration:
services:
...
auto-enroll:
image: ${REGISTRY}integrations-auto-enroll
restart: unless-stopped
environment:
- Source__GraphQL__Host=SFGraphQL
- Source__GraphQL__Port=8097
- Source__OAuth__Url=https://?????.eu.auth0.com/oauth/token
- Source__OAuth__ClientId=
- Source__OAuth__ClientSecret=
- Source__OAuth__Audience=
- Target__Host=SFApi
- Target__Port=8098
- Config__MaxParallelActionBlocks=1
- Config__DuplicateSearchThreshold=35
- Config__EnrollStrategy=FirstPassingCriteria
- Config__HardAbsoluteExpirationMs=300000
- Config__TrackletTimeoutMs=5000
- StreamConfigurations__0__StreamId=<<camera_id>>
- StreamConfigurations__0__WatchlistIds__0=<<id-of-watchlist>>
- StreamConfigurations__0__FaceQuality__Min=4500
- StreamConfigurations__0__FaceSize__Min=70
- StreamConfigurations__0__FaceSize__Max=450
- StreamConfigurations__0__FaceArea__Min=0.01
- StreamConfigurations__0__FaceArea__Max=1.50
- StreamConfigurations__0__FaceOrder__Max=1
- StreamConfigurations__0__FacesOnFrameCount__Max=2
- StreamConfigurations__0__FaceQuality__Min=1000
- StreamConfigurations__0__TemplateQuality__Min=80
- StreamConfigurations__0__Brightness__Min=0.001
- StreamConfigurations__0__Brightness__Max=1000
- StreamConfigurations__0__Sharpness__Min=0.001
- StreamConfigurations__0__Sharpness__Max=1000
- StreamConfigurations__0__YawAngle__Min=-7
- StreamConfigurations__0__YawAngle__Max=7
- StreamConfigurations__0__PitchAngle__Min=-25
- StreamConfigurations__0__PitchAngle__Max=25
- StreamConfigurations__0__RollAngle__Min=-15
- StreamConfigurations__0__RollAngle__Max=15
- StreamConfigurations__0__FramePaddingAbsolute=50
- StreamConfigurations__0__FramePaddingRelative=0.15
- StreamConfigurations__1__StreamId=<<camera_id>>
- StreamConfigurations__1__WatchlistIds__0=<<id-of-watchlist>>
networks:
default:
external:
name: sf-network
Configuration Options
Source Configuration
Source__GraphQL__Host
: Hostname of the GraphQL serviceSource__GraphQL__Port
: Port number for the GraphQL serviceSource__OAuth__Url
: OAuth token endpoint URLSource__OAuth__ClientId
: OAuth client ID for authenticationSource__OAuth__ClientSecret
: OAuth client secret for authenticationSource__OAuth__Audience
: OAuth audience identifier
Target Configuration
Target__Host
: Hostname of the target API serviceTarget__Port
: Port number for the target API service
General Configuration
Config__MaxParallelActionBlocks
: Maximum number of parallel action blocks to processConfig__DuplicateSearchThreshold
: Threshold for duplicate face detection (0-100)Config__EnrollStrategy
: Strategy for enrollment (e.g., FirstPassingCriteria)Config__HardAbsoluteExpirationMs
: Hard expiration time for tracklets in millisecondsConfig__TrackletTimeoutMs
: Timeout for tracklets in milliseconds
Stream Configuration
Each stream can have its own configuration with the following options:
StreamId
: Unique identifier for the streamWatchlistIds
: Array of watchlist IDs to enroll faces intoFaceQuality__Min
: Minimum face quality score (0-10000)FaceSize__Min
: Minimum face size in pixelsFaceSize__Max
: Maximum face size in pixelsFaceArea__Min
: Minimum face area ratio (0-1)FaceArea__Max
: Maximum face area ratio (0-1)FaceOrder__Max
: Maximum face order in the frameFacesOnFrameCount__Max
: Maximum number of faces allowed in a single frameTemplateQuality__Min
: Minimum template quality score (0-100)Brightness__Min
: Minimum brightness thresholdBrightness__Max
: Maximum brightness thresholdSharpness__Min
: Minimum sharpness thresholdSharpness__Max
: Maximum sharpness thresholdYawAngle__Min
: Minimum yaw angle in degreesYawAngle__Max
: Maximum yaw angle in degreesPitchAngle__Min
: Minimum pitch angle in degreesPitchAngle__Max
: Maximum pitch angle in degreesRollAngle__Min
: Minimum roll angle in degreesRollAngle__Max
: Maximum roll angle in degreesFramePaddingAbsolute
: Absolute padding around the face in pixelsFramePaddingRelative
: Relative padding around the face (0-1)
Usage
Add the following pattern to your existing docker compose file (docker-compose.yml
) and set up the .env.rc
file as described above:
services:
sf-station:
image: ${REGISTRY}sf-station:${SFS_VERSION}
container_name: SFStation
restart: unless-stopped
ports:
- 8000:8000
env_file: .env.sfstation
auto-enrollment:
image: ${REGISTRY}integrations-auto-enrollment
container_name: SFAutoEnrollment
restart: unless-stopped
env_file: .env.rc
networks:
default:
external:
name: sf-network
If needed, the environment variables normally defined in the .env.rc
file can be defined directly in the docker-compose.yml
file:
services:
auto-enrollment:
image: ${REGISTRY}integrations-auto-enrollment
container_name: SFAutoEnrollment
restart: unless-stopped
environment:
- SmartFace__GraphQL__Url=http://sf-station:8000/graphql
- SmartFace__GraphQL__ApiKey=your-api-key
- AutoEnrollment__Criteria__MinFaceSize=100
- AutoEnrollment__Criteria__MinConfidence=0.8
- AutoEnrollment__Criteria__MaxAge=30
- AutoEnrollment__Watchlists__0__Id=watchlist-id-1
- AutoEnrollment__Watchlists__0__Name=Auto Enrolled Watchlist 1
- AutoEnrollment__Watchlists__1__Id=watchlist-id-2
- AutoEnrollment__Watchlists__1__Name=Auto Enrolled Watchlist 2
The Auto Enrollment module will now:
- Connect to the SmartFace GraphQL endpoint
- Listen for NoMatch notifications
- Evaluate unmatched faces against the defined criteria
- Automatically enroll faces that meet the criteria into the specified watchlists