Proximity Detector

Detect and create groups of objects when they are close to or far from each other.

Overview

The Proximity Detector node detects and creates groups of objects when they are close to or far from each other. This node makes it easy to build common use cases such as Object left behind, Crowd forming, Service times for drive throughs, etc.

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 : Presence Information

Properties

PropertyDescriptionTypeDefaultRequired
roi_labelsComma separated list of labels for each ROI in the rois list. Format: label1, label2 Ex: door, windowhiddennullfalse
roisSemicolon separated list of areas in the video within which the Proximity Detector tracks these objects. If none is specified, the Proximity Detector tracks objects within the
entire frame. Format: left1,top1,right1,bottom1; left2,top2,right2,bottom2 Ex: 10,10,100,100; 200,200,300,300polygonnullfalse
proximity_groupsComma separated list of group types to detect. Format: A+B (Objects of Type A which have Type B nearby), A-B (Objects of Type A without any Type B nearby) Ex. `car
+person,person+person,bag-person,car.red+personAccepted formats:object_label: any object of this type, with or without a classifier attribute. Example: car, object_label.class_type`:
any object of this type that has a specific classifier attribute. Example: car.red, object_label.*: any object of this type that has at least one classifier attribute. Example: car.*
(this will matchcar.red, car.yellow, etc)model-labelnulltrueproximity_modeProximity mode. Options:distanceObject distance (A+B: A with B in distance limit, A-B: A without B in distance limit),enclosedObject within (A+B: A inside B, A-B: A outside B),containsObject contains (A+B: A contains B, A-B: A does not contain B)enum"distance"false
distance_thresholdPixel distance between two objects to be considered as within a '+' group or outside a '-' group. Range: 0-1. Specified as percentage of video source width. Min: 0, Max: 1.0, Step: 0.05. Conditional on proximity_mode being set todistance.slider0.1truemerge_modeGroup merge mode. Options:no_merge, same_type, any_typeenumsame_typefalse
min_group_sizeIgnore groups smaller than this size.number1true
min_group_lifespanIgnore groups that exist for less than this amount of time in seconds.float1.0true
output_modeGroup output mode. Options:object(Output each group as an individual object with a unique ID),attribute(Adds the 2nd (& subsequent) objects (B) as attributes to the primary object (A))enum"object"false
group_lifespan_trigger_thresholdSet a trigger when the group lifespan exceeds this time in seconds.float5true
group_size_trigger_thresholdSet a trigger when the group size exceeds this number.number1true
display_groups_modeDisplay groups on video. Options:none, above_threshold, allenum"above_threshold"false
display_propertiesDisplay group properties. Options:basic, intermediate, detailedenum"intermediate"false
display_roiDisplay ROI on video?booltruefalse
tracking_modeTracking mode. Options:centroid, top_center, bottom_center, left_center, right_centerenum"centroid"false
object_contain_modeObject containment mode. Options:bbox(Bounding box inside other object's bounding box),tracking_point(Selected tracking point inside other object's bounding box)enum"tracking_point"false
negative_attribute_prefixPrefix for negative attributes. Conditional on output_mode being set to "attribute".string"-"false

Metadata

Metadata PropertyDescription
nodes.<node_id>Describes the ROIs monitored by this node, and their properties. Format : as defined in the table below. <node_id> for Proximity Detector Nodes is of the form annotate_proximityX (ex. annotate_proximity1)
objects[x]Group is inserted as a new object with a unique ID, or object attributes are added to the existing object depending on the value of output_mode property.

Example

"nodes": {
    "annotate_proximity1": {
        "type": "annotate_proximity",
        "rois": {
            "<roi_label>": {
                "coords": [[<point1_x>, <point1_y>], 
                           [<point2_x>, <point2_y>], 
                           [<point3_x>, <point3_y>]],
                "groups_entered_delta": <int>,
                "groups_above_lifespan_threshold_count": <int>,
                "groups_above_lifespan_threshold_delta": <int>,
                "groups_above_size_threshold_count": <int>,
                "groups_above_size_threshold_delta": <int>,                  
                "current_group_count": <int>,
                "groups": [
                  	{
                        "id": <group unique ID>,
                        "label": "<group type>",
                        "objects": [<object_id1>, <object_id2>, ....],
						"lifespan": <seconds>                      
                    }
                ]
            }
        }
    }
}

Format

KeyTypeDescription
<roi_label>Array of dictionariesContains information about this specific ROI
<roi_label>.coordsArray of ArraysContains the bounding box coordinates that represent this ROI
<roi_label>.current_group_countIntegerNumber of groups currently in this ROI
<roi_label>.groups_entered_deltaIntegerNumber of groups that entered the ROI between last frame and this frame
<roi_label>.groups_above_lifespan_threshold_countIntegerNumber of groups inside the ROI above the specified time threshold
<roi_label>.groups_above_lifespan_threshold_deltaIntegerNumber of new groups that exceeded the time threshold between the last frame and this frame
<roi_label>.groups_above_size_threshold_countIntegerNumber of groups inside the ROI above the specified size threshold
<roi_label>.groups_above_size_threshold_deltaIntegerNumber of new groups that exceeded the size threshold between the last frame and this frame
<roi_label>.groupsArray of dictionariesInformation about the groups currently in the ROI. id : Unique identifier for a specific group. label : Group Type (ex. car+person). objects : List of object IDs that make up this group, as obtained from Track Objects Node. lifespan : Time this group has been seen.