#
What is AI'GORITHM?
AI'GORITHM is an application for creating algorithms that allows the practical use of ONESTEP AI-trained models in a wide range of scenarios. The aim is to allow users to independently develop their own end applications, which they can then deploy on their own or rented devices, creating a unique AI environment.
For a visual guide on how to create an algorithm in AI'GORITHM
, check out the tutorial on our Youtube channel:
#
Blocks description
#
Session
This is the basic block that defines a session. It is a kind of loop that in each iteration takes a frame from the Stream, applies the Inferencing engine to it, and returns the received Predictions.
INPUTS:
Inferencing - an inference engine from a specified detection or classification model block.
OUTPUT:
Predictions - recognitions containing object categories, their coordinates, number, and information about the frame in which they occurred.
#
Model
Model trained in ONESTEP AI and ready to perform inference on it. There are two types of Models: detection and classification.
OUTPUT:
Inferencing - the inference engine of a given model.
#
Prediction trigger
A block responsible for filtering Predictions received from a Session, processing them, and possibly creating a Prediction Event if the conditions specified by the parameters are met.
There are seven Prediction triggers:
- Categories relation trigger - an object of class X was found above/below/inside/outside an object of class Y.
- Quantity trigger - there were exactly/more than/less than X representatives of class Y.
- Size trigger - the object of class X has size (height x width) exactly/more than/less than YxZ.
- Location trigger - the object of class X was inside/outside the region of interest (ROI).
- Speed trigger - the object of class X covered Y % of the area in a time shorter/longer than Z.
- Category transform trigger - transformation of the class representation of the object from X to Y (for example, we have the classes STANDING-HUMAN and LYING-HUMAN, and the object changes from one state to another).
- Line crossing trigger - an object of class X has crossed a predefined line in one of two directions.
INPUT:
Predictions - a list of recognitions coming from the Session.
OUTPUT:
Predictions event - an event consisting of correlated Predictions, a timestamp, and possibly other metadata that may be relevant to the post-processing of the algorithm.
#
Aggregator
A block that groups (aggregates) Events derived from Prediction triggers.
INPUT:
Prediction event - a specific event related to the predictions coming from the Session.
OUTPUT:
Aggregate - an aggregate that combines all input Events.
#
Aggregation trigger
Trigger that operates on aggregated Events. It analyzes the relationship between Prediction events with consideration of time. There are four Aggregation triggers:
- Events quantity trigger - there were exactly/more than/less than X Predictions events of type Y.
- Time between events trigger - between Predictions events of type X occurred exactly/more than/less than Y time.
- Time interval trigger - an event that occurs unconditionally once every specified amount of time (does not apply to any Prediction events).
- Events sequence trigger - an event that occurs when a specific sequence of Prediction events defined here has occurred previously.
INPUT:
Aggregate - grouped (aggregated) Events.
OUTPUT:
Aggregation event - a new Event consisting of correlated Prediction events and Prediction.
#
Action
This is a block that defines the reaction of the algorithm when a prediction or aggregation Event has occurred. Depending on which Event is connected to it, the corresponding variables resulting from the metadata of this Event will be available in event variables.
There are the four Actions:
- Send HTTP request action - send an HTTP request of GET/POST type with possible additional parameters.
- Send e-mail action - send an e-mail with specified content to a given address.
- Send SMS action - send SMS with specified content to a given number.
- Make screenshot action - save a screenshot from the stream after the event occurs.
INPUT:
Predictions event - A prediction event originating from a Prediction Trigger.
Aggregation event - An aggregation event originating from an Aggregation Trigger.
#
Relations between blocks
- The basic and necessary block for creating an algorithm is the Session. To each Session we need to connect exactly one Media source and we can connect one Model.
- The connection between the Session itself and the Media source is already a complete algorithm.
- If a Prediction trigger is connected to a Session, the algorithm remains a draft until we connect the Action or Aggregator block itself to it, along with the Aggregation trigger and Action.
- Multiple Prediction triggers can be connected to one Session, but each Prediction trigger is connected to only one Session.
- Multiple Prediction triggers can be connected to one Aggregator and vice versa.
- Multiple Aggregation triggers can be connected to one Aggregator, but each Aggregation trigger is connected to only one Aggregator.
- Prediction trigger and Aggregation trigger can be connected to multiple Actions, but each Action has exactly one Trigger connected to it.
#
Examples of algorithms
1. Analyzing the movement of candy bars on a conveyor belt
Suppose we want to analyze the movement of candy bars on a conveyor belt to determine if a bar has moved within a span of 3 seconds and whether it exceeds a certain size threshold more than 50 times. The algorithm might be structured as follows:
MODEL BLOCK
- Model: Object detection model capable of recognizing candy bars
MEDIA SOURCE BLOCK
- Live camera
SESSION BLOCK
PREDICTION TRIGGER BLOCK
Speed trigger
Categories: Bounty, Knoppers, Lion, Lion Coconut, Mars, Prince Polo, Snickers
Seconds: 3
Distance: 100%
Size trigger
Categories: Bounty, Knoppers, Lion, Lion Coconut, Mars, Prince Polo, Snickers
Operator: Greater than
Height: 80%
Widht: 30%
ACTION BLOCK
Send sms action
Given phone number
Sms body
AGGREGATOR
AGGREGATION TRIGGER
Events quantity
Operator: Greater than
Number: 50
ACTION BLOCK
Send sms action
Given phone number
Sms body
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:
MODEL BLOCKS
- Model: Object detection model capable of recognizing card symbols
MEDIA SOURCE BLOCKS
- Live camera (from top and right)
SESSION BLOCKS
QUANTITY TRIGGER BLOCKS
Category: K_S, Q_S, 10_S
Operator: Greater than
Number: 1
AGGREGATOR
AGGREGATION TRIGGER
Events quantity
Operator: Greater than
Number: 1
Consider only events related to the same object
ACTION BLOCK
Make screenshot
Given relative path
Available variables: Occured events names, Events details Json