Modify and Merge Objects

Merges and modifies objects, changes object bbox sizes & attributes, and allows rename and grouping of class names

Overview

This node can be used if you want to merge bounding boxes of objects of the same class, or rename one or more object classes into a specific class, or modify the object's attributes'.

Requires a AI Model Node before it in order to function properly. Having a Track Objects Node before is required if using Object Match Patterns else you can place it after the Merge Objects node.

Inputs & Outputs

  • Inputs : 1, Media Format : Raw Video
  • Outputs : 1, Media Format: Raw Video
  • Output Metadata : Filtered Objects Information

Properties

PropertyDescriptionTypeDefaultRequired
object_typesIf specified, only process objects of these types. Leave blank to process all objects.model-labelsnullNo
object_match_patternsOnly modify objects with IDs specified in the metadata attribute(s) defined by this pattern. Requires tracker prior to this node. Format: comma-separated metadata paths or patterns.stringnullNo
processing_modeObject processing mode. Options: Continuous (continuous): Process objects continuously after they match type/patterns specified atleast once; Matched (matched): Process objects only when they match the type/patterns specified.enummatchedNo
min_presence_secsOnly process objects/attributes that have been seen for at least this duration. Conditional on processing_mode being continuous. Unit: seconds.float0No
rename_objects_toRename object types specified using object types above. If object types are specified, number of renamed objects must match number of object types.stringnullNo
add_object_attributesFormat: <attribute> or <attribute>=<class_id>. Ex. wrong_way,object_of_interest=6700. Add the specified attributes to the object, keeping any attributes it already has.stringnullNo
convert_missing_attributesIf enabled, convert any specified missing attributes (person.-mask) to a negative attribute (person.no_mask).boolfalseNo
remove_object_attributesFormat: <attribute>. Ex. wrong_way,object_of_interest. Remove the specified attributes from the object.stringnullNo
keep_only_attributesFormat: <attribute>. Ex. mask,helmet. Keep only these attributes on the object if they are already present, and remove all others. Does not add new attributes.stringnullNo
replace_object_attributesFormat: <attribute> or <attribute>=<class_id>. Ex. wrong_way,object_of_interest=6700. Replace all the object attributes with the ones specified.stringnullNo
scale_factorGrows/shrinks the bounding box of the objects by this factor. Does not resize the object itself. Range: minimum 0, maximum 10.0. Step: 0.1. Unit: x (times).float1.0No
overlap_thresholdMerges all overlapping objects with overlap ratio (Intersection over Union (IoU)) above this threshold. Range: minimum 0, maximum 1.0. Step: 0.05. Unit: %.floatnullNo
display_objectsIf enabled, objects removed as a result of the merge will be drawn on video for debug purposes.boolfalseNo
object_history_durationRemember objects for this duration after they are last seen in case they reappear. Unit: seconds.float600No

Intersection over Union (IoU)

IoU (Intersection over Union) is the area of overlap between two detection bounding boxes divided by the area of union of both.

Output Metadata

The fields below are declared by this node's metadata schema; the JSON values are representative examples.

PathTypeDescription
objectsarrayValue of objects.
objects[].attributesarrayValue of attributes.
objects[].attributes[].class_idintegerValue of class id.
objects[].attributes[].labelstringValue of label.
objects[].attributes[].probabilitynumberValue of probability.
objects[].class_idintegerValue of class id.
objects[].idintegerValue of id.
objects[].labelstringValue of label.
objects[].probabilitynumberValue of probability.
objects[].rect.heightintegerValue of height.
objects[].rect.leftintegerValue of left.
objects[].rect.topintegerValue of top.
objects[].rect.widthintegerValue of width.

JSON example

{
  "objects": [
    {
      "attributes": [
        {
          "class_id": 0,
          "label": "example",
          "probability": 0.9
        }
      ],
      "class_id": 0,
      "id": 1,
      "label": "person",
      "probability": 0.95,
      "rect": {
        "height": 320,
        "left": 120,
        "top": 80,
        "width": 160
      }
    }
  ]
}

Additional details

Object labels and attributes

  • Object labels/classes added: rename_objects_to can replace an upstream object's label with a configured label; the upstream class ID is retained.
  • Object attribute labels/classes added: Configured add/replace labels use their configured class ID, or 45000 when omitted. Missing required attributes can add no_<attribute> with class 45000.

Did this page help you?