Behavior Analytics#
The Behavior Analytics microservice is implemented in Python and leverages the Python Multiprocessing library for parallel processing.
The perception layer processes camera or video input streams, performing sequential frame analysis for object detection and tracking. It generates object embeddings and sends protobuf messages containing frame metadata to a message broker. The pipeline supports multiple message brokers including Kafka, Redis Streams, and MQTT, allowing flexibility based on deployment requirements.
The metadata from the perception layer represents a frame containing object detection bounding boxes, tracking IDs, embedding vectors, and other attributes. This input is processed by the pipeline to generate Behavior data. A Behavior represents an object tracked over time with its associated attributes.
For detailed information on all components, APIs, and customization options, refer to the Behavior Analytics.
Configurations#
The Behavior Analytics microservice requires configuration files that control various aspects of the analytics pipeline. These files allow users to customize the system’s behavior according to their specific requirements.
Application Configuration File#
The main configuration file for Behavior Analytics controls message broker settings, sensor configurations, and pipeline parameters. The configuration supports multiple message broker types (Kafka, Redis Streams, MQTT).
{
"kafka": {
"brokers": "localhost:9092",
"consumer": {
"autoOffsetReset": "latest",
"enableAutoCommit": false,
"maxPollIntervalMs": 900000,
"maxPartitionFetchBytes": 10485760,
"fetchMaxBytes": 104857600,
"maxPollRecords": 10000,
"timeout": 0.01
},
"producer": {
"lingerMs": 0
},
"topics": [
{"name": "raw", "value": "mdx-raw"},
{"name": "frames", "value": "mdx-frames"},
{"name": "behavior", "value": "mdx-behavior"},
{"name": "notification", "value": "mdx-notification"},
{"name": "events", "value": "mdx-events"},
{"name": "incidents", "value": "mdx-incidents"}
]
},
"sensors": [
{
"id": "default",
"configs": [
{"name": "proximityDetectionEnable", "value": "true"},
{"name": "proximityDetectionThreshold", "value": "1.8"},
{"name": "proximityDetectionCenterClasses", "value": "[\"Person\"]"},
{"name": "proximityDetectionSurroundingClasses", "value": "[\"Person\"]"}
]
}
],
"app": [
{"name": "sourceType", "value": "kafka"},
{"name": "sinkType", "value": "kafka"},
{"name": "numWorkersForBehaviorCreation", "value": "2"},
{"name": "numWorkersForFrameEnhancement", "value": "2"},
{"name": "behaviorWatermarkSec", "value": "30"},
{"name": "behaviorStateTimeout", "value": "10"},
{"name": "behaviorMaxPoints", "value": "200"},
{"name": "objectConfidenceThreshold", "value": "0.5"},
{"name": "proximityViolationIncidentEnable", "value": "true"},
{"name": "proximityViolationIncidentThreshold", "value": "1"},
{"name": "restrictedAreaViolationIncidentEnable", "value": "true"},
{"name": "confinedAreaViolationIncidentEnable", "value": "true"},
{"name": "fovCountViolationIncidentEnable", "value": "true"},
{"name": "fovCountViolationIncidentObjectThreshold", "value": "3"},
{"name": "fovCountViolationIncidentObjectType", "value": "Person"}
]
}
Message Broker Configuration#
Parameter |
Description |
Default Value |
|---|---|---|
|
Message broker type for input (kafka, redisStream, mqtt) |
|
|
Message broker type for output (kafka, redisStream, mqtt) |
|
Kafka Topics#
Topic Name |
Description |
Default Value |
|---|---|---|
|
Input metadata from perception layer |
|
|
Behavior data output |
|
|
Tripwire and ROI events |
|
|
Enhanced frames metadata |
|
|
Calibration updates and sensor notifications |
|
|
Incident data from violation detection |
|
Pipeline Configuration#
Parameter |
Description |
Default Value |
|---|---|---|
|
Number of workers for behavior creation (0 disables) |
Required |
|
Number of workers for frame enhancement (0 disables) |
Required |
|
Enable 3D mode for pipeline processing |
|
|
Enable compact frame metadata format |
|
|
Minimum confidence score for object detection |
|
|
Cosine similarity threshold for embedding clustering |
|
|
Coordinate system for calibration (image, euclidean, geo) |
|
Playback Configuration#
Parameter |
Description |
Default Value |
|---|---|---|
|
Use simulated time for playback |
|
|
Number of times to loop through playback data |
|
|
Filter out frames with no objects |
|
|
Time delta in minutes for simulation mode |
|
|
Frames per second for simulation playback |
|
|
Base timestamp for simulation (ISO format) |
|
|
Delay in seconds before playback starts |
|
|
List of sensor IDs to include in playback (empty = all) |
|
State Management Configuration#
Parameter |
Description |
Default Value |
|---|---|---|
|
Timeout (seconds) before object state cleanup |
|
|
Minimum time (seconds) for valid behavior |
|
|
Watermark for behavior in seconds |
|
|
Maximum behavior points to store |
|
|
Object types to manage (empty = all types) |
|
Proximity Detection Configuration (Sensor-level)#
Parameter |
Description |
Default Value |
|---|---|---|
|
Enable proximity violation detection |
|
|
Distance threshold in meters |
|
|
Center object types (e.g., AMR, humanoid) |
|
|
Surrounding object types to check |
|
Incident Detection Configuration#
Parameter |
Description |
Default Value |
|---|---|---|
|
TTL (seconds) for object presence data |
|
|
Enable proximity violation incidents |
|
|
Duration (seconds) to confirm incident |
|
|
Gap (seconds) before new violation state |
|
|
Enable restricted area incidents |
|
|
Duration (seconds) to confirm incident |
|
|
Enable confined area incidents |
|
|
Duration (seconds) to confirm incident |
|
|
Enable FOV count violation incidents |
|
|
Maximum objects allowed in FOV |
|
|
Duration (seconds) to confirm incident |
|
|
Object type to count for FOV violations |
|
Tripwire Configuration (Sensor-level)#
Parameter |
Description |
Default Value |
|---|---|---|
|
Minimum points before/after tripwire crossing |
|
Frame Management Configuration (Sensor-level)#
Parameter |
Description |
Default Value |
|---|---|---|
|
Minimum frames for frame state management |
|
Calibration File#
The calibration file defines camera parameters, regions of interest (ROIs), tripwires, and coordinate transformations. Use the Calibration tool to generate this JSON file. For more details, refer to the Calibration documentation. For the calibration JSON structure, see Calibration Schema.
Runtime Configuration Adjustments#
This section covers common configuration changes for deploying the Behavior Analytics pipeline.
Modifying Message Broker Settings#
To switch between message brokers (Kafka, Redis Streams, MQTT), update the sourceType and sinkType parameters:
{
"app": [
{"name": "sourceType", "value": "redisStream"},
{"name": "sinkType", "value": "redisStream"}
]
}
Ensure the corresponding broker configuration section is properly configured (kafka, redisStream, or mqtt).
Configuring Worker Parallelism#
Adjust the number of workers based on your deployment’s processing requirements:
{
"app": [
{"name": "numWorkersForBehaviorCreation", "value": "4"},
{"name": "numWorkersForFrameEnhancement", "value": "4"}
]
}
Note
Setting worker count to 0 disables that processing stage. Both parameters are required and have no default values.
Enabling Violation Detection#
To enable specific violation types for incident generation:
{
"app": [
{"name": "proximityViolationIncidentEnable", "value": "true"},
{"name": "restrictedAreaViolationIncidentEnable", "value": "true"},
{"name": "confinedAreaViolationIncidentEnable", "value": "true"},
{"name": "fovCountViolationIncidentEnable", "value": "true"},
{"name": "fovCountViolationIncidentObjectThreshold", "value": "5"},
{"name": "fovCountViolationIncidentObjectType", "value": "Person"}
]
}
Configuring Sensor-Specific Settings#
Override default configurations for specific sensors:
{
"sensors": [
{
"id": "default",
"configs": [
{"name": "proximityDetectionEnable", "value": "false"},
{"name": "tripwireMinPoints", "value": "5"}
]
},
{
"id": "Warehouse_Cam1",
"configs": [
{"name": "proximityDetectionEnable", "value": "true"},
{"name": "proximityDetectionThreshold", "value": "2.0"},
{"name": "proximityDetectionCenterClasses", "value": "[\"Agility_Digit_Humanoid\"]"},
{"name": "proximityDetectionSurroundingClasses", "value": "[\"Person\"]"}
]
}
]
}
Sensors inherit from the default configuration and override only the specified parameters.