Algorithm examples
1. Monitoring candy bar movement on a conveyor belt
Imagine a scenario where we need to monitor candy bars moving along a conveyor belt. The goal is to determine if a candy bar moves entirely within a 3-second window or surpasses a defined size threshold more than 50 times. If either condition is met, notifications are sent via SMS. This process can be automated with an algorithm as follows:

Algorithm structure
1. Add a Model block to perform inference:
Click
Add modeland select an object detection model capable of identifying candy bars,Ensure the model has been properly trained and includes the relevant categories.
2. Add a Session block:
- Connect the
Sessionblock to theModelblock. TheSessiondefines a loop that takes a frame from the stream, applies the inferencing engine, and returns the predictions.
3. Add Prediction triggers:
Add a
Speed triggerto identify candy bars moving entirely across the conveyor belt within 3 seconds,Configure the following:
Categories: Select the relevant candy bar categories,
Seconds: Set to 3,
Distance: Set to 100%,
Add a
Size triggerto identify candy bars exceeding the specified size thresholds,Configure the following:
Categories: Select the relevant candy bar categories,
Operator: Set to “greater than”,
Height: Set to 80%,
Width: Set to 30%,
- Connect both prediction triggers to the
Sessionblock.
4. Add a Prediction event:
Add a
Sends sms actionblock to send real-time notifications to a specified phone number,Connect the
Speed triggerto theSend sms actionblock,Configure the following:
Phone numbers list: Add the recipient’s phone number,
SMS body: Set the message (e.g., “The production line is moving too fast”).
5. Add an Aggregator block:
- Connect the
Aggregatorblock to theSize triggerblock. This block groups (aggregates) events derived from prediction triggers.
6. Add an Aggregation trigger:
Add an
Events quantityblock to track when size violations occur more than 50 times for a single candy bar,Configure the following:
Operator: Set to “greater than”
Number: Set to 50.
7. Add another Prediction event:
Add a
Send sms actionblock to send real-time notifications to a specified phone number,Connect the
Events quantityblock toSends sms actionblock,Configure the following:
Phone numbers list: Add the recipient’s phone number,
SMS body: Set the message (e.g., “Candy bars moving on the conveyor belt are too big.”).
2. Analyzing the amount of cards
Suppose we aim to determine the quantity of specific cards captured by both the top and right cameras. The algorithm might be structured as follows:

Algorithm structure
1. Add two Model blocks to perform inference:
Add one
Modelblock for the top camera and another for the right camera,Select object detection models capable of recognizing card symbols,
Ensure models have been properly trained and include the relevant categories.
2. Add two Session blocks:
- Each
Sessionblock should be connected to oneModelblock. TheSessiondefines a loop that takes a frame from the stream, applies the inferencing engine, and returns the predictions.
3. Add two Prediction triggers:
Add two
Quantitytriggers, one for the top camera and one for the right camera,Configure the following:
Category: Select the relevant card symbols,
Operator: Set to “greater than”,
Number: Set to 1,
- Each
Quantitytrigger block should be connected to oneSessionblock.
4. Add an Aggregator block:
- Connect the
Aggregatorblock to theQuantity triggerblocks. This block groups (aggregates) events derived from prediction triggers.
5. Add an Aggregation trigger:
Add an
Events quantityblock to track when quantity violations occur more than 1 time,Configure the following:
Operator: Set to “greater than”,
Number: Set to 1,
Enable Consider only events related to the same object.
6. Add a Prediction event:
Add a
Make screenshot actionblock to to save an image of the detected cards,Connect the
Events quantityblock toMake screenshot actionblock,Configure the following:
Relative path: Add a relative path and use variables such as OccurredEventsNames and EventsDetailsJson to generate file paths dynamically.