Configuration

Configuration Inheritance

FaceTrackerConfig extends FaceRecognizerConfig and inherits all base settings:

  • Model specifications - Face detection and embedding models (device_type, inference_host_address)

  • Database path - Where face embeddings are stored

  • Similarity threshold - Matching confidence (0.0-1.0)

  • Face filters - Quality gates (small face, frontal, zone, shift)

See FaceRecognizer Configuration for details on these settings.


Configuration Parameters

FaceTracker adds the following tracking-specific parameters:

Video Source

Parameters:

  • video_source - Input video source (default: 0 for first webcam):

    • Integer (e.g., 0, 1) - Local webcam index

    • String path (e.g., "video.mp4") - Video file

    • RTSP URL (e.g., "rtsp://192.168.1.100/stream") - IP camera

  • video_source_fps_override (optional) - Override frame rate when camera reports incorrect FPS (default: 0.0 = no override)

  • video_source_resolution_override (optional) - Override resolution as (width, height) tuple when camera reports incorrect dimensions (default: (0, 0) = no override)


Credence Count

Controls when a detected face is confirmed as a valid track for processing.

Parameter:

  • credence_count - Number of consecutive frames a face must appear before being confirmed (default: 1). Reduces false positives from momentary detections or camera noise.

Recommended values:

  • 2-4 - Real-time monitoring (quick confirmation)

  • 5-10 - High-traffic areas (reduce false positives)

  • 10+ - Critical security applications (maximum stability)


Alert Mode and Notifications

Controls when alerts are triggered and how notifications are delivered.

Parameters:

  • alert_mode - When to trigger alerts (default: AlertMode.NONE):

    • AlertMode.NONE - No alerts

    • AlertMode.ON_UNKNOWNS - Alert when unknown face detected

    • AlertMode.ON_KNOWNS - Alert when known face detected

    • AlertMode.ON_ALL - Alert for all faces

  • alert_once (bool) - Alert once per track (True) or every time attributes change for the given track ID (False) (default: True)

  • clip_duration (int) - Length of video clips in frames (default: 0 = no recording, e.g., 100 frames ≈ 3.3 seconds at 30 FPS)

  • notification_config (str) - Apprise configuration string for notification delivery

  • notification_message (str) - Message template with variables: ${time}, ${filename}, ${url}

  • notification_timeout_s (float, optional) - Timeout in seconds for sending notifications

Apprise notification examples:

  • Email: "mailto://user:[email protected]"

  • Slack: "slack://token/channel"

  • Discord: "discord://webhook_id/webhook_token"

  • SMS (Twilio): "twilio://account_sid:auth_token@from_phone/to_phone"

  • Console: "console://" (testing)

See Apprise documentationarrow-up-right for all supported services.


Clip Storage

Configuration for saving video clips to S3-compatible storage or local filesystem.

See Object Storage Configuration Reference for complete documentation including:

  • Parameters (endpoint, bucket, access_key, etc.)

  • Storage backend examples (AWS S3, MinIO, local filesystem)

  • Environment-specific configurations

  • Best practices


Alerting and Storage Combinations

Important: Both notifications and clip recording only trigger when alerts are generated. If alert_mode=AlertMode.NONE, no alerts are generated, so notifications and clip recording will not happen even if configured.

Alert Mode
Notifications
Clip Recording
Configuration

Not NONE

✅ Enabled

✅ Enabled

Set notification_config + configure clip_storage_config with endpoint/bucket

Not NONE

✅ Enabled

❌ Disabled

Set notification_config + leave clip_storage_config endpoint/bucket empty

Not NONE

❌ Disabled

✅ Enabled

Leave notification_config empty + configure clip_storage_config with endpoint/bucket

Not NONE

❌ Disabled

❌ Disabled

Leave notification_config empty + leave clip_storage_config endpoint/bucket empty

NONE

❌ Disabled

❌ Disabled

No alerts generated - notifications and storage disabled regardless of configuration


Live Streaming

Controls video output display.

Parameters:

  • live_stream_mode - Output mode:

    • "LOCAL" - Display in local window

    • "WEB" - Stream via RTSP for web viewing

    • "NONE" - No live display

  • live_stream_rtsp_url (str, optional) - RTSP URL path suffix (used when mode is "WEB")


ReID Expiration Filter

Tracking-specific filter that reduces embedding extraction frequency using adaptive exponential backoff. When enabled, the interval between embedding extractions increases exponentially (1 → 2 → 4 → 8 → ...) up to the configured reid_expiration_frames maximum, improving performance 10-20x while maintaining accuracy.

Configured via face_filters parameter:

  • enable_reid_expiration_filter - Enable/disable (default: False)

  • reid_expiration_frames - Maximum interval in frames (default: 10)

See ReID Expiration Filter for complete documentation including tuning guidance and examples.


Configuration Options

Option 1: Python Configuration

Option 2: YAML Configuration

FaceTrackerConfig can be initialized from a YAML file or string using the from_yaml() method. This approach separates configuration from code, making it easier to version control settings, share configurations across teams, and maintain different configs for development, staging, and production environments.

Complete YAML structure:

Loading from YAML

Returns:

  • config - Initialized FaceTrackerConfig object

  • settings - Raw dictionary (useful for debugging)

Loading from YAML String

Benefits of YAML

  • Clean separation - Config separate from code

  • Easy modification - Change hardware without editing code

  • Version control - Track config changes in git

  • Team collaboration - Share standardized configs

  • Multiple environments - dev.yaml, staging.yaml, prod.yaml


Configuration Examples

Example 1: Security Monitoring

Monitor RTSP camera, alert on unknown faces, save clips, send email:

Example 2: VIP Access Control

Alert when known VIPs appear, display locally:

Example 3: High-Traffic Filtering

Reduce false positives with strict quality filters:

Last updated

Was this helpful?