Line Crossing Counter
Counts how many particular tracked objects crossed each line
Overview
The Line Counter node keeps track of the number of objects that cross a virtual line in the video, the direction they cross it in, and adds the line counting metadata to the frame metadata. This node makes it easy to build common use cases such as People counting, Parking lot occupancy counting, etc.
This node supports Lines with one or more segments, allowing you to be as granular as you need for your counting needs.
This node requires a AI Model Node and a Track Objects Node before it in order to function properly.
Inputs & Outputs
- Inputs : 1, Media Format : Raw Video
- Outputs : 1, Media Format: Raw Video
- Output Metadata : Line Counter Information
Properties
Property | Description | Type | Default | Required |
---|---|---|---|---|
line_labels | List of labels for each line. | list | null | Yes |
lines | List of lines in the video across which objects will be tracked. Each line can have multiple segments defined by two or more points (x1,y1,x2,y2,x3,y3). Must correspond to labels defined in line_labels . | multiline | null | Yes |
objects_to_track | Object types and classes to be counted. Accepts object labels defined in the AI model (e.g. 'car', 'person') and classifier attributes (e.g. 'car.red'). Leave blank to count all objects. | model-label | null | No |
crossing_buffer | Interval in seconds during which subsequent line crossings by the same object will be ignored. | float | 0.5 | Yes |
display_line | Controls whether line information will be displayed on the video stream. | bool | true | No |
display_objects | Controls whether objects will be displayed on the video stream. | bool | true | No |
tracking_mode | Point on object used to determine line crossing. Options: "centroid", "top-center", "bottom-center", "left-center", "right-center". | enum | "centroid" | No |
dir1_label | Label for Direction 1 (blue color in the lines widget). | string | null | No |
dir2_label | Label for Direction 2 (red color in the lines widget). | string | null | No |
add_object_attributes | Add specified labels as attributes to objects that cross the line. Options: "none", "direction", "line", "line_direction". | enum | "none" | No |
persistent_storage | If true, analytics will be persisted to disk and restored when pipeline restarts. | bool | false | No |
Metadata
Metadata Property | Description |
---|---|
nodes.<node_id> | Describes the Lines monitored by this node, and their properties. \nFormat : as defined in the table below. \n \n<node_id> for Line Counter Nodes is of the form annotate_line_counterX (ex. annotate_line_counter1 ) |
Example
"nodes": {
"annotate_line_counter1": {
"type": "annotate_line_counter",
"lines": {
"<line_label>": {
"dir1_label": "entry",
"dir2_label": "exit",
"coords": [[<point1_x>, <point1_y>],[<point2_x>, <point2_y> ]],
"total_objects_crossed": <number>,
"total_objects_crossed_delta": <number>,
"dir1_objects_crossed": <number>,
"dir1_objects_crossed_delta": <number>,
"dir2_objects_crossed": <number>,
"dir2_objects_crossed_delta": <number>,
"cur_dir1_objects": [ <object_tracking_id>,<object_tracking_id> ],
"cur_dir2_objects": [ <object_tracking_id>,<object_tracking_id> ]
}
}
}
}
Format
Key | Type | Description |
---|---|---|
<line_label> | Array of dictionaries | Contains information about this specific line |
<line_label>.coords | Dictionary | Contains the coordinates for this line \n \npoint1_x , point1_y : Coordinates of one endpoint \npoint2_x , point2_y : Coordinates of the other endpoint |
<line_label>.total_objects_crossed | Integer | Number of objects seen crossing this line since the start of the pipeline |
<line_label>.total_objects_crossed_delta | Integer | Number of objects seen crossing this line between last frame and this frame (both directions) |
<line_label>.dir1_objects_crossed | Integer | Number of objects seen crossing this line, in one direction since the start of the pipeline |
<line_label>.dir1_objects_crossed_delta | Integer | Number of objects seen crossing this line between last frame and this frame in the direction 1 |
<line_label>.dir2_objects_crossed | Integer | Number of objects seen crossing this line, in the other direction since the start of the pipeline |
<line_label>.dir2_objects_crossed_delta | Integer | Number of objects seen crossing this line between last frame and this frame in the direction 2 |
<roi_label>.cur_dir1_objects | List of object IDs | Information about the objects currently crossing the line in the first direction \n \nobject_tracking_id : Unique identifier for a specific object, as specified by object.id property (see AI Model Node ) |
<roi_label>.cur_dir2_objects | List of object IDs | Information about the objects currently crossing the line in the other direction \n \nobject_tracking_id : Unique identifier for a specific object, as specified by object.id property (see AI Model Node ) |
Updated 3 days ago